Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.12

Bug #1260 [patch] INI file without sections
Submitted: 2004-04-22 10:49 UTC
From: dostick at ctco dot lv Assigned: mansion
Status: Duplicate Package: Config
PHP Version: 4.3.6 OS: UNIX
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 18 + 3 = ?

 
 [2004-04-22 10:49 UTC] dostick at ctco dot lv
Description: ------------ Sometimes it ts required to create INI files without sections. PEAR_Config always create section [root] This patch creates "SimpleINIFile" container from INIFIle container . SimpleINIFile is teh same but does not create sections. This is may be solution for bug #378 Reproduce code: --------------- 18c18 < // $Id: SimpleIniFile.php,v 1.1 2004/01/26 14:35:52 zzz Exp $ --- > // $Id: IniFile.php,v 1.1 2004/01/05 15:22:55 zzz Exp $ 28c28 < class Config_Container_SimpleIniFile { --- > class Config_Container_IniFile { 147,148c147,148 < if (!$obj->isRoot()) { // Do not write section names < $string = ''; --- > if (!$obj->isRoot()) { > $string = '['.$obj->name."]\n"; dostick@dragon /PUBLIC/virtual/intra4.ctco.lv/webapp> diff -u SimpleIniFile.php- PEAR/Config/Container/IniFile.php --- SimpleIniFile.php- Mon Jan 26 16:35:52 2004 +++ PEAR/Config/Container/IniFile.php Mon Jan 5 17:22:55 2004 @@ -15,7 +15,7 @@ // | Authors: Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: SimpleIniFile.php,v 1.1 2004/01/26 14:35:52 zzz Exp $ +// $Id: IniFile.php,v 1.1 2004/01/05 15:22:55 zzz Exp $ /** * Config parser for PHP .ini files @@ -25,7 +25,7 @@ * @author Bertrand Mansion <bmansion@mamasam.com> * @package Config */ -class Config_Container_SimpleIniFile { +class Config_Container_IniFile { /** * This class options @@ -144,8 +144,8 @@ } break; case 'section': - if (!$obj->isRoot()) { // Do not write section names - $string = ''; + if (!$obj->isRoot()) { + $string = '['.$obj->name."]\n"; } if (count($obj->children) > 0) { for ($i = 0; $i < count($obj->children); $i++) {

Comments

 [2004-04-22 11:43 UTC] dostick at ctco dot lv
correct diff: --- SimpleIniFile.php- Mon Jan 26 16:35:52 2004 +++ PEAR/Config/Container/IniFile.php Mon Jan 5 17:22:55 2004 @@ -15,7 +15,7 @@ // | Authors: Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: SimpleIniFile.php,v 1.1 2004/01/26 14:35:52 zzz Exp $ +// $Id: IniFile.php,v 1.1 2004/01/05 15:22:55 zzz Exp $ /** * Config parser for PHP .ini files @@ -25,7 +25,7 @@ * @author Bertrand Mansion <bmansion@mamasam.com> * @package Config */ -class Config_Container_SimpleIniFile { +class Config_Container_IniFile { /** * This class options @@ -144,8 +144,8 @@ } break; case 'section': - if (!$obj->isRoot()) { // Do not write section names - $string = ''; + if (!$obj->isRoot()) { + $string = '['.$obj->name."]\n"; } if (count($obj->children) > 0) { for ($i = 0; $i < count($obj->children); $i++) {
 [2004-06-04 09:21 UTC] bmansion at mamasam dot com
This is a duplicate of #378 See how this was fixed there.