#50111 [NEW]: memory leak when stream_context_create is used
From: datib...@php.net Operating system: Linux PHP version: 5.2.11 PHP Bug Type: Streams related Bug description: memory leak when stream_context_create is used Description: When stream_context_create() is used in conjunction with file_get_contents() or other stream related functions that accept a context parameter, memory is being leaked. Reproduce code: --- for ($i=0;$i<5;++$i){ $m0 = memory_get_usage(); file_get_contents('http://www.google.com', false, stream_context_create(array())); $m1 = memory_get_usage(); echo $m1-$m0,PHP_EOL; } Expected result: X (where X is the memory increase for the first iterator) 0 0 0 0 Actual result: -- X (where X is the memory increase for the first iterator) 384 (or something similar) 420 420 480 -- Edit bug report at http://bugs.php.net/?id=50111&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50111&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50111&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50111&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50111&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50111&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50111&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50111&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50111&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50111&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50111&r=support Expected behavior: http://bugs.php.net/fix.php?id=50111&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50111&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50111&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50111&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50111&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=50111&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50111&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50111&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50111&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50111&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50111&r=mysqlcfg
#50112 [NEW]: compile error with Non-Engish Operating system
From: ben dot yan at msn dot com Operating system: Windows PHP version: 5.3.0 PHP Bug Type: Compile Failure Bug description: compile error with Non-Engish Operating system Description: ext\standard\browscap.c : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss ext\standard\browscap.c(61) : error C2001: newline in constant ext\standard\browscap.c(62) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(62) : error C2146: syntax error : missing ';' before identifier 't' ext\standard\browscap.c(89) : error C2001: newline in constant ext\standard\browscap.c(90) : error C2146: syntax error : missing ':' before identifier 't' ext\standard\browscap.c(91) : error C2001: newline in constant ext\standard\browscap.c(92) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(92) : error C2143: syntax error : missing ';' before 'break' ext\standard\browscap.c(100) : error C2001: newline in constant ext\standard\browscap.c(102) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(102) : error C2146: syntax error : missing ';' before identifier 't' NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\cl.exe"' : return code '0x2' Stop. Reproduce code: --- setting: [Control Panel]->[Regional and Language Options]->[Advanced]->[Language for non-Unicode programs] if ($select == "English (United States)") { // compile successfully. :) } else if ($select == "Chinese (PRC)"){ // compile error! :( } OS: Windows XP Home IDE: VC++ 2008 Express + SDK v6.1 PHP: 5.3.0 Expected result: compile successfully Actual result: -- compile error -- Edit bug report at http://bugs.php.net/?id=50112&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50112&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50112&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50112&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50112&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50112&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50112&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50112&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50112&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50112&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50112&r=support Expected behavior: http://bugs.php.net/fix.php?id=50112&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50112&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50112&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50112&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50112&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=50112&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50112&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50112&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50112&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50112&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50112&r=mysqlcfg
#50112 [Opn->Asn]: compile error with Non-Engish Operating system
ID: 50112 Updated by: paj...@php.net Reported By: ben dot yan at msn dot com -Status: Open +Status: Assigned Bug Type: Compile Failure Operating System: Windows PHP Version: 5.3.0 -Assigned To: +Assigned To: pajoye New Comment: I can't test what's wrong but I don't see either why this language setting could affect anything. I have to setup a VM with Chinese to reproduce this problem (works just fine with Russian, German, French or Spanish). Previous Comments: [2009-11-07 10:48:58] ben dot yan at msn dot com Description: ext\standard\browscap.c : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss ext\standard\browscap.c(61) : error C2001: newline in constant ext\standard\browscap.c(62) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(62) : error C2146: syntax error : missing ';' before identifier 't' ext\standard\browscap.c(89) : error C2001: newline in constant ext\standard\browscap.c(90) : error C2146: syntax error : missing ':' before identifier 't' ext\standard\browscap.c(91) : error C2001: newline in constant ext\standard\browscap.c(92) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(92) : error C2143: syntax error : missing ';' before 'break' ext\standard\browscap.c(100) : error C2001: newline in constant ext\standard\browscap.c(102) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(102) : error C2146: syntax error : missing ';' before identifier 't' NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\cl.exe"' : return code '0x2' Stop. Reproduce code: --- setting: [Control Panel]->[Regional and Language Options]->[Advanced]->[Language for non-Unicode programs] if ($select == "English (United States)") { // compile successfully. :) } else if ($select == "Chinese (PRC)"){ // compile error! :( } OS: Windows XP Home IDE: VC++ 2008 Express + SDK v6.1 PHP: 5.3.0 Expected result: compile successfully Actual result: -- compile error -- Edit this bug report at http://bugs.php.net/?id=50112&edit=1
#50112 [Asn]: compile error with Non-Engish Operating system
ID: 50112 User updated by: ben dot yan at msn dot com Reported By: ben dot yan at msn dot com Status: Assigned Bug Type: Compile Failure Operating System: Windows PHP Version: 5.3.0 Assigned To: pajoye New Comment: First Sorry for the bug title. The VC++ and OS are English edition. But the "Regional and Language Options" are as follows: [Standards and formats]: Chinese (PRC) [Location]: China [Language for non-Unicode programs]: Chinese (PRC) Previous Comments: [2009-11-07 12:22:39] paj...@php.net I can't test what's wrong but I don't see either why this language setting could affect anything. I have to setup a VM with Chinese to reproduce this problem (works just fine with Russian, German, French or Spanish). [2009-11-07 10:48:58] ben dot yan at msn dot com Description: ext\standard\browscap.c : warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss ext\standard\browscap.c(61) : error C2001: newline in constant ext\standard\browscap.c(62) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(62) : error C2146: syntax error : missing ';' before identifier 't' ext\standard\browscap.c(89) : error C2001: newline in constant ext\standard\browscap.c(90) : error C2146: syntax error : missing ':' before identifier 't' ext\standard\browscap.c(91) : error C2001: newline in constant ext\standard\browscap.c(92) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(92) : error C2143: syntax error : missing ';' before 'break' ext\standard\browscap.c(100) : error C2001: newline in constant ext\standard\browscap.c(102) : warning C4305: '=' : truncation from 'int' to 'char' ext\standard\browscap.c(102) : error C2146: syntax error : missing ';' before identifier 't' NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\cl.exe"' : return code '0x2' Stop. Reproduce code: --- setting: [Control Panel]->[Regional and Language Options]->[Advanced]->[Language for non-Unicode programs] if ($select == "English (United States)") { // compile successfully. :) } else if ($select == "Chinese (PRC)"){ // compile error! :( } OS: Windows XP Home IDE: VC++ 2008 Express + SDK v6.1 PHP: 5.3.0 Expected result: compile successfully Actual result: -- compile error -- Edit this bug report at http://bugs.php.net/?id=50112&edit=1
#50113 [NEW]: No way to break long strings when declaring class constant
From: samuel dot hapak at gmail dot com Operating system: Debian PHP version: 5.2.11 PHP Bug Type: Feature/Change Request Bug description: No way to break long strings when declaring class constant Description: Consider following example: class Example { const LONG_SENTENCE = "This sentence is really very very very very very very very very very very very very very very very very very very very very very very very very long"; }; It is not possible to breakup the assigned string using dot operator, and php also doesn't support neither c-like constant string concatenation ("really " "very" -> "really very") or c-like line continuation (end the line with backslash). This is really annoying, cause I end with the code containing extra long lines and I can't split them, making code unreadable without scrolling. -- Edit bug report at http://bugs.php.net/?id=50113&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50113&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50113&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50113&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50113&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50113&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50113&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50113&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50113&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50113&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50113&r=support Expected behavior: http://bugs.php.net/fix.php?id=50113&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50113&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50113&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50113&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50113&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=50113&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50113&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50113&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50113&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50113&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50113&r=mysqlcfg
#50110 [Opn]: Static (File Scope) Variables
ID: 50110 User updated by: n8grndr1087 at optonline dot net Reported By: n8grndr1087 at optonline dot net Status: Open Bug Type: Feature/Change Request Operating System: Unix PHP Version: 5.2.11 New Comment: This feature would also be useful for static (file scope) functions as well. Previous Comments: [2009-11-07 05:07:19] n8grndr1087 at optonline dot net Description: Global variables should be able to be declared 'static'. Static globals, like in C, would only be accessible from the current file's scope. This would be a good way to protect internal variables used behind the scenes in a particular file. If there is any effective way to protect variables that I overlooked, outside of PHP classes, let me know. I understand that the possibility of this depends on how the include/file processing mechanism works. Reproduce code: --- myvar.inc: test.php: '; set_myvar(0); $myvar = 1; echo get_myvar(); ?> Expected result: 1 0 Actual result: -- 1 1 -- Edit this bug report at http://bugs.php.net/?id=50110&edit=1
#50102 [Bgs]: With CGI/FastCGI, auto_prepend_file and auto_append_file duplication.
ID: 50102 Updated by: ksin...@php.net Reported By: RQuadling at GMail dot com Status: Bogus Bug Type: CGI related Operating System: Windows XP SP3 PHP Version: 5.3SVN-2009-11-06 (snap) New Comment: I couldn't repro it with WinCache v1 RC. Looks like its already fixed. Previous Comments: [2009-11-06 15:51:31] rquadl...@php.net C:\PHP5\php-cgi -n -d extension_dir=C:\PHP5\ext -d include_path=".;C:\PHP5\PEAR;D:\PHP\Includes" -d auto_prepend_file=auto_loader.php -d auto_append_file=show_includes.php -d extension=php_wincache.dll vs C:\PHP5\php-cgi -n -d extension_dir=C:\PHP5\ext -d include_path=".;C:\PHP5\PEAR;D:\PHP\Includes" -d auto_prepend_file=auto_loader.php -d auto_append_file=show_includes.php -d shows the issue. But only with CGI/FastCGI. [2009-11-06 15:39:07] rquadl...@php.net Bug in wincache which only affects CGI SAPI. [2009-11-06 15:38:31] rquadl...@php.net Argh. Bug in Microsoft's Wincache. [2009-11-06 15:03:32] RQuadling at GMail dot com Description: Hi. I have a script D:\PHP\Includes\auto_loader.php My include_path=C:\PHP5\PEAR;D:\PHP\Includes;. My auto_prepend_file=auto_loader.php For this bug report, I've also set auto_append_file=show_includes.php At the CLI, all is well. Via CGI-FastCGI (I'm using IIS7, but I can replicate the issue via the commandline using php-cgi.exe), I get an extra entries. Using ... CD C:\ C:\PHP5\php.exe C:\PHP5\php-cgi.exe and pressing CTRL+Z (or F6) and then ENTER to leave PHP reveals the issue. Interestingly, if I use ... C:\PHP5\php-cgi -n -d auto_prepend_file=D:\PHP\Includes\auto_loader.php -d auto_append_file=D:\PHP\Includes\show_includes.php, then all is well. So it seems reading the ini file and processing the auto_append_file/auto_prepend_file entries causes the issue. Maybe. It looks that way. Reproduce code: --- auto_loader.php ---show_includes.php Expected result: Array ( [0] => C:\- [1] => D:\PHP\Includes\auto_loader.php [2] => D:\PHP\Includes\show_includes.php ) Array ( [0] => C:\- [1] => D:\PHP\Includes\auto_loader.php [2] => D:\PHP\Includes\show_includes.php ) Actual result: -- Array ( [0] => C:\- [1] => D:\PHP\Includes\auto_loader.php [2] => D:\PHP\Includes\show_includes.php ) X-Powered-By: PHP/5.3.2-dev Content-type: text/html; charset=UTF-8 Array ( [0] => C:\- [1] => C:\auto_loader.php [2] => D:\PHP\Includes\auto_loader.php [3] => C:\show_includes.php [4] => D:\PHP\Includes\show_includes.php ) -- Edit this bug report at http://bugs.php.net/?id=50102&edit=1
#50102 [Bgs]: With CGI/FastCGI, auto_prepend_file and auto_append_file duplication.
ID: 50102 Updated by: paj...@php.net Reported By: RQuadling at GMail dot com Status: Bogus Bug Type: CGI related Operating System: Windows XP SP3 PHP Version: 5.3SVN-2009-11-06 (snap) New Comment: PECL extensions bugs must be reported to pecl.php.net, not in bugs.php.net. Previous Comments: [2009-11-07 19:27:59] ksin...@php.net I couldn't repro it with WinCache v1 RC. Looks like its already fixed. [2009-11-06 15:51:31] rquadl...@php.net C:\PHP5\php-cgi -n -d extension_dir=C:\PHP5\ext -d include_path=".;C:\PHP5\PEAR;D:\PHP\Includes" -d auto_prepend_file=auto_loader.php -d auto_append_file=show_includes.php -d extension=php_wincache.dll vs C:\PHP5\php-cgi -n -d extension_dir=C:\PHP5\ext -d include_path=".;C:\PHP5\PEAR;D:\PHP\Includes" -d auto_prepend_file=auto_loader.php -d auto_append_file=show_includes.php -d shows the issue. But only with CGI/FastCGI. [2009-11-06 15:39:07] rquadl...@php.net Bug in wincache which only affects CGI SAPI. [2009-11-06 15:38:31] rquadl...@php.net Argh. Bug in Microsoft's Wincache. [2009-11-06 15:03:32] RQuadling at GMail dot com Description: Hi. I have a script D:\PHP\Includes\auto_loader.php My include_path=C:\PHP5\PEAR;D:\PHP\Includes;. My auto_prepend_file=auto_loader.php For this bug report, I've also set auto_append_file=show_includes.php At the CLI, all is well. Via CGI-FastCGI (I'm using IIS7, but I can replicate the issue via the commandline using php-cgi.exe), I get an extra entries. Using ... CD C:\ C:\PHP5\php.exe C:\PHP5\php-cgi.exe and pressing CTRL+Z (or F6) and then ENTER to leave PHP reveals the issue. Interestingly, if I use ... C:\PHP5\php-cgi -n -d auto_prepend_file=D:\PHP\Includes\auto_loader.php -d auto_append_file=D:\PHP\Includes\show_includes.php, then all is well. So it seems reading the ini file and processing the auto_append_file/auto_prepend_file entries causes the issue. Maybe. It looks that way. Reproduce code: --- auto_loader.php ---show_includes.php Expected result: Array ( [0] => C:\- [1] => D:\PHP\Includes\auto_loader.php [2] => D:\PHP\Includes\show_includes.php ) Array ( [0] => C:\- [1] => D:\PHP\Includes\auto_loader.php [2] => D:\PHP\Includes\show_includes.php ) Actual result: -- Array ( [0] => C:\- [1] => D:\PHP\Includes\auto_loader.php [2] => D:\PHP\Includes\show_includes.php ) X-Powered-By: PHP/5.3.2-dev Content-type: text/html; charset=UTF-8 Array ( [0] => C:\- [1] => C:\auto_loader.php [2] => D:\PHP\Includes\auto_loader.php [3] => C:\show_includes.php [4] => D:\PHP\Includes\show_includes.php ) -- Edit this bug report at http://bugs.php.net/?id=50102&edit=1
#50108 [Opn->Fbk]: PHP crashs while using list() function
ID: 50108 Updated by: fel...@php.net Reported By: fernando dot nemec at gmail dot com -Status: Open +Status: Feedback Bug Type: Reproducible crash Operating System: Fedora Core 5 PHP Version: 5.2.11 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. I can't reproduce it. Previous Comments: [2009-11-07 00:23:32] fernando dot nemec at gmail dot com Just fixing the summary. [2009-11-07 00:20:35] fernando dot nemec at gmail dot com Description: PHP crashs on incorrectly use of list() function. If list has more arguments than the input array has elements, then PHP crashs and prints the message "File size limit exceeded". Reproduce code: --- Expected result: "foobar" Actual result: -- File size limit exceeded -- Edit this bug report at http://bugs.php.net/?id=50108&edit=1
#50090 [Opn->Csd]: Typo in IteratorIterator constructor
ID: 50090 Updated by: fel...@php.net Reported By: wimartin at uk dot ibm dot com -Status: Open +Status: Closed Bug Type: SPL related Operating System: Windows XP PHP Version: 5.2SVN-2009-11-05 (snap) New Comment: 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/. Thank you for the report, and for helping us make PHP better. Thanks. Previous Comments: [2009-11-07 21:27:16] s...@php.net Automatic comment from SVN on behalf of felipe Revision: http://svn.php.net/viewvc/?view=revision&revision=290392 Log: - Fixed bug #50090 (Typo in IteratorIterator constructor) [2009-11-05 16:13:35] wimartin at uk dot ibm dot com Description: In case DIT_IteratorIterator under spl_dual_it_construct in iterators.c there is a typo in the following exception. zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "%s::getIterator() must return an object that implememnts Traversable", ce->name); "implememnts" should in fact be "implements". -- Edit this bug report at http://bugs.php.net/?id=50090&edit=1
#50098 [Opn->Fbk]: preg_replace cause Apache error and retart.
ID: 50098 Updated by: fel...@php.net Reported By: zhongxueming at gmail dot com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: Windows XP, Windows Server 2003 PHP Version: 5.2.11 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. Previous Comments: [2009-11-06 09:18:23] zhongxueming at gmail dot com Description: When I execute a sql by Zend DB, I got a connection error, and found an error in apache error log. After tracking, I found the problem is preg_replace function. I think you can replay this problem by the test code. Env: Windows XP, Windows Server 2003 Apache 2.2.13 PHP php-5.2.11 Reproduce code: --- function testPregReplace() { $sql = "SELECT \"t_skill_label\".\"c_name\" FROM \"t_skill_label\" WHERE (\"c_name\" = ' ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨ ¢¤¦¨') AND (\"c_id\" != '3') LIMIT 1"; echo preg_replace("/'(''|{2}|[^'])*'/", '', $sql); } testPregReplace(); Expected result: Apache not be restarted. Actual result: -- This test code will cause apache error. You can confirm it in the apache error log. The browser display a connection error. -- Edit this bug report at http://bugs.php.net/?id=50098&edit=1
#50003 [Opn]: Allow constructions like func()[0]
ID: 50003 User updated by: melfar at gmail dot com Reported By: melfar at gmail dot com Status: Open Bug Type: Feature/Change Request Operating System: agnostic PHP Version: 5.3.0 New Comment: Actually, scratch the previous patch since it only worked on functions . Here is the fixed version, and it also prevents someone from modifying the temporary return value, as in: car_brands()["toyota"]["corolla"] = 4; The patch is as follows: --- a/Zend/zend_language_parser.y.orig 2009-10-26 18:13:56.0 +0300 +++ b/Zend/zend_language_parser.y 2009-11-08 02:06:20.0 +0300 @@ -47,7 +47,7 @@ %} %pure_parser -%expect 2 +%expect 7 %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE %left ',' @@ -834,6 +834,11 @@ ; variable: +raw_variable { $$ = $1; } +| variable '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); $$.u.EA.type = ZEND_PARSED_FUNCTION_CALL; } +; + +raw_variable: base_variable_with_function_calls T_OBJECT_OPERATOR { zend_do_push_object(&$1 TSRMLS_CC); } object_property { zend_do_push_object(&$4 TSRMLS_CC); } method_or_not variable_properties { zend_do_pop_object(&$$ TSRMLS_CC); $$.u.EA.type = $1.u.EA.type | ($7.u.EA.type ? $7.u.EA.type : $6.u.EA.type); } Previous Comments: [2009-10-26 22:13:18] melfar at gmail dot com How about this? array("chevy" => 1, "hummer" => 2), "toyota" => array("prius" => 1, "corolla" => 2)); } var_dump(car_brands()["toyota"]["corolla"]); ?> New patch is as follows: --- a/Zend/zend_language_parser.y.orig 2009-10-26 18:13:56.0 +0300 +++ b/Zend/zend_language_parser.y 2009-10-27 01:02:08.0 +0300 @@ -47,7 +47,7 @@ %} %pure_parser -%expect 2 +%expect 6 %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE %left ',' @@ -874,6 +874,11 @@ variable_class_name: ; base_variable_with_function_calls: +raw_base_variable_with_function_calls { $$ = $1; } + | base_variable_with_function_calls '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } +; + +raw_base_variable_with_function_calls: base_variable { $$ = $1; } | function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.u.EA.type = ZEND_PARSED_FUNCTION_CALL; } ; [2009-10-26 20:58:42] johan...@php.net The idea was often discussed, but nobody found a fully satisfying solution, yet. Yours is limited to one array dimension. Will for instance not work but should be supported. I also think it's likely to cause memory problems in edge cases while I wasn't able to create one in my quick tests. Anyidea aobut the above problem? [2009-10-26 18:47:23] melfar at gmail dot com Not sure how to attach a file. The proposed patch is as follows. --- a/Zend/zend_language_parser.y.orig 2009-10-26 18:13:56.0 +0300 +++ b/Zend/zend_language_parser.y 2009-10-26 21:20:19.0 +0300 @@ -47,7 +47,7 @@ %} %pure_parser -%expect 2 +%expect 6 %left T_INCLUDE T_INCLUDE_ONCE T_EVAL T_REQUIRE T_REQUIRE_ONCE %left ',' @@ -874,6 +874,11 @@ variable_class_name: ; base_variable_with_function_calls: +raw_base_variable_with_function_calls { $$ = $1; } + | raw_base_variable_with_function_calls '[' dim_offset ']' { fetch_array_dim(&$$, &$1, &$3 TSRMLS_CC); } +; + +raw_base_variable_with_function_calls: base_variable { $$ = $1; } | function_call { zend_do_begin_variable_parse(TSRMLS_C); $$ = $1; $$.u.EA.type = ZEND_PARSED_FUNCTION_CALL; } ; [2009-10-26 18:45:24] melfar at gmail dot com Description: PHP parser doesn't allow for array index operation to be used on a result of a function call. I propose a patch to allow such a construction. Reproduce code: --- Expected result: "hummer" Actual result: -- Parse error: syntax error, unexpected '[' in test.php on line 5 -- Edit this bug report at http://bugs.php.net/?id=50003&edit=1
#50111 [Opn]: memory leak when stream_context_create is used
ID: 50111 Updated by: datib...@php.net Reported By: datib...@php.net Status: Open Bug Type: Streams related Operating System: Linux PHP Version: 5.2.11 New Comment: Code to reproduce can be made simpler, since the problem seems to be with stream_context_create(): $m0 = $m1 = $i = 0; $c = null; while ($i<5) { $m0 = memory_get_usage(); $c = stream_context_create(); $m1 = memory_get_usage(); echo $m1-$m0,PHP_EOL; ++$i; } Previous Comments: [2009-11-07 09:26:05] datib...@php.net Description: When stream_context_create() is used in conjunction with file_get_contents() or other stream related functions that accept a context parameter, memory is being leaked. Reproduce code: --- for ($i=0;$i<5;++$i){ $m0 = memory_get_usage(); file_get_contents('http://www.google.com', false, stream_context_create(array())); $m1 = memory_get_usage(); echo $m1-$m0,PHP_EOL; } Expected result: X (where X is the memory increase for the first iterator) 0 0 0 0 Actual result: -- X (where X is the memory increase for the first iterator) 384 (or something similar) 420 420 480 -- Edit this bug report at http://bugs.php.net/?id=50111&edit=1