#48592 [NEW]: Missing environment variables in CGI SAPI crashes on startup
From: gwy...@php.net Operating system: Darwin9 (MacOS X 10.5) PHP version: 5.3CVS-2009-06-18 (CVS) PHP Bug Type: Reproducible crash Bug description: Missing environment variables in CGI SAPI crashes on startup Description: If certain environment variables are missing, with others present, when the CGI SAPI is called, it will crash early on with a NULL pointer dereference. Reproduce code: --- bash$ SERVER_NAME=anything SERVER_PORT=80 REDIRECT_STATUS=200 php-cgi Expected result: Actual result: -- Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x 0x90be0f30 in strlen () (gdb) bt #0 0x90be0f30 in strlen () #1 0x00323dd3 in php_fopen_primary_script (file_handle=0xbfffea6c, tsrm_ls=0xf01a80) at cvs/php-5.3/main/fopen_wrappers.c:454 #2 0x0049bcb2 in main (argc=1, argv=0xbfffeb58) at cvs/php-5.3/sapi/cgi/cgi_main.c:1999 -- Edit bug report at http://bugs.php.net/?id=48592&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48592&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48592&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48592&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48592&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48592&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48592&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48592&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48592&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48592&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48592&r=support Expected behavior: http://bugs.php.net/fix.php?id=48592&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48592&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48592&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48592&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48592&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=48592&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48592&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48592&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48592&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48592&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48592&r=mysqlcfg
#48633 [NEW]: str_pad() with giant lenth value and no memory limit infinite-loops or crashes
From: gwy...@php.net Operating system: Darwin9 (MacOS X 10.5) PHP version: 5.3CVS-2009-06-22 (CVS) PHP Bug Type: Reproducible crash Bug description: str_pad() with giant lenth value and no memory limit infinite-loops or crashes Description: Calling str_pad($anything, PHP_INT_MAX) causes one of four symptoms: 1) If memory_limit is set below 2GB, a fatal error is thrown saying the memory limit is exhausted with an attempt to allocate 2GB. This appears to be the expected result. 2) If memory_limit is set above 2GB, or is unset, PHP (in or out of GDB) enters a massive CPU-eating swap-file-smashing loop. 3) If PHP is being run under valgrind, PHP exits quickly with a memory allocation failure because valgrind's malloc() replacement refuses the "nonsense" allocation request. 4) If PHP is being run under valgrind *and* run-tests.php, PHP crashes with a NULL pointer reference. This is caused by two problems in the str_pad code: 1) The value of num_pad_chars is not bounds-checked in ext/standard/string.c:4830 2) The return value of emalloc() is not checked for NULL on the same line. Reproduce code: --- 1) $ sapi/cli/php ext/standard/tests/string/str_pad_variation5.phpt 2) $ sapi/cli/php -dmemory_limit=1 ext/standard/tests/string/str_pad_variation5.phpt 3) $ valgrind sapi/cli/php -dmemory_limit=1 ext/standard/tests/string/str_pad_variation5.phpt 4) $ PHP_TEST_EXECUTABLE=`pwd`/sapi/cli/php sapi/cli/php run-tests.php -m ext/standard/tests/string/str_pad_variation5.phpt Expected result: In all cases, str_pad() should recognize that its argument is ridiculous and return without trying to make the allocation. Actual result: -- 1) *** Testing str_pad() function: with large value for for 'pad_length' argument *** Fatal error: Allowed memory size of 134217728 bytes exhausted at ext/standard/string.c:4830 (tried to allocate 2147483648 bytes) in ext/standard/tests/strings/str_pad_variation5.phpt on line 25 2) PHP starts running at 100% CPU and eating huge amounts of swap space. 3) *** Testing str_pad() function: with large value for for 'pad_length' argument *** ==31081== Warning: silly arg (-2147221504) to malloc() Fatal error: Out of memory (allocated 524288) at ext/standard/string.c:4830 (tried to allocate 2147483648 bytes) in ext/standard/tests/strings/str_pad_variation5.phpt on line 25 4) ==31145== Warning: silly arg (-2147483648) to malloc() ==31145== Invalid write of size 1 ==31145==at 0x823B13: memcpy (mc_replace_strmem.c:482) ==31145==by 0x2B3F92: zif_str_pad (string.c:4855) ==31145==by 0x3E2D98: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:313) ==31145==by 0x3E9151: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1601) ==31145==by 0x3E1B59: execute (zend_vm_execute.h:104) ==31145==by 0x3AE947: zend_execute_scripts (zend.c:1188) ==31145==by 0x31E6CC: php_execute_script (main.c:2196) ==31145==by 0x499E5F: main (php_cli.c:1188) ==31145== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==31145== ==31145== Process terminating with default action of signal 10 (SIGBUS) ==31145== Non-existent physical address at address 0x0 ==31145==at 0x823B13: memcpy (mc_replace_strmem.c:482) ==31145==by 0x2B3F92: zif_str_pad (string.c:4855) ==31145==by 0x3E2D98: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:313) ==31145==by 0x3E9151: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1601) ==31145==by 0x3E1B59: execute (zend_vm_execute.h:104) ==31145==by 0x3AE947: zend_execute_scripts (zend.c:1188) ==31145==by 0x31E6CC: php_execute_script (main.c:2196) ==31145==by 0x499E5F: main (php_cli.c:1188) -- Edit bug report at http://bugs.php.net/?id=48633&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48633&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48633&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48633&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48633&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48633&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48633&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48633&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48633&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48633&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48633&r=support Expected behavior: http://bugs.php.net/fix.php?id=48633&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48633&r=notenoughinfo Submitted twice: http://bugs.php.n
#48634 [NEW]: Calling ob_get_flush() inside an output handler causes crashes
From: gwy...@php.net Operating system: Darwin9 (MacOS X 10.5) PHP version: 5.3CVS-2009-06-22 (CVS) PHP Bug Type: Reproducible crash Bug description: Calling ob_get_flush() inside an output handler causes crashes Description: The subject kind of says most of it. Under both GDB and Valgrind, PHP enters a massive recursion until it finally crashes by overrunning the stack, which is expected, according to a comment in a test that a fix needs to be backported from HEAD. So this bug is mostly about "please backport this fix", I suppose. Reproduce code: --- See tests/output/ob_11.phpt Expected result: A fatal error saying "you can't do that". Actual result: -- Endless recursion. -- Edit bug report at http://bugs.php.net/?id=48634&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48634&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48634&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48634&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48634&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48634&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48634&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48634&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48634&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48634&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48634&r=support Expected behavior: http://bugs.php.net/fix.php?id=48634&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48634&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48634&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48634&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48634&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=48634&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48634&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48634&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48634&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48634&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48634&r=mysqlcfg
#48795 [NEW]: Building intl 64-bit fails on OS X
From: gwy...@php.net Operating system: Darwin9 (MacOS X 10.5) PHP version: 5.3CVS-2009-07-04 (CVS) PHP Bug Type: *Compile Issues Bug description: Building intl 64-bit fails on OS X Description: This is a reference to PECL bug #16575 <http://pecl.php.net/bugs/bug.php?id=16575>. Since intl will shortly be part of core instead of PECL, I feel this bug belongs here. Here's my addition to the issue: This is due to intl/msgformat/msgformat_helpers.cpp being a C++ file and GCC not handling that case cleanly. The exact error is specifically due to GCC not linking to libstdc++. Which is, actually, kinda reasonable since it's been invoked as a plain C compiler. Anyway, you can get around the problem for now by adding "/usr/lib/gcc/i686-apple-darwin9/4.2.1/libstdc++.dylib" (if you're building with gcc-4.2) or "/usr/lib/gcc/i686-apple-darwin9/4.0.1/libstdc++.dylib" (if you're building with gcc-4.0, the default) to your LDFLAGS. That's right, WITHOUT -l or -L. I wouldn't consider this a real solution, but a better solution is pending further research into the subject. Reproduce code: --- $ CFLAGS='-arch x86_64' CXXFLAGS='-arch x86_64' LDFLAGS='-arch x86_64' ./configure --enable-intl --with-icu=/path/to/icu $ make Expected result: Build complete. Don't forget to run 'make test'. $ Actual result: -- Undefined symbols: "___gxx_personality_v0", referenced from: EH_frame1 in msgformat_helpers.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [sapi/cgi/php-cgi] Error 1 $ -- Edit bug report at http://bugs.php.net/?id=48795&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48795&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48795&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48795&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48795&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48795&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48795&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48795&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48795&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48795&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48795&r=support Expected behavior: http://bugs.php.net/fix.php?id=48795&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48795&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48795&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48795&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48795&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=48795&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48795&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48795&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48795&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48795&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48795&r=mysqlcfg
#49194 [NEW]: var_dump() doesn't completely protect against infinite looping
From: gwy...@php.net Operating system: * PHP version: 5.3SVN-2009-08-07 (SVN) PHP Bug Type: Variables related Bug description: var_dump() doesn't completely protect against infinite looping Description: Calling var_dump() on a closure that references itself results in an infinite loop. Reproduce code: --- Expected result: object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> &object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=>RECURSION } } } } Actual result: -- object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> &object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> &object(Closure)#1 (1) { ["static"]=> array(1) { ["f"]=> -- Edit bug report at http://bugs.php.net/?id=49194&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49194&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49194&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49194&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49194&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49194&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49194&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49194&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49194&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49194&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49194&r=support Expected behavior: http://bugs.php.net/fix.php?id=49194&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49194&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49194&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49194&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49194&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49194&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49194&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49194&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49194&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49194&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49194&r=mysqlcfg
[PHP-BUG] Req #54734 [NEW]: unpack() forces use of associative arrays
From: Operating system: * PHP version: 5.3.6 Package: Strings related Bug Type: Feature/Change Request Bug description:unpack() forces use of associative arrays Description: The unpack() function returns only associative arrays. In some situations it's advantageous to work with an indexed array instead. For example, this code, parsing a fictional network packet format: $packet = "\x01\x05\x05\x01\x05\x05\x01"; $values = unpack("Cpadding/nvalue1/Cpadding/nvalue2/Cpadding", $packet); might be more clear when written this way: list(, $value1, , $value2, ) = unpack("CnCnC", $packet); Implementing a fully compatible workaround in userland is at least mildly annoying (as well as slow), and it's pretty simple to add to the engine. -- Edit bug report at http://bugs.php.net/bug.php?id=54734&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54734&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54734&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54734&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54734&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54734&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54734&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54734&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54734&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54734&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54734&r=support Expected behavior: http://bugs.php.net/fix.php?id=54734&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54734&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54734&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54734&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54734&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=54734&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54734&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54734&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54734&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54734&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54734&r=mysqlcfg
Req #53946 [PATCH]: add json_encode option for not escaping unnecessary character
Edit report at https://bugs.php.net/bug.php?id=53946&edit=1 ID: 53946 Patch added by: gwy...@php.net Reported by:christian dot pernot at pingroom dot net Summary:add json_encode option for not escaping unnecessary character Status: Assigned Type: Feature/Change Request Package:JSON related PHP Version:5.3.5 Assigned To:scottmac Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: json_unescaped_unicode Revision: 1314622649 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_unescaped_unicode&revision=1314622649 Previous Comments: [2011-08-29 09:01:27] ir...@php.net The following patch has been added/updated: Patch Name: json_encode_doc.patch Revision: 1314608487 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_encode_doc.patch&revision=1314608487 [2011-08-29 08:59:43] ir...@php.net The following patch has been added/updated: Patch Name: json_encode_doc.patch Revision: 1314608383 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_encode_doc.patch&revision=1314608383 [2011-07-25 02:18:09] ir...@php.net The following patch has been added/updated: Patch Name: bug53946.phpt Revision: 1311574689 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=bug53946.phpt&revision=1311574689 [2011-07-19 12:18:06] ir...@php.net Fragment from rfc4627 ( http://www.ietf.org/rfc/rfc4627.txt ) "All Unicode characters may be placed within the quotation marks EXCEPT for the characters that MUST BE escaped: quotation mark, reverse solidus, and the control characters (U+ through U+001F). Any character MAY BE escaped." [2011-07-19 12:14:14] ir...@php.net The given option is especially necessary, when json is used in ajax responses. The size of a line decreases approximately twice. I have added a patch which the minimum changes in a code adds support given parameter. This parameter doesn't demand UTF8 to UTF16 encoding. But encoding validate utf8 line, therefore I hadn't touch it for BC. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=53946 -- Edit this bug report at https://bugs.php.net/bug.php?id=53946&edit=1
Req #53946 [PATCH]: add json_encode option for not escaping unnecessary character
Edit report at https://bugs.php.net/bug.php?id=53946&edit=1 ID: 53946 Patch added by: gwy...@php.net Reported by:christian dot pernot at pingroom dot net Summary:add json_encode option for not escaping unnecessary character Status: Assigned Type: Feature/Change Request Package:JSON related PHP Version:5.3.5 Assigned To:scottmac Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: json_unescaped_unicode Revision: 1314626654 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_unescaped_unicode&revision=1314626654 Previous Comments: [2011-08-29 12:57:29] gwy...@php.net The following patch has been added/updated: Patch Name: json_unescaped_unicode Revision: 1314622649 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_unescaped_unicode&revision=1314622649 [2011-08-29 09:01:27] ir...@php.net The following patch has been added/updated: Patch Name: json_encode_doc.patch Revision: 1314608487 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_encode_doc.patch&revision=1314608487 [2011-08-29 08:59:43] ir...@php.net The following patch has been added/updated: Patch Name: json_encode_doc.patch Revision: 1314608383 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_encode_doc.patch&revision=1314608383 [2011-07-25 02:18:09] ir...@php.net The following patch has been added/updated: Patch Name: bug53946.phpt Revision: 1311574689 URL: https://bugs.php.net/patch-display.php?bug=53946&patch=bug53946.phpt&revision=1311574689 [2011-07-19 12:18:06] ir...@php.net Fragment from rfc4627 ( http://www.ietf.org/rfc/rfc4627.txt ) "All Unicode characters may be placed within the quotation marks EXCEPT for the characters that MUST BE escaped: quotation mark, reverse solidus, and the control characters (U+ through U+001F). Any character MAY BE escaped." The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=53946 -- Edit this bug report at https://bugs.php.net/bug.php?id=53946&edit=1