php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61650 ini parser crashes when using ${xxxx} ini variables ( without apache2 )
Submitted: 2012-04-06 13:02 UTC Modified: 2012-04-06 13:49 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: e dot tirado at meetic-corp dot com Assigned: laruence
Status: Closed Package: CGI/CLI related
PHP Version: 5.3.10 OS: Redhat 5.8
Private report: No CVE-ID:
 [2012-04-06 13:02 UTC] e dot tirado at meetic-corp dot com
Description:
------------
Hello,

PHP-CGI keeps crashing when loading configuration file with variable in <php.ini> file. Variable are declared as ENV ones.

It doesn't crash if the variable is undefined.

I Think this bug is related to this one already corrected but only for apache2 thing :  https://bugs.php.net/bug.php?id=49677
sapi_getenv (NO apache2) versus php_apache_sapi_getenv (apache2)

Test script:
---------------
Into php.ini file :

error_log = ${titi}


Expected result:
----------------
PHP should not crash.

Actual result:
--------------
(gdb) backtrace
#0  0x0000000000000000 in ?? ()
#1  0x000000000063ed5a in sapi_getenv (name=0x14fcff10 "toto", name_len=<value optimized out>) at /usr/src/debug/php-5.3.10/main/SAPI.c:947
#2  0x0000000000664224 in zend_ini_get_var () at /usr/src/debug/php-5.3.10/Zend/zend_ini_parser.c:225
#3  ini_parse () at /usr/src/debug/php-5.3.10/Zend/zend_ini_parser.c:1840
#4  0x000000000066431e in zend_parse_ini_file (fh=0x7fff6b56ab40, unbuffered_errors=1 '\001', scanner_mode=<value optimized out>, ini_parser_cb=<value optimized out>, 
    arg=<value optimized out>) at /usr/src/debug/php-5.3.10/Zend/zend_ini_parser.c:283
#5  0x000000000063dbe3 in php_init_config () at /usr/src/debug/php-5.3.10/main/php_ini.c:620
#6  0x00000000006371ca in php_module_startup (sf=<value optimized out>, additional_modules=0xc2ef80, num_additional_modules=1) at /usr/src/debug/php-5.3.10/main/main.c:2012
#7  0x000000000070a633 in php_cgi_startup (sapi_module=0x4) at /usr/src/debug/php-5.3.10/sapi/cgi/cgi_main.c:883
#8  0x000000000070ada8 in main (argc=3, argv=0x7fff6b56d3d8) at /usr/src/debug/php-5.3.10/sapi/cgi/cgi_main.c:1623


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-06 13:37 UTC] nikic@php.net
I can't reproduce this:

nikic@pluto:~/dev$ cat php.ini
error_log = ${ERROR_LOG}
nikic@pluto:~/dev$ ERROR_LOG=foo php -c php.ini -i | grep error_log
error_log => foo => foo
 [2012-04-06 13:43 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9bf8cd4b3437f6335e20843c9e3668b44761feba
Log: Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables (without apache2))
 [2012-04-06 13:49 UTC] laruence@php.net
This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

actually, you should use a existed env variable name to trigger this bug.

fixed
 [2012-04-06 13:49 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2012-04-06 13:59 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9bf8cd4b3437f6335e20843c9e3668b44761feba
Log: Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables (without apache2))
 [2012-04-06 14:00 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9bf8cd4b3437f6335e20843c9e3668b44761feba
Log: Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables (without apache2))
 [2012-04-12 09:38 UTC] johannes@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8ccf0655776c512f1e1c341e115e07d0e8ba6091
Log: Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables (without apache2))
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 18:01:55 2014 UTC