php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46326 error_reporting ignored in php-cli.ini (re2c lexer issue with BOM in the file)
Submitted: 2008-10-17 11:28 UTC Modified: 2008-12-24 14:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: RQuadling at GMail dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3CVS-2008-10-17 (snap) OS: *
Private report: No CVE-ID: None
 [2008-10-17 11:28 UTC] RQuadling at GMail dot com
Description:
------------
No matter what value I set in my php-cli.ini file for 
error_reporting, it is ignored.

Using PHP 5.3.0alpha3-dev (cli) (built: Oct 17 2008 12:03:10) from 
http://windows.php.net


In using ProcMon and looking for Processes like "PHP" and Path ending 
in ".INI", the only file I am looking at is C:\PHP\PHP5\INI\php-
cli.ini





Reproduce code:
---------------
<?php
$s_INI = file_get_contents(php_ini_loaded_file());
preg_match_all('`^error_reporting[^\r\n]++`sim', $s_INI, $a_Matches);

echo
  'php_sapi_name()         = ', php_sapi_name(), PHP_EOL,
  'phpversion()            = ', phpversion(), PHP_EOL,
  'php_ini_loaded_file()   = ', php_ini_loaded_file(), PHP_EOL,
  'php_ini_scanned_files() = ', php_ini_scanned_files(), PHP_EOL,
  'error_reporting()       = ', error_reporting(), PHP_EOL,
  'INI error_reporting     = ', $a_Matches[0][0], PHP_EOL;



Expected result:
----------------
php_sapi_name()         = cli
phpversion()            = 5.3.0alpha3-dev
php_ini_loaded_file()   = C:\PHP\PHP5\INI\php-cli.ini
php_ini_scanned_files() =
error_reporting()       = 65535
INI error_reporting     = error_reporting = 65535

Actual result:
--------------
php_sapi_name()         = cli
phpversion()            = 5.3.0alpha3-dev
php_ini_loaded_file()   = C:\PHP\PHP5\INI\php-cli.ini
php_ini_scanned_files() =
error_reporting()       = 22519
INI error_reporting     = error_reporting = 65535





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-17 12:50 UTC] RQuadling at GMail dot com
Some more examples in playing around with this ...

php_sapi_name()         = cli
phpversion()            = 5.3.0alpha3-dev
php_ini_loaded_file()   = C:\PHP\PHP5\INI\php-cli.ini
php_ini_scanned_files() =
error_reporting()       = 22519
INI error_reporting     = error_reporting = E_ALL

php_sapi_name()         = cli
phpversion()            = 5.3.0alpha3-dev
php_ini_loaded_file()   = C:\PHP\PHP5\INI\php-cli.ini
php_ini_scanned_files() =
error_reporting()       = 22519
INI error_reporting     = error_reporting = E_ALL & ~E_NOTICE

php_sapi_name()         = cli
phpversion()            = 5.3.0alpha3-dev
php_ini_loaded_file()   = C:\PHP\PHP5\INI\php-cli.ini
php_ini_scanned_files() =
error_reporting()       = 22519
INI error_reporting     = error_reporting = 
E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR


Just to confirm that last one ...

If I use V5.2.6 like so ...

C:\>c:\PHP5.2.6\php.exe -c C:\php\PHP5\INI\php-cli.ini 
z:\phpdetails.php

The output is ...

php_sapi_name()         = cli
phpversion()            = 5.2.6
php_ini_loaded_file()   = C:\PHP\PHP5\INI\php-cli.ini
php_ini_scanned_files() =
error_reporting()       = 4177
INI error_reporting     = error_reporting = 
E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
 [2008-10-17 13:25 UTC] RQuadling at GMail dot com
Oh and supplying the INI file via the command line on the 5.3 alpha 
makes no difference either ...

C:\>c:\PHP5\php.exe -c C:\php\PHP5\INI\php-cli.ini z:\phpdetails.php
php_sapi_name()         = cli
phpversion()            = 5.3.0alpha3-dev
php_ini_loaded_file()   = C:\PHP\PHP5\INI\php-cli.ini
php_ini_scanned_files() =
error_reporting()       = 22519
INI error_reporting     = error_reporting = 
E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
 [2008-10-21 09:29 UTC] jani@php.net
Can you reproduce this with some real OS, line Linux?
 [2008-10-21 19:09 UTC] RQuadling at GMail dot com
"real"? <raspberry>

But no. I'm all windows here.
 [2008-10-22 11:25 UTC] jani@php.net
So it's most likely Windows only issue. (can't reproduce here..)
 [2008-10-23 13:24 UTC] RQuadling at GMail dot com
Wouldn't surprise me.
 [2008-11-03 16:46 UTC] RQuadling at GMail dot com
It seems as if the entire INI file is ignored. I was playing with 
activating some more modules and there is no change to php -m output 
for the 5.3 alphas.

Same INI file for 5.2.6 and all is well.
 [2008-12-12 20:12 UTC] RQuadling at GMail dot com
Still having problems with this on Windows XP Pro SP3 and Windows 
Server 2005/2008.

php-5.3-win32-VC6-x86-latest >php -v
PHP 5.3.0alpha4-dev (cli) (built: Dec 12 2008 15:05:22)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies

php-5.3-win32-VC6-x86-latest >php --ini
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         C:\PHP\PHP5\INI\php-cli.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

php-5.3-win32-VC6-x86-latest >type
C:\php\php5\ini\php-cli.ini | find "error_reporting"
error_reporting                 = E_ALL | E_STRICT

php-5.3-win32-VC6-x86-latest >php -i | find
"error_reporting"
error_reporting => no value => no value


Same results for ...

PHP 5.3.0alpha3 (cli) (built: Dec  4 2008 20:40:51)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies


I even created a separate INI file ...

[PHP]
error_reporting = E_ALL | E_STRICT

and then ...

php-5.3.0alpha3-Win32-VC6-x86 >php -c
C:\php\php5\INI\error_reporting.ini -i | find "error_reporting"
Loaded Configuration File => C:\PHP\PHP5\INI\error_reporting.ini
error_reporting => no value => no value


I'm aware that Pierre is working around this area along with [PATH=] 
and [HOST=].

Posting this comment as another test case.
 [2008-12-19 10:45 UTC] pajoye@php.net
Using php.ini:
error_reporting = E_ALL

5.3.0-latest VC6:

C:\Users\pierre\Documents\test\php53vc6>php.exe -c php.ini  -i | find "error_reporting"
error_reporting => 30719 => 30719

5.3.0-latest NTS VC9:
C:\Users\pierre\Documents\test\php53a2ntsvc9>php.exe -c php.ini  -i | find "error_reporting"
error_reporting => 30719 => 30719

Tested on xp, vista, 2k3 and 2k8 (x86 and x64). It works as well inside apache2 sapi or fcgi (iis7).

Not sure what's wrong on your system. Do you have a clean system (without registry changes, no ini every where, etc.) to test again?
 [2008-12-19 11:15 UTC] RQuadling at GMail dot com
Oh bugger.

Went to a brand new out of the box system. Copied the latest PHP 
5.3.0alpha4-dev (cli) (built: Dec 19 2008 10:05:54).

Copied my error_reporting.ini file ...

error_reporting=E_ALL

Ran php -c error_reporting.ini -i | find "error_reporting" and got no 
values.

Did a type error_reporting.ini and then I slumped.

My editor is saving the BOM.

Removed the BOM and voi bloody la.

For the life of me, I can't get the BOM to NOT be saved in all 
instances.

So, making this a Bogus report and a getting the wall ready for some 
head banging.

Sorry for the noise.

I'll shutup now.
 [2008-12-19 11:16 UTC] rquadling@php.net
Unicode BOM on the INI file makes the INI file unreadable by php.exe 
with regard to INI settings, though can be read using 
file_get_contents(), etc.
 [2008-12-19 11:17 UTC] rquadling@php.net
Ah. This must be a change in PHP5.3, as the BOM is present on the ini 
file and is working with no problems on PHP5.2

So, this isn't a bogus report.



 [2008-12-19 12:19 UTC] pajoye@php.net
New ini parser, not windows specific then, unassigned. 
 [2008-12-24 14:44 UTC] scottmac@php.net
Duplicate of #45991 and this has nothing to do with re2c, it happened when the lexer was re-written prior to that.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC