parse_ini_file problem

parse_ini_file problem

am 26.08.2009 18:54:24 von Richard H Lee

Hi all,

I think I'm having a problem with parse_ini_file in php. I am using wamp
on two machines. I'm installing a Digishop e-commerce package.

The blah.ini.php file starts with

----------------



[SOMETITLE]
some_setting="Ok, I Have Completed This Step"
another_setting="Next"
...
...
...
----------------

On one machine which uses php 5.2.5 it parses the file fine and installs
properly

But on another machine which use 5.3.0 i get the error

Warning: parse error in blah.ini.php on line 1 in myparser.php on line 81

On the 5.3.0 if I remove the it works fine. But it still
does not install the sofware properly.

I get the feeling php on the 5.3.0 marchine is parsing the file
differently to the 5.2.5. I doubt anything has changed between the
versions. I also compared the phpinfos between the two setups but could
not see anything outstanding.

Have any of you guys seen this behaviour before?

Cheers,

Richard

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: parse_ini_file problem

am 27.08.2009 02:48:59 von List Manager

Richard H Lee wrote:
> Hi all,
>
> I think I'm having a problem with parse_ini_file in php. I am using wamp
> on two machines. I'm installing a Digishop e-commerce package.
>
> The blah.ini.php file starts with
>
> ----------------
>
>
>
> [SOMETITLE]
> some_setting="Ok, I Have Completed This Step"
> another_setting="Next"
> ..
> ..
> ..
> ----------------
>
> On one machine which uses php 5.2.5 it parses the file fine and installs
> properly
>
> But on another machine which use 5.3.0 i get the error
>
> Warning: parse error in blah.ini.php on line 1 in myparser.php on line 81
>
> On the 5.3.0 if I remove the it works fine. But it still
> does not install the sofware properly.
>
> I get the feeling php on the 5.3.0 marchine is parsing the file
> differently to the 5.2.5. I doubt anything has changed between the
> versions. I also compared the phpinfos between the two setups but could
> not see anything outstanding.
>
> Have any of you guys seen this behaviour before?
>
> Cheers,
>
> Richard
>

I would write a little line to your cli like this

php -r 'print_r(parse_ini_file("/path/to/your/ini.file.php"));'

see if the output is different. If it is, then you know that the two
versions are doing something different.

If you find that the output is different and you have more questions
please provide the output from "php -v" from both machines and we might
be able to help further.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: parse_ini_file problem

am 27.08.2009 10:39:19 von Ralph Deffke

Is it that some code, creating this error u talking about, is reading the
init file?

I would guess so, to me it looks like if u open the file dirctly the scrupt
is suppost to die. that seems like a little funny protection not no show the
init parameters.

if thats the case u got to send the code producing the error.

ralph_defke@yahoo.de

"Richard H Lee" wrote in message
news:BF.55.21292.3C8659A4@pb1.pair.com...
> Hi all,
>
> I think I'm having a problem with parse_ini_file in php. I am using wamp
> on two machines. I'm installing a Digishop e-commerce package.
>
> The blah.ini.php file starts with
>
> ----------------
>
>
>
> [SOMETITLE]
> some_setting="Ok, I Have Completed This Step"
> another_setting="Next"
> ..
> ..
> ..
> ----------------
>
> On one machine which uses php 5.2.5 it parses the file fine and installs
> properly
>
> But on another machine which use 5.3.0 i get the error
>
> Warning: parse error in blah.ini.php on line 1 in myparser.php on line 81
>
> On the 5.3.0 if I remove the it works fine. But it still
> does not install the sofware properly.
>
> I get the feeling php on the 5.3.0 marchine is parsing the file
> differently to the 5.2.5. I doubt anything has changed between the
> versions. I also compared the phpinfos between the two setups but could
> not see anything outstanding.
>
> Have any of you guys seen this behaviour before?
>
> Cheers,
>
> Richard




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: parse_ini_file problem

am 27.08.2009 10:53:33 von Stut

2009/8/26 Richard H Lee :
> Hi all,
>
> I think I'm having a problem with parse_ini_file in php. I am using wamp on
> two machines. I'm installing a Digishop e-commerce package.
>
> The blah.ini.php file starts with
>
> ----------------
>
>
>
> [SOMETITLE]
> some_setting="Ok, I Have Completed This Step"
> another_setting="Next"
> ..
> ..
> ..
> ----------------
>
> On one machine which uses php 5.2.5 it parses the file fine and installs
> properly
>
> But on another machine which use 5.3.0 i get the error
>
> Warning: parse error in blah.ini.php on line 1 in myparser.php on line 81
>
> On the 5.3.0 if I remove the it works fine. But it still does
> not install the sofware properly.
>
> I get the feeling php on the 5.3.0 marchine is parsing the file differently
> to the 5.2.5. I doubt anything has changed between the versions. I also
> compared the phpinfos between the two setups but could not see anything
> outstanding.
>
> Have any of you guys seen this behaviour before?

My guess would be that on the 5.2.5 machine it's configured so it
doesn't show warnings. In both versions an INI file like would cause a
parse warning.

To get around it you should put a semicolon (;) at the start of the
comment but if someone somehow manages to hit the file directly all
they'll see is the semicolon.

-Stuart

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: parse_ini_file problem [SOLVED]

am 27.08.2009 16:28:40 von Richard H Lee

Hi Jim,

Cheers for the reply.

I had to swap the quotes around to get it running on the windows command
line.

This from the 5.3.0 machine that does not parse:
------------
C:\wamp\www\digishop\install\lang>C:\wamp\bin\php\php5.3.0\p hp -r
"print_r(parse_ini_file('1-ISO-8859-1.ini.php'));"
PHP Warning: parse error in 1-ISO-8859-1.ini.php on line 1
in Command line code on line 1

Warning: parse error in 1-ISO-8859-1.ini.php on line 1
in Command line code on line 1
------------

This is from the 5.2.5 machine that parses properly:
------------
C:\wamp\www\digishop\install\lang>C:\wamp\bin\php\php5.2.5\p hp -r
"print_r(parse_ini_file('"1-ISO-8859-1.ini.php'));"
Array
(
[btn_step_complete] => Ok, I Have Completed This Step
[btn_next] => Next
[btn_cancel] => Cancel
....
..
..
------------

The php warning displayed is exac

php -v on the 5.3.0 machine:
------------
C:\wamp\www\digishop\install\lang>C:\wamp\bin\php\php5.3.0\p hp -v
PHP 5.3.0 (cli) (built: Jun 29 2009 21:25:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
------------

php -v on the 5.3.0 machine:
------------
C:\wamp\www\digishop\install\lang>C:\wamp\bin\php\php5.2.5\p hp -v
PHP 5.2.5 (cli) (built: Nov 8 2007 23:18:51)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
------------

So I checked the changelog from 5.2.5 to 5.3.0:
o Added 3rd optional parameter to parse_ini_file() to
specify the scanning mode of INI_SCANNER_NORMAL or INI_SCANNER_RAW. In
raw mode option values and section values are treated as-is.
* Added parse_ini_string() function. (grange at lemonde dot fr,
Arnaud)
* Fixed bug #46347 (parse_ini_file() doesn't support * in keys).
(Nuno)
* Fixed bug #45384 (parse_ini_file will result in parse error with
no trailing newline). (Arnaud)
* Fixed bug #44842 (parse_ini_file keys that start/end with
underscore). (Arnaud)
* Fixed bug #44575 (parse_ini_file comment # line problems). (Arnaud)
* Fixed bug #45956 (parse_ini_file() does not return false with
syntax errors in parsed file). (Jani)



So I installed PHP 5.2.5 and it worked.

Thanks to everyone for their help!



Richard Lee


Jim Lucas wrote:
> Richard H Lee wrote:
>> Hi all,
>>
>> I think I'm having a problem with parse_ini_file in php. I am using wamp
>> on two machines. I'm installing a Digishop e-commerce package.
>>
>> The blah.ini.php file starts with
>>
>> ----------------
>>
>>
>>
>> [SOMETITLE]
>> some_setting="Ok, I Have Completed This Step"
>> another_setting="Next"
>> ..
>> ..
>> ..
>> ----------------
>>
>> On one machine which uses php 5.2.5 it parses the file fine and installs
>> properly
>>
>> But on another machine which use 5.3.0 i get the error
>>
>> Warning: parse error in blah.ini.php on line 1 in myparser.php on line 81
>>
>> On the 5.3.0 if I remove the it works fine. But it still
>> does not install the sofware properly.
>>
>> I get the feeling php on the 5.3.0 marchine is parsing the file
>> differently to the 5.2.5. I doubt anything has changed between the
>> versions. I also compared the phpinfos between the two setups but could
>> not see anything outstanding.
>>
>> Have any of you guys seen this behaviour before?
>>
>> Cheers,
>>
>> Richard
>>
>
> I would write a little line to your cli like this
>
> php -r 'print_r(parse_ini_file("/path/to/your/ini.file.php"));'
>
> see if the output is different. If it is, then you know that the two
> versions are doing something different.
>
> If you find that the output is different and you have more questions
> please provide the output from "php -v" from both machines and we might
> be able to help further.
>
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php