[PHP-BUG] Bug #64555 [NEW]: foreach no longer copies keys if they seem to be interned
From: arpad Operating system: PHP version: 5.5.0beta1 Package: Scripting Engine problem Bug Type: Bug Bug description:foreach no longer copies keys if they seem to be interned Description: Foreach used to always copy string keys: key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 1, NULL); Since fcc6611de9054327441786e52444b5f8eecdd525 it instead uses: zend_hash_get_current_key_zval(fe_ht, key); This only copies string keys if IS_INTERNED(), however in some cases (at least in get_object_vars() like in the test script) the key name is an unmangled property name which is *within* an interned string. So IS_INTERNED is true but INTERNED_LEN and INTERNED_HASH are nonsense. The later unset and assignment in the test script use the nonsense INTERNED_HASH. The simple fix is to make get_object_vars() copy the property names (as in the attached patch) but it's quite possible that other code has been broken in the same way, so the safer fix might be to force the copy again. Test script: --- https://gist.github.com/arraypad/5280321 Expected result: Unsetting: unsetme Changing: keepme array(1) { ["keepme"]=> int(43) } array(1) { [0]=> string(6) "keepme" } Actual result: -- Unsetting: unsetme Changing: keepme array(3) { ["unsetme"]=> int(1) ["keepme"]=> int(43) ["keepme"]=> int(42) } array(3) { [0]=> string(7) "unsetme" [1]=> string(6) "keepme" [2]=> string(6) "keepme" } -- Edit bug report at https://bugs.php.net/bug.php?id=64555&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64555&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64555&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64555&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64555&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64555&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64555&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64555&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64555&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=64555&r=support Expected behavior: https://bugs.php.net/fix.php?id=64555&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64555&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64555&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64555&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64555&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64555&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64555&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=64555&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64555&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64555&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64555&r=mysqlcfg
Bug #64075 [Com]: when the session name is not PHPSESSID, upload progress informations are not pr
Edit report at https://bugs.php.net/bug.php?id=64075&edit=1 ID: 64075 Comment by: ar...@php.net Reported by:pmaes at nextoo dot fr Summary:when the session name is not PHPSESSID, upload progress informations are not pr Status: Open Type: Bug Package:Session related Operating System: OSX PHP Version:5.4.11 Block user comment: N Private report: N New Comment: Because uploads are processed before your script executes, session_name('foo') or ini_set('session.name', 'foo') won't affect them and PHP will use whatever's been defined in your php.ini etc. the default being PHPSESSID. Setting session.name in your php.ini or vhost config etc. works fine. Previous Comments: [2013-03-20 20:24:59] raz dot atoth at gmail dot com For what it's worth, i'm experiencing the same issue with v. 5.4.13 on Linux Mint. The session upload progress does not appear to work if function 'session_name' is used to set the name of the session cookie, [2013-01-25 17:04:12] pmaes at nextoo dot fr Description: I test upload progress for my app (under symfony 1.4), and it doesn't work. With PHP without any framework it works. I compared http request header and the only difference is the cookie. Into my symfony app, i setted session_name=PHPSESSID and the progress informations was into $_SESSION So, when the session name is not PHPSESSID, upload progress informations are not present. Test script: --- http://pastebin.com/FY02EfDA try with index.php?session_name=test result: it don't work remove the cookie after the test try with index.php or index.php?session_name=PHPSESSID result: it works -- Edit this bug report at https://bugs.php.net/bug.php?id=64075&edit=1
#50435 [NEW]: Fatal error thrown for removed ini directives isn't fatal
From: ar...@php.net Operating system: N/A PHP version: 6SVN-2009-12-10 (SVN) PHP Bug Type: Scripting Engine problem Bug description: Fatal error thrown for removed ini directives isn't fatal Description: The check for removed ini directives in php_module_startup (main/main.c) was changed to use E_ERROR instead of E_WARNING: http://svn.php.net/viewvc/php/php-src/trunk/main/main.c?r1=288037&r2=288038&; Since it is run before module_initialized is set to 1, php_error_cb skips the bailout. If it's supposed to be fatal then it should be E_CORE_ERROR, as README.UPDATING_TO_PHP6 says. Reproduce code: --- php -d register_globals=1 -r 'echo "hi\n";' Expected result: PHP Fatal error: Directive 'register_globals' no longer exist in PHP 6 and greater in Unknown on line 0 Actual result: -- PHP Fatal error: Directive 'register_globals' no longer exist in PHP 6 and greater in Unknown on line 0 hi -- Edit bug report at http://bugs.php.net/?id=50435&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50435&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50435&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50435&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50435&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50435&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50435&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50435&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50435&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50435&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50435&r=support Expected behavior: http://bugs.php.net/fix.php?id=50435&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50435&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50435&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50435&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50435&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=50435&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50435&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50435&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50435&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50435&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50435&r=mysqlcfg
[PHP-BUG] Req #55109 [NEW]: Friendly log messages
From: Operating system: N/A PHP version: trunk-SVN-2011-07-02 (SVN) Package: CGI/CLI related Bug Type: Feature/Change Request Bug description:Friendly log messages Description: - Compacts messages to one line, so a 404 doesn't occupy three lines. - Includes the response status code - Colours messages according to their response code (success=green, client error=yellow, server error=red) - Appends the error message when there's a fatal PHP error Test script: --- ... Expected result: http://spellign.com/patches/cli-after.png Actual result: -- http://spellign.com/patches/cli-before.png -- Edit bug report at https://bugs.php.net/bug.php?id=55109&edit=1 -- Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55109&r=trysnapshot52 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55109&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55109&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55109&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55109&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55109&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55109&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55109&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55109&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55109&r=support Expected behavior: https://bugs.php.net/fix.php?id=55109&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55109&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55109&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55109&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55109&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=55109&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55109&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55109&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55109&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55109&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55109&r=mysqlcfg Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55109&r=trysnapshot54
[PHP-BUG] Bug #55115 [NEW]: Large segment of memory still reachable with more than one request
From: Operating system: Ubuntu PHP version: 5.4SVN-2011-07-03 (SVN) Package: Built-in web server Bug Type: Bug Bug description:Large segment of memory still reachable with more than one request Description: When using the CLI server, more than one access results in a huge amount of still reachable memory. Test script: --- touch t.php valgrind --leak-check=full --show-reachable=yes php -S localhost:8080 [browser] /t.php [browser] /t.php Actual result: -- 55k lines of segments that are apparently still reachable -- Edit bug report at https://bugs.php.net/bug.php?id=55115&edit=1 -- Try a snapshot (PHP 5.2): https://bugs.php.net/fix.php?id=55115&r=trysnapshot52 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55115&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55115&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=55115&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55115&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=55115&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=55115&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=55115&r=needscript Try newer version: https://bugs.php.net/fix.php?id=55115&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=55115&r=support Expected behavior: https://bugs.php.net/fix.php?id=55115&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=55115&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=55115&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=55115&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55115&r=php4 Daylight Savings:https://bugs.php.net/fix.php?id=55115&r=dst IIS Stability: https://bugs.php.net/fix.php?id=55115&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=55115&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=55115&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=55115&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=55115&r=mysqlcfg Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55115&r=trysnapshot54
Req #55158 [PATCH]: Add SORT_NATURAL type to array_multisort
Edit report at https://bugs.php.net/bug.php?id=55158&edit=1 ID: 55158 Patch added by: ar...@php.net Reported by:joe dot lencioni+php at gmail dot com Summary:Add SORT_NATURAL type to array_multisort Status: Open Type: Feature/Change Request Package:Arrays related PHP Version:5.3.6 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: trunk-multisort-natural Revision: 1310486289 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=trunk-multisort-natural&revision=1310486289 Previous Comments: [2011-07-07 15:00:19] joe dot lencioni+php at gmail dot com Description: Arrays often need to be sorted using a "natural order" algorithm. There are currently functions in PHP for sorting single arrays this way (natsort, natcasesort), but nothing exists for a multisort. It would be great to see a SORT_NATURAL option in the array_multisort function. Test script: --- $a = array( 'Second', 'First', 'Twentieth', 'Tenth', 'Third', ); $b = array( '2 a', '1 b', '20 c', '10 d', '3 e', ); array_multisort($b, SORT_NATURAL, $a); var_dump($a, $b); Expected result: array 0 => string 'First' (length=5) 1 => string 'Second' (length=6) 2 => string 'Third' (length=5) 3 => string 'Tenth' (length=5) 4 => string 'Twentieth' (length=9) array 0 => string '1 b' (length=3) 1 => string '2 a' (length=3) 2 => string '3 e' (length=3) 3 => string '10 d' (length=4) 4 => string '20 c' (length=4) -- Edit this bug report at https://bugs.php.net/bug.php?id=55158&edit=1
Req #55158 [Com]: Add SORT_NATURAL type to array_multisort
Edit report at https://bugs.php.net/bug.php?id=55158&edit=1 ID: 55158 Comment by: ar...@php.net Reported by:joe dot lencioni+php at gmail dot com Summary:Add SORT_NATURAL type to array_multisort Status: Open Type: Feature/Change Request Package:Arrays related PHP Version:5.3.6 Block user comment: N Private report: N New Comment: The patch I just added implements SORT_NATURAL and also adds SORT_CASE which can be combined with SORT_STRING and SORT_NATURAL to make the sorting case-insensitive. Previous Comments: [2011-07-12 11:58:09] ar...@php.net The following patch has been added/updated: Patch Name: trunk-multisort-natural Revision: 1310486289 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=trunk-multisort-natural&revision=1310486289 [2011-07-07 15:00:19] joe dot lencioni+php at gmail dot com Description: Arrays often need to be sorted using a "natural order" algorithm. There are currently functions in PHP for sorting single arrays this way (natsort, natcasesort), but nothing exists for a multisort. It would be great to see a SORT_NATURAL option in the array_multisort function. Test script: --- $a = array( 'Second', 'First', 'Twentieth', 'Tenth', 'Third', ); $b = array( '2 a', '1 b', '20 c', '10 d', '3 e', ); array_multisort($b, SORT_NATURAL, $a); var_dump($a, $b); Expected result: array 0 => string 'First' (length=5) 1 => string 'Second' (length=6) 2 => string 'Third' (length=5) 3 => string 'Tenth' (length=5) 4 => string 'Twentieth' (length=9) array 0 => string '1 b' (length=3) 1 => string '2 a' (length=3) 2 => string '3 e' (length=3) 3 => string '10 d' (length=4) 4 => string '20 c' (length=4) -- Edit this bug report at https://bugs.php.net/bug.php?id=55158&edit=1
Req #52982 [PATCH]: Expose php_session_active to userland via new function (patch included)
Edit report at https://bugs.php.net/bug.php?id=52982&edit=1 ID: 52982 Patch added by: ar...@php.net Reported by:php dot net at kenman dot net Summary:Expose php_session_active to userland via new function (patch included) Status: Assigned Type: Feature/Change Request Package:Session related PHP Version:5.3.3 Assigned To:kalle Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: php-trunk-session-status Revision: 1311706347 URL: https://bugs.php.net/patch-display.php?bug=52982&patch=php-trunk-session-status&revision=1311706347 Previous Comments: [2011-07-26 14:31:21] php dot net at kenman dot net Thank you very much, Arpad; my rudimentary C skills were barely enough for me to craft the patch (which I somehow managed to compile and use), and so I appreciate the background info. I would be happy with any solution that helps me to solve the problem! [2011-07-25 22:37:37] ar...@php.net If you're trying to establish whether it's safe to start your own session, this patch is deficient because PS(session_status) is not a boolean - it could also be php_session_disabled. I'd imagine robust code to handle this (rather unusual) case where you require a session but don't know if it's present, would be something like: if (session_is_available()) { if (!session_is_active()) { if (headers_sent()) { // bail out } else { session_start(); } } } else { // bail out } We could instead provide a session_status() function which corresponds to the internal enum (returning SESSION_DISABLED, SESSION_NONE or SESSION_ACTIVE.) I assume this is what Kalle was talking about WRT exposing the other values. Both options are trivial patches. The former seems friendlier but more prone to error. [2011-07-25 17:25:54] php dot net at kenman dot net Any update on this? Simple request; I'm not exactly sure what all Kalle was speaking to WRT "expose the other values", but what I'm requested here is a tiny piece of functionality, and that is *all* that is being requested. [2010-10-05 07:34:11] php dot net at kenman dot net pajoye, I'm not sure if you understand which problem I'm trying to address here; it's not whether or not session_start() was successful, it's whether or not there is a current active session. Many times, in frameworks or other large-scale applications, you have no way of knowing whether session_start() has already been called. You cannot rely on session_id(), SID, session_start(), $_SESSION, or any other session functions or session functionality (that I'm aware of) to tell me "yes, you already have a session open" or "no, you do not have a session open" _before_ I call session_start(). [2010-10-04 12:15:56] paj...@php.net The notice is documented and can be disabled using the display error settings. To detect whether or not session_start was successful, you have to test its return value (as of 5.3.0). It is actually a documentation problem as the examples in the manual does not check the return values (maybe add one on top of them using 5.3+). 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=52982 -- Edit this bug report at https://bugs.php.net/bug.php?id=52982&edit=1
Req #52982 [PATCH]: Expose php_session_active to userland via new function (patch included)
Edit report at https://bugs.php.net/bug.php?id=52982&edit=1 ID: 52982 Patch added by: ar...@php.net Reported by:php dot net at kenman dot net Summary:Expose php_session_active to userland via new function (patch included) Status: Assigned Type: Feature/Change Request Package:Session related PHP Version:5.3.3 Assigned To:kalle Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: php-trunk-session-status-bools Revision: 1311706403 URL: https://bugs.php.net/patch-display.php?bug=52982&patch=php-trunk-session-status-bools&revision=1311706403 Previous Comments: [2011-07-26 18:52:27] ar...@php.net The following patch has been added/updated: Patch Name: php-trunk-session-status Revision: 1311706347 URL: https://bugs.php.net/patch-display.php?bug=52982&patch=php-trunk-session-status&revision=1311706347 [2011-07-26 14:31:21] php dot net at kenman dot net Thank you very much, Arpad; my rudimentary C skills were barely enough for me to craft the patch (which I somehow managed to compile and use), and so I appreciate the background info. I would be happy with any solution that helps me to solve the problem! [2011-07-25 22:37:37] ar...@php.net If you're trying to establish whether it's safe to start your own session, this patch is deficient because PS(session_status) is not a boolean - it could also be php_session_disabled. I'd imagine robust code to handle this (rather unusual) case where you require a session but don't know if it's present, would be something like: if (session_is_available()) { if (!session_is_active()) { if (headers_sent()) { // bail out } else { session_start(); } } } else { // bail out } We could instead provide a session_status() function which corresponds to the internal enum (returning SESSION_DISABLED, SESSION_NONE or SESSION_ACTIVE.) I assume this is what Kalle was talking about WRT exposing the other values. Both options are trivial patches. The former seems friendlier but more prone to error. [2011-07-25 17:25:54] php dot net at kenman dot net Any update on this? Simple request; I'm not exactly sure what all Kalle was speaking to WRT "expose the other values", but what I'm requested here is a tiny piece of functionality, and that is *all* that is being requested. [2010-10-05 07:34:11] php dot net at kenman dot net pajoye, I'm not sure if you understand which problem I'm trying to address here; it's not whether or not session_start() was successful, it's whether or not there is a current active session. Many times, in frameworks or other large-scale applications, you have no way of knowing whether session_start() has already been called. You cannot rely on session_id(), SID, session_start(), $_SESSION, or any other session functions or session functionality (that I'm aware of) to tell me "yes, you already have a session open" or "no, you do not have a session open" _before_ I call session_start(). 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=52982 -- Edit this bug report at https://bugs.php.net/bug.php?id=52982&edit=1
Req #55158 [PATCH]: Add SORT_NATURAL type to array_multisort
Edit report at https://bugs.php.net/bug.php?id=55158&edit=1 ID: 55158 Patch added by: ar...@php.net Reported by:joe dot lencioni+php at gmail dot com Summary:Add SORT_NATURAL type to array_multisort Status: Open Type: Feature/Change Request Package:Arrays related PHP Version:5.3.6 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: php-trunk-array_multisort-natural-case-old-tests Revision: 1312473669 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=php-trunk-array_multisort-natural-case-old-tests&revision=1312473669 Previous Comments: [2011-08-04 16:00:47] ar...@php.net The following patch has been added/updated: Patch Name: php-trunk-array_multisort-natural-case Revision: 1312473647 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=php-trunk-array_multisort-natural-case&revision=1312473647 [2011-07-12 12:00:15] ar...@php.net The patch I just added implements SORT_NATURAL and also adds SORT_CASE which can be combined with SORT_STRING and SORT_NATURAL to make the sorting case-insensitive. [2011-07-12 11:58:09] ar...@php.net The following patch has been added/updated: Patch Name: trunk-multisort-natural Revision: 1310486289 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=trunk-multisort-natural&revision=1310486289 [2011-07-07 15:00:19] joe dot lencioni+php at gmail dot com Description: Arrays often need to be sorted using a "natural order" algorithm. There are currently functions in PHP for sorting single arrays this way (natsort, natcasesort), but nothing exists for a multisort. It would be great to see a SORT_NATURAL option in the array_multisort function. Test script: --- $a = array( 'Second', 'First', 'Twentieth', 'Tenth', 'Third', ); $b = array( '2 a', '1 b', '20 c', '10 d', '3 e', ); array_multisort($b, SORT_NATURAL, $a); var_dump($a, $b); Expected result: array 0 => string 'First' (length=5) 1 => string 'Second' (length=6) 2 => string 'Third' (length=5) 3 => string 'Tenth' (length=5) 4 => string 'Twentieth' (length=9) array 0 => string '1 b' (length=3) 1 => string '2 a' (length=3) 2 => string '3 e' (length=3) 3 => string '10 d' (length=4) 4 => string '20 c' (length=4) -- Edit this bug report at https://bugs.php.net/bug.php?id=55158&edit=1
Req #55158 [PATCH]: Add SORT_NATURAL type to array_multisort
Edit report at https://bugs.php.net/bug.php?id=55158&edit=1 ID: 55158 Patch added by: ar...@php.net Reported by:joe dot lencioni+php at gmail dot com Summary:Add SORT_NATURAL type to array_multisort Status: Open Type: Feature/Change Request Package:Arrays related PHP Version:5.3.6 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: php-trunk-array_multisort-natural-case Revision: 1312473647 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=php-trunk-array_multisort-natural-case&revision=1312473647 Previous Comments: [2011-07-12 12:00:15] ar...@php.net The patch I just added implements SORT_NATURAL and also adds SORT_CASE which can be combined with SORT_STRING and SORT_NATURAL to make the sorting case-insensitive. [2011-07-12 11:58:09] ar...@php.net The following patch has been added/updated: Patch Name: trunk-multisort-natural Revision: 1310486289 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=trunk-multisort-natural&revision=1310486289 [2011-07-07 15:00:19] joe dot lencioni+php at gmail dot com Description: Arrays often need to be sorted using a "natural order" algorithm. There are currently functions in PHP for sorting single arrays this way (natsort, natcasesort), but nothing exists for a multisort. It would be great to see a SORT_NATURAL option in the array_multisort function. Test script: --- $a = array( 'Second', 'First', 'Twentieth', 'Tenth', 'Third', ); $b = array( '2 a', '1 b', '20 c', '10 d', '3 e', ); array_multisort($b, SORT_NATURAL, $a); var_dump($a, $b); Expected result: array 0 => string 'First' (length=5) 1 => string 'Second' (length=6) 2 => string 'Third' (length=5) 3 => string 'Tenth' (length=5) 4 => string 'Twentieth' (length=9) array 0 => string '1 b' (length=3) 1 => string '2 a' (length=3) 2 => string '3 e' (length=3) 3 => string '10 d' (length=4) 4 => string '20 c' (length=4) -- Edit this bug report at https://bugs.php.net/bug.php?id=55158&edit=1
Req #55158 [PATCH]: Add SORT_NATURAL type to array_multisort
Edit report at https://bugs.php.net/bug.php?id=55158&edit=1 ID: 55158 Patch added by: ar...@php.net Reported by:joe dot lencioni+php at gmail dot com Summary:Add SORT_NATURAL type to array_multisort Status: Open Type: Feature/Change Request Package:Arrays related PHP Version:5.3.6 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: php-trunk-array_multisort-natural-case-new-tests Revision: 1312473685 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=php-trunk-array_multisort-natural-case-new-tests&revision=1312473685 Previous Comments: [2011-08-04 16:01:09] ar...@php.net The following patch has been added/updated: Patch Name: php-trunk-array_multisort-natural-case-old-tests Revision: 1312473669 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=php-trunk-array_multisort-natural-case-old-tests&revision=1312473669 [2011-08-04 16:00:47] ar...@php.net The following patch has been added/updated: Patch Name: php-trunk-array_multisort-natural-case Revision: 1312473647 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=php-trunk-array_multisort-natural-case&revision=1312473647 -------- [2011-07-12 12:00:15] ar...@php.net The patch I just added implements SORT_NATURAL and also adds SORT_CASE which can be combined with SORT_STRING and SORT_NATURAL to make the sorting case-insensitive. -------- [2011-07-12 11:58:09] ar...@php.net The following patch has been added/updated: Patch Name: trunk-multisort-natural Revision: 1310486289 URL: https://bugs.php.net/patch-display.php?bug=55158&patch=trunk-multisort-natural&revision=1310486289 [2011-07-07 15:00:19] joe dot lencioni+php at gmail dot com Description: Arrays often need to be sorted using a "natural order" algorithm. There are currently functions in PHP for sorting single arrays this way (natsort, natcasesort), but nothing exists for a multisort. It would be great to see a SORT_NATURAL option in the array_multisort function. Test script: --- $a = array( 'Second', 'First', 'Twentieth', 'Tenth', 'Third', ); $b = array( '2 a', '1 b', '20 c', '10 d', '3 e', ); array_multisort($b, SORT_NATURAL, $a); var_dump($a, $b); Expected result: array 0 => string 'First' (length=5) 1 => string 'Second' (length=6) 2 => string 'Third' (length=5) 3 => string 'Tenth' (length=5) 4 => string 'Twentieth' (length=9) array 0 => string '1 b' (length=3) 1 => string '2 a' (length=3) 2 => string '3 e' (length=3) 3 => string '10 d' (length=4) 4 => string '20 c' (length=4) -- Edit this bug report at https://bugs.php.net/bug.php?id=55158&edit=1
Bug #55366 [PATCH]: keys lost when using substr_replace replace an array
Edit report at https://bugs.php.net/bug.php?id=55366&edit=1 ID: 55366 Patch added by: ar...@php.net Reported by:gorshang at gmail dot com Summary:keys lost when using substr_replace replace an array Status: Open Type: Bug Package:*General Issues Operating System: win7 PHP Version:5.3.6 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: php-trunk-substr_replace-array-keys Revision: 1312537507 URL: https://bugs.php.net/patch-display.php?bug=55366&patch=php-trunk-substr_replace-array-keys&revision=1312537507 Previous Comments: [2011-08-05 02:51:15] gorshang at gmail dot com keys lost when using substr_replace replace an array [2011-08-05 02:33:15] gorshang at gmail dot com Description: --- >From manual page: http://www.php.net/function.substr-replace%23Changelog --- My version is 5.3.5. But the keys lost when replace an array. I wan't write more, but I can't. Oh, my poor English. I'm Chinese. Tank you. Test script: --- 'llsskdkk','def'=>'llsskjkkdd'); $newarr = substr_replace($arr, 'zzz', 0, -2); print_r($newarr); ?> Expected result: Array ( [abc] => zzzkk [def] => zzzdd ) Actual result: -- Array ( [0] => zzzkk [1] => zzzdd ) -- Edit this bug report at https://bugs.php.net/bug.php?id=55366&edit=1
Bug #55366 [PATCH]: keys lost when using substr_replace replace an array
Edit report at https://bugs.php.net/bug.php?id=55366&edit=1 ID: 55366 Patch added by: ar...@php.net Reported by:gorshang at gmail dot com Summary:keys lost when using substr_replace replace an array Status: Open Type: Bug Package:*General Issues Operating System: win7 PHP Version:5.3.6 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: php-trunk-substr_replace-array-keys Revision: 1312539652 URL: https://bugs.php.net/patch-display.php?bug=55366&patch=php-trunk-substr_replace-array-keys&revision=1312539652 Previous Comments: [2011-08-05 09:45:07] ar...@php.net The following patch has been added/updated: Patch Name: php-trunk-substr_replace-array-keys Revision: 1312537507 URL: https://bugs.php.net/patch-display.php?bug=55366&patch=php-trunk-substr_replace-array-keys&revision=1312537507 [2011-08-05 02:51:15] gorshang at gmail dot com keys lost when using substr_replace replace an array [2011-08-05 02:33:15] gorshang at gmail dot com Description: --- >From manual page: http://www.php.net/function.substr-replace%23Changelog --- My version is 5.3.5. But the keys lost when replace an array. I wan't write more, but I can't. Oh, my poor English. I'm Chinese. Tank you. Test script: --- 'llsskdkk','def'=>'llsskjkkdd'); $newarr = substr_replace($arr, 'zzz', 0, -2); print_r($newarr); ?> Expected result: Array ( [abc] => zzzkk [def] => zzzdd ) Actual result: -- Array ( [0] => zzzkk [1] => zzzdd ) -- Edit this bug report at https://bugs.php.net/bug.php?id=55366&edit=1
Bug #55510 [PATCH]: $_FILES 'name' missing first character after upload.
Edit report at https://bugs.php.net/bug.php?id=55510&edit=1 ID: 55510 Patch added by: ar...@php.net Reported by:aaron at gwmicro dot com Summary:$_FILES 'name' missing first character after upload. Status: Feedback Type: Bug Package:Filesystem function related Operating System: Windows Server 2008 R2 PHP Version:5.3.8 Block user comment: N Private report: N New Comment: The following patch has been added/updated: Patch Name: fix-upload-win-mqgpc-bug-55510.patch Revision: 1314585804 URL: https://bugs.php.net/patch-display.php?bug=55510&patch=fix-upload-win-mqgpc-bug-55510.patch&revision=1314585804 Previous Comments: [2011-08-28 17:38:32] aaron at gwmicro dot com I started going back version by version from 5.3.8 to see where the problem started, and it seems to have begun with 5.3.7, as 5.3.6 works correctly. Once again, I'm just replacing PHP builds -- I'm not modifying any else. With 5.3.6, I get back what I would expect: array(1) { ["filename"]=> array(5) { ["name"]=> string(10) "readme.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=> string(31) "C:\temp\file_upload\php594F.tmp" ["error"]=> int(0) ["size"]=> int(22) } } With 5.3.7 and 5.3.8, I get back the missing first letter: array(1) { ["filename"]=> array(5) { ["name"]=> string(10) "eadme.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=> string(31) "C:\temp\file_upload\php594F.tmp" ["error"]=> int(0) ["size"]=> int(22) } } With 5.4.beta1-dev, I'm back to getting everything that I expect: array(1) { ["filename"]=> array(5) { ["name"]=> string(10) "readme.txt" ["type"]=> string(10) "text/plain" ["tmp_name"]=> string(31) "C:\temp\file_upload\php594F.tmp" ["error"]=> int(0) ["size"]=> int(22) } } [2011-08-28 17:21:37] aaron at gwmicro dot com Here are the capture contents using Wireshark and PHP 5.3.8: No. TimeSourceDestination Protocol Length Info 1203 7.25209310.0.0.251184.18.147.3 HTTP 986 POST /private/aaron/filename.php HTTP/1.1 (text/plain) Frame 1203: 986 bytes on wire (7888 bits), 986 bytes captured (7888 bits) Ethernet II, Src: AsustekC_8e:2f:bb (00:26:18:8e:2f:bb), Dst: 3com_49:bb:06 (00:01:02:49:bb:06) Internet Protocol Version 4, Src: 10.0.0.251 (10.0.0.251), Dst: 184.18.147.3 (184.18.147.3) Transmission Control Protocol, Src Port: 65260 (65260), Dst Port: http (80), Seq: 1, Ack: 1, Len: 932 Hypertext Transfer Protocol MIME Multipart Media Encapsulation, Type: multipart/form-data, Boundary: "---9503744825200" [Type: multipart/form-data] First boundary: -9503744825200\r\n Encapsulated multipart part: (text/plain) Content-Disposition: form-data; name="filename"; filename="readme.txt"\r\n Content-Type: text/plain\r\n\r\n Line-based text data: text/plain Hello! This is a test. Last boundary: \r\n-9503744825200--\r\n No. TimeSourceDestination Protocol Length Info 1205 7.25278210.0.0.1 10.0.0.251HTTP 986 POST /private/aaron/filename.php HTTP/1.1 (text/plain) Frame 1205: 986 bytes on wire (7888 bits), 986 bytes captured (7888 bits) Ethernet II, Src: 3com_49:bb:06 (00:01:02:49:bb:06), Dst: AsustekC_8e:2f:bb (00:26:18:8e:2f:bb) Internet Protocol Version 4, Src: 10.0.0.1 (10.0.0.1), Dst: 10.0.0.251 (10.0.0.251) Transmission Control Protocol, Src Port: 65260 (65260), Dst Port: http (80), Seq: 1, Ack: 1, Len: 932 Hypertext Transfer Protocol MIME Multipart Media Encapsulation, Type: multipart/form-data, Boundary: "---9503744825200" [Type: multipart/form-data] First boundary: -9503744825200\r\n Encapsulated multipart part: (text/plain) Content-Disposition: form-data; name="filename"; filename="readme.txt"\r\n Content-Type: text/plain\r\n\r\n Line-based text data: text/plain Hello! This is a test. Last boundary: \r\n-9503744825200--\r\n [2011-08-26 23:02:34] johan...@php.net Keeping state at "Feedback" until data requested by mafick is provid
Bug #55690 [Com]: Wrong behavior of sessionHandler
Edit report at https://bugs.php.net/bug.php?id=55690&edit=1 ID: 55690 Comment by: ar...@php.net Reported by:larue...@php.net Summary:Wrong behavior of sessionHandler Status: Assigned Type: Bug Package:Session related PHP Version:trunk-SVN-2011-09-14 (SVN) Assigned To:arpad Block user comment: N Private report: N New Comment: SessionHandler isn't intended to work in any other context than session_set_save_handler($handler). I'd be nervous about making such a change now anyway. However that error message is misleading. I'll update it. Previous Comments: [2011-09-14 05:57:24] larue...@php.net I think you can remove the PS_SANITY_CHECK, and use PS(mod) instead of PS(default_mod), this should be okey. thanks [2011-09-14 05:52:02] larue...@php.net arpad plz look at this. thanks [2011-09-14 05:50:42] larue...@php.net Description: in mod_use_class.c there is a macro: #define PS_SANITY_CHECK \ if (PS(default_mod) == NULL) { \ php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "Called default SessionHandler but session.save_handler is user"); \ RETURN_FALSE; \ } but I think this is wrong. since, the default session.save_handler is "file", and if no new session.save_handler provide, PS(default_mod) will alyways be NULL(since default_mod only be assign in OnUpdateSaveHandler Test script: --- php -dsession.save_handler=files -r 'var_dump(ini_get("session.save_handler")); $x=new SessionHandler; $x->gc(1);' Actual result: -- PHP Fatal error: SessionHandler::gc(): Called default SessionHandler but session.save_handler is user in Unknown on line 0 -- Edit this bug report at https://bugs.php.net/bug.php?id=55690&edit=1
Bug #63379 [Com]: Warning when using session_regenerate_id(TRUE) with a SessionHandler
Edit report at https://bugs.php.net/bug.php?id=63379&edit=1 ID: 63379 Comment by: ar...@php.net Reported by:avatar2004-php at yahoo dot fr Summary:Warning when using session_regenerate_id(TRUE) with a SessionHandler Status: Closed Type: Bug Package:Session related Operating System: Gentoo PHP Version:5.4.8 Assigned To:arpad Block user comment: N Private report: N New Comment: Laruence you were correct, the reset wasn't necessary :) avatar2004, the flag is only meant to keep the parent session handler in a sane state. If a user implementation calls the parent handler in close() but not in open(), we need to be able to prevent the close() call on the parent handler even though session_status tells us that the session is open. The flag is a global because having more than one session handler instance active in the same request is nonsensical. Previous Comments: [2012-12-14 00:07:34] ar...@php.net Automatic comment on behalf of array...@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=6566ea61732a1ab42c1a57e60adc96788cb0feb2 Log: Fix #63379 - Don't reset mod_user_is_open in destroy [2012-10-29 04:21:47] avatar2004-php at yahoo dot fr Looking at the code, it feels like the very semantics of the mod_user_is_open flag are not exactly consistent. The flag is a global, yet it is manipulated by instance code. Meaning if the user space code uses several handlers interchangeably, the result can quickly become confusing. I suggest a decision should be made as to whether the SessionHandler is a stateless, thin wrapper for the handler calls in which case it should default to the same checks as the procedural API. Otherwise, the flag should really be an instance variable used to track the proper invocation sequence of the different callbacks and make sure THIS handler is open before calling dependent routines. Adding an instance variable to the (base) class though is probably not worth it. The session management semantics are already defined by the procedural API which uses a global session state flag (session_status). If required for a handler implementation, the flag can simply be implemented in user space. Just my 2c. [2012-10-29 03:07:41] larue...@php.net I mean, maybe only reset it in close handler? [2012-10-29 03:07:08] larue...@php.net is the reseting of user_is_open necessary? diff --git a/ext/session/mod_user_class.c b/ext/session/mod_user_class.c index 70d2f40..4edac28 100644 --- a/ext/session/mod_user_class.c +++ b/ext/session/mod_user_class.c @@ -121,7 +121,6 @@ PHP_METHOD(SessionHandler, destroy) return; } - PS(mod_user_is_open) = 0; RETVAL_BOOL(SUCCESS == PS(default_mod)->s_destroy(&PS(mod_data), key TSRMLS_CC)); } /* }}} */ [2012-10-29 01:14:11] avatar2004-php at yahoo dot fr If I understand correctly and "mod_user_is_open" is just a global state parameter used by the SessionHandler instance, I was wondering why the check wasn't being done on "session_status" instead to conform with the rest of the session_* API ? 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=63379 -- Edit this bug report at https://bugs.php.net/bug.php?id=63379&edit=1
Req #63743 [Com]: New function request
Edit report at https://bugs.php.net/bug.php?id=63743&edit=1 ID: 63743 Comment by: ar...@php.net Reported by:jb7815 at gmail dot com Summary:New function request Status: Open Type: Feature/Change Request Package:Unknown/Other Function Operating System: All PHP Version:Irrelevant Block user comment: N Private report: N New Comment: This can be done with array_merge_recursive(). Previous Comments: [2012-12-11 17:58:22] jb7815 at gmail dot com Description: Suggestion: Could you please implement a function to merge associative arrays without overwriting duplicate keys. Unless there already is one that I have missed? I have provided a small example that works to a point that will demonstrate my idea. Thanks. Test script: --- function array_merge_assoc($array1, $array2){ foreach($array2 as $key => $value){ if(array_key_exists($key, $array1)){ $result[$key] = array_merge($array1[$key], $array2[$key]); unset($array2[$key]); }else{ $result[$key] = $array2[$key]; } } return $result; } $userConfig = ['libraries' => ['database', 'session', 'security']]; $defaults = ['libraries' => ['benchmark' , 'event', 'error'], 'helpers' => ['html','date','file']]; print_r(array_merge_assoc($userConfig,$defaults)); Expected result: Array ( [libraries] => Array ( [0] => database [1] => session [2] => security [3] => benchmark [4] => event [5] => error ) [helpers] => Array ( [0] => html [1] => date [2] => file ) ) -- Edit this bug report at https://bugs.php.net/bug.php?id=63743&edit=1
[PHP-BUG] Bug #63984 [NEW]: Generators segfault
From: arpad Operating system: Linux PHP version: 5.5.0alpha2 Package: Reproducible crash Bug Type: Bug Bug description:Generators segfault Description: Can't provide a reproduce script yet I'm afraid, but I have a tree of objects, some of which are generators. I think this segfault is happening when destroying the tree. The generators are likely to not have finished iterating at this point. Program received signal SIGSEGV, Segmentation fault. _zval_ptr_dtor (zval_ptr=0x78e08f38) at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:428 428 i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC); (gdb) bt #0 _zval_ptr_dtor (zval_ptr=0x78e08f38) at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:428 #1 0x7417f674 in zend_generator_close (generator=0x78e084c8, finished_execution=) at /home/arpad/w/php/php-src/Zend/zend_generators.c:132 #2 0x7417f7cb in zend_generator_free_storage (generator=0x78e084c8) at /home/arpad/w/php/php-src/Zend/zend_generators.c:180 #3 0x74185823 in zend_objects_store_free_object_storage (objects=0x7485bf20) at /home/arpad/w/php/php-src/Zend/zend_objects_API.c:92 #4 0x7414e983 in shutdown_executor () at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:295 #5 0x7415d8f5 in zend_deactivate () at /home/arpad/w/php/php-src/Zend/zend.c:938 #6 0x740fe3ec in php_request_shutdown (dummy=) at /home/arpad/w/php/php-src/main/main.c:1799 #7 0x7420c2f7 in php_apache_request_dtor (r=0x78a087f0) at /home/arpad/w/php/php-src/sapi/apache2handler/sapi_apache2.c:507 #8 php_handler (r=0x78a087f0) at /home/arpad/w/php/php-src/sapi/apache2handler/sapi_apache2.c:679 #9 0x77fd5478 in ap_run_handler (r=0x78a087f0) at /build/buildd/apache2-2.2.17/server/config.c:159 #10 0x77fd58dc in ap_invoke_handler (r=0x78a087f0) at /build/buildd/apache2-2.2.17/server/config.c:377 #11 0x77fe4cfc in ap_internal_redirect (new_uri=, r=) at /build/buildd/apache2-2.2.17/modules/http/http_request.c:549 #12 0x7fffefdc612d in ?? () from /usr/lib/apache2/modules/mod_rewrite.so #13 0x77fd5478 in ap_run_handler (r=0x78830270) at /build/buildd/apache2-2.2.17/server/config.c:159 ---Type to continue, or q to quit--- #14 0x77fd58dc in ap_invoke_handler (r=0x78830270) at /build/buildd/apache2-2.2.17/server/config.c:377 #15 0x77fe56c0 in ap_process_request (r=0x78830270) at /build/buildd/apache2-2.2.17/modules/http/http_request.c:282 #16 0x77fe2698 in ap_process_http_connection (c=0x7865bab0) at /build/buildd/apache2-2.2.17/modules/http/http_core.c:190 #17 0x77fdc058 in ap_run_process_connection (c=0x7865bab0) at /build/buildd/apache2-2.2.17/server/connection.c:43 #18 0x77fea6c0 in child_main (child_num_arg=) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:662 #19 0x77fea986 in make_child (s=0x78214938, slot=0) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:707 #20 0x77feb163 in ap_mpm_run (_pconf=, plog=, s=) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:983 #21 0x77fc03aa in main (argc=2, argv=0x7fffe5f8) at /build/buildd/apache2-2.2.17/server/main.c:741 -- Edit bug report at https://bugs.php.net/bug.php?id=63984&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63984&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63984&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63984&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63984&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63984&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63984&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63984&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63984&r=oldversion Not developer issue:https://bugs.php.net/fix.php?id=63984&r=support Expected behavior: https://bugs.php.net/fix.php?id=63984&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63984&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63984&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63984&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63984&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63984&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63984&r=isapi Install GNU Sed:https://bugs.php.net/fix.php?id=63984&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63984&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63984&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63984&r=mysqlcfg
Bug #63984 [Com]: Generators segfault
Edit report at https://bugs.php.net/bug.php?id=63984&edit=1 ID: 63984 Comment by: ar...@php.net Reported by: ar...@php.net Summary:Generators segfault Status: Open Type: Bug Package:Reproducible crash Operating System: Linux PHP Version:5.5.0alpha2 Block user comment: N Private report: N New Comment: Also the generators are all closures, the following is one of the simpler ones: $exp = new Ruler_Expression_Anonymous; $exp->provides = array('friend'); $self = $this; $friends = $this->friends; $exp->func = function() use ($self, $friends) { foreach ($friends as $id => $name) { yield [ 'friend' => new Resource_User($id, $self), ]; } }; Bit more information from GDB (frame 1 in the above backtrace): (gdb) p stack_frame $1 = (void **) 0x78e08f38 (gdb) p *stack_frame $2 = (void *) 0x0 Previous Comments: -------- [2013-01-14 11:20:21] ar...@php.net Description: Can't provide a reproduce script yet I'm afraid, but I have a tree of objects, some of which are generators. I think this segfault is happening when destroying the tree. The generators are likely to not have finished iterating at this point. Program received signal SIGSEGV, Segmentation fault. _zval_ptr_dtor (zval_ptr=0x78e08f38) at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:428 428 i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC); (gdb) bt #0 _zval_ptr_dtor (zval_ptr=0x78e08f38) at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:428 #1 0x7417f674 in zend_generator_close (generator=0x78e084c8, finished_execution=) at /home/arpad/w/php/php-src/Zend/zend_generators.c:132 #2 0x7417f7cb in zend_generator_free_storage (generator=0x78e084c8) at /home/arpad/w/php/php-src/Zend/zend_generators.c:180 #3 0x74185823 in zend_objects_store_free_object_storage (objects=0x7485bf20) at /home/arpad/w/php/php-src/Zend/zend_objects_API.c:92 #4 0x7414e983 in shutdown_executor () at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:295 #5 0x7415d8f5 in zend_deactivate () at /home/arpad/w/php/php-src/Zend/zend.c:938 #6 0x740fe3ec in php_request_shutdown (dummy=) at /home/arpad/w/php/php-src/main/main.c:1799 #7 0x7420c2f7 in php_apache_request_dtor (r=0x78a087f0) at /home/arpad/w/php/php-src/sapi/apache2handler/sapi_apache2.c:507 #8 php_handler (r=0x78a087f0) at /home/arpad/w/php/php-src/sapi/apache2handler/sapi_apache2.c:679 #9 0x77fd5478 in ap_run_handler (r=0x78a087f0) at /build/buildd/apache2-2.2.17/server/config.c:159 #10 0x77fd58dc in ap_invoke_handler (r=0x78a087f0) at /build/buildd/apache2-2.2.17/server/config.c:377 #11 0x77fe4cfc in ap_internal_redirect (new_uri=, r=) at /build/buildd/apache2-2.2.17/modules/http/http_request.c:549 #12 0x7fffefdc612d in ?? () from /usr/lib/apache2/modules/mod_rewrite.so #13 0x77fd5478 in ap_run_handler (r=0x78830270) at /build/buildd/apache2-2.2.17/server/config.c:159 ---Type to continue, or q to quit--- #14 0x77fd58dc in ap_invoke_handler (r=0x78830270) at /build/buildd/apache2-2.2.17/server/config.c:377 #15 0x77fe56c0 in ap_process_request (r=0x78830270) at /build/buildd/apache2-2.2.17/modules/http/http_request.c:282 #16 0x77fe2698 in ap_process_http_connection (c=0x7865bab0) at /build/buildd/apache2-2.2.17/modules/http/http_core.c:190 #17 0x77fdc058 in ap_run_process_connection (c=0x7865bab0) at /build/buildd/apache2-2.2.17/server/connection.c:43 #18 0x77fea6c0 in child_main (child_num_arg=) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:662 #19 0x77fea986 in make_child (s=0x78214938, slot=0) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:707 #20 0x77feb163 in ap_mpm_run (_pconf=, plog=, s=) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:983 #21 0x77fc03aa in main (argc=2, argv=0x7fffe5f8) at /build/buildd/apache2-2.2.17/server/main.c:741 -- Edit this bug report at https://bugs.php.net/bug.php?id=63984&edit=1
Bug #63984 [Com]: Generators segfault
Edit report at https://bugs.php.net/bug.php?id=63984&edit=1 ID: 63984 Comment by: ar...@php.net Reported by: ar...@php.net Summary:Generators segfault Status: Assigned Type: Bug Package:Reproducible crash Operating System: Linux PHP Version:5.5.0alpha2 Assigned To:nikic Block user comment: N Private report: N New Comment: I think it's when "exit" is called during the execution of the generator, wasn't getting any errors though. I'll put together a repro script later. Previous Comments: [2013-01-14 15:21:47] ni...@php.net Do you know whether this segfault happens in conjunction with a fatal error? It's probably the same as https://bugs.php.net/bug.php?id=63830. ---- [2013-01-14 11:43:00] ar...@php.net Also the generators are all closures, the following is one of the simpler ones: $exp = new Ruler_Expression_Anonymous; $exp->provides = array('friend'); $self = $this; $friends = $this->friends; $exp->func = function() use ($self, $friends) { foreach ($friends as $id => $name) { yield [ 'friend' => new Resource_User($id, $self), ]; } }; Bit more information from GDB (frame 1 in the above backtrace): (gdb) p stack_frame $1 = (void **) 0x78e08f38 (gdb) p *stack_frame $2 = (void *) 0x0 -------- [2013-01-14 11:20:21] ar...@php.net Description: Can't provide a reproduce script yet I'm afraid, but I have a tree of objects, some of which are generators. I think this segfault is happening when destroying the tree. The generators are likely to not have finished iterating at this point. Program received signal SIGSEGV, Segmentation fault. _zval_ptr_dtor (zval_ptr=0x78e08f38) at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:428 428 i_zval_ptr_dtor(*zval_ptr ZEND_FILE_LINE_RELAY_CC); (gdb) bt #0 _zval_ptr_dtor (zval_ptr=0x78e08f38) at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:428 #1 0x7417f674 in zend_generator_close (generator=0x78e084c8, finished_execution=) at /home/arpad/w/php/php-src/Zend/zend_generators.c:132 #2 0x7417f7cb in zend_generator_free_storage (generator=0x78e084c8) at /home/arpad/w/php/php-src/Zend/zend_generators.c:180 #3 0x74185823 in zend_objects_store_free_object_storage (objects=0x7485bf20) at /home/arpad/w/php/php-src/Zend/zend_objects_API.c:92 #4 0x7414e983 in shutdown_executor () at /home/arpad/w/php/php-src/Zend/zend_execute_API.c:295 #5 0x7415d8f5 in zend_deactivate () at /home/arpad/w/php/php-src/Zend/zend.c:938 #6 0x740fe3ec in php_request_shutdown (dummy=) at /home/arpad/w/php/php-src/main/main.c:1799 #7 0x7420c2f7 in php_apache_request_dtor (r=0x78a087f0) at /home/arpad/w/php/php-src/sapi/apache2handler/sapi_apache2.c:507 #8 php_handler (r=0x78a087f0) at /home/arpad/w/php/php-src/sapi/apache2handler/sapi_apache2.c:679 #9 0x77fd5478 in ap_run_handler (r=0x78a087f0) at /build/buildd/apache2-2.2.17/server/config.c:159 #10 0x77fd58dc in ap_invoke_handler (r=0x78a087f0) at /build/buildd/apache2-2.2.17/server/config.c:377 #11 0x77fe4cfc in ap_internal_redirect (new_uri=, r=) at /build/buildd/apache2-2.2.17/modules/http/http_request.c:549 #12 0x7fffefdc612d in ?? () from /usr/lib/apache2/modules/mod_rewrite.so #13 0x77fd5478 in ap_run_handler (r=0x78830270) at /build/buildd/apache2-2.2.17/server/config.c:159 ---Type to continue, or q to quit--- #14 0x77fd58dc in ap_invoke_handler (r=0x78830270) at /build/buildd/apache2-2.2.17/server/config.c:377 #15 0x77fe56c0 in ap_process_request (r=0x78830270) at /build/buildd/apache2-2.2.17/modules/http/http_request.c:282 #16 0x77fe2698 in ap_process_http_connection (c=0x7865bab0) at /build/buildd/apache2-2.2.17/modules/http/http_core.c:190 #17 0x77fdc058 in ap_run_process_connection (c=0x7865bab0) at /build/buildd/apache2-2.2.17/server/connection.c:43 #18 0x77fea6c0 in child_main (child_num_arg=) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:662 #19 0x77fea986 in make_child (s=0x78214938, slot=0) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:707 #20 0x77feb163 in ap_mpm_run (_pconf=, plog=, s=) at /build/buildd/apache2-2.2.17/server/mpm/prefork/prefork.c:983 #21 0x7fff