Re: [PHP] parse_ini_file problem [SOLVED]

2009-08-27 Thread 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\php -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\php -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\php -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\php -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



Re: [PHP] parse_ini_file problem

2009-08-27 Thread Stuart
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
http://stut.net/

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



Re: [PHP] parse_ini_file problem

2009-08-26 Thread Jim Lucas
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: [PHP] parse_ini_file problem

2004-08-27 Thread Ramil Sagum
On Fri, 27 Aug 2004 12:54:14 +0300, Vladimir <[EMAIL PROTECTED]> wrote:
> Hello folks!
> 
> I have an ini file that looks like this:
> index.rent=Rent
> index.faq=FAQ
> index.contact=Contact
> index.links=Links
> 
> then I want to read this file:
> $english_messages = parse_ini_file('conf/english.ini');
> print_r($english_messages);
> 
> What I see is:
> Array ( [index.rent] => Rent )
> 
> And that's all. Shouldn't parse_ini_file return all the messages I have in
> ini file but not only the first one? I'm using 4.3.8 on windows XP.
> 
> TIA.
> Vladimir
> 

I can't seem to replicate your problem (and I copied the code from your email).
No warnings? DId you check the log for messages?




ramil

http://ramil.sagum.net

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