php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22844 text boolean ini options set with -d do not work (on/off)
Submitted: 2003-03-24 04:55 UTC Modified: 2003-03-24 17:35 UTC
From: gk at proliberty dot com Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 4.3.2-RC OS: linux RH 7.2
Private report: No CVE-ID:
 [2003-03-24 04:55 UTC] gk at proliberty dot com
In my php.ini file, I have:
display_errors=On
display_startup_errors=On

In Bug #22796, I noted that display_startup_errors=On is required for proper error display using -r option; however this is a separate problem: errors not displayed if display_startup_error or display_errors is set to ANY value, with ini_set() or on the command line

I demonstrate below with -d switch:

[greg@p3 junk]$ php -d display_startup_errors=On -r "f();"
[greg@p3 junk]$ php -d display_startup_errors=Off -r "f();"
[greg@p3 junk]$ php  -r "f();"

Fatal error: Call to undefined function:  f() in Command line code on line 1
[greg@p3 junk]$ php -d display_errors=Off -r "f();"
[greg@p3 junk]$ php -d display_errors=On -r "f();"

The same problem occurs if call ini_set() instead of using -d option:

#FILE: junk.php
<?php 
ini_set("display_errors","On");
ini_set("display_startup_errors","On");
f();
?>

Now, if you use boolean value instead of On/Off, it appears that if EITHER variable is set to 1, errors work but if EITHER is set to 0, they don't:

[greg@p3 junk]$ php -d display_errors=0 -r "f();"
[greg@p3 junk]$ php -d display_errors=1 -r "f();"

Fatal error: Call to undefined function:  f() in Command line code on line 1
[greg@p3 junk]$ php -d display_errors=On -r "f();"
[greg@p3 junk]$ php -d display_startup_errors=1 -r "f();"

Fatal error: Call to undefined function:  f() in Command line code on line 1
[greg@p3 junk]$ php -d display_startup_errors=0 -r "f();"
[greg@p3 junk]$ 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-24 05:05 UTC] sniper@php.net
This is actually real bug:

# php -d display_errors=1 -r "f();"  <-- this works
# php -d display_errors=On -r "f();"  <-- this is same as setting it to 0




 [2003-03-24 07:58 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2003-03-24 07:58 UTC] iliaa@php.net
Forgot to close ;)
 [2003-03-24 13:52 UTC] gk at proliberty dot com
This problem, as I originally posted, is more general what sniper is focusing on: it is not limited to -d option; problem is reproducible with ini_set().

Perhaps we should change the title again to: "On/Off" ini options do not work for display_error or display_startup_errors? I'm not sure if the issue applies to other options than these.

sniper, have you verified the same behavior I saw with ini_set()?
 [2003-03-24 17:08 UTC] gk at proliberty dot com
This problem appears fixed only half way.
This code example is a little bit subtle because there are two startup errors generated: one to STDOUT and one to STDERR. 

In the case of the STDERR message, the problem is fixed.

But in the case of the STDOUT message, it is not: 
THIS WORKS: -d display_startup_errors=1 
THIS DOESN'T: -d display_startup_errors=On 

[root@p3 php4-STABLE-200303241830]# sapi/cli/php -d log_errors=1 -d
error_log=/dev/stderr -d display_startup_errors=On -r 'f();'
[24-Mar-2003 14:34:21] PHP Fatal error:  Call to undefined function: 
f() in Command line code on line 1
[root@p3 php4-STABLE-200303241830]# sapi/cli/php -d log_errors=1 -d
error_log=/dev/stderr -d display_startup_errors=On -r 'f();'
2>/dev/null
[root@p3 php4-STABLE-200303241830]# sapi/cli/php -d log_errors=1 -d
error_log=/dev/stderr -d display_startup_errors=1 -r 'f();'
2>/dev/null

Fatal error: Call to undefined function:  f() in Command line code on
line 1
[root@p3 php4-STABLE-200303241830]#
 [2003-03-24 17:35 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

 sapi/cli/php -d log_errors=1 -d error_log=/dev/stderr -d display_startup_errors=On -r 'f();' 2>/dev/null

Fatal error: Call to undefined function:  f() in Command line code on line 1

is what I get with latest CVS meaning that the problem is indeed fixed.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 10:02:09 2014 UTC