Req #28919 [Opn]: foreach does not take list() as argument output
Edit report at http://bugs.php.net/bug.php?id=28919&edit=1 ID: 28919 User updated by: black at scene-si dot org Reported by: black at scene-si dot org Summary: foreach does not take list() as argument output Status: Open Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: any PHP Version: Irrelevant New Comment: It wouldn't be a FEATURE then, would it? Previous Comments: [2010-05-11 17:39:51] rc at opelgt dot org Why not using this code? foreach ($table as $key=>$val) { echo $key.":".$val[0].", ".$val[1]."\n"; } [2004-06-25 19:48:45] poll...@php.net This is expected behavior. list() is a left-hand language construct and not currently intended to be used this way. Reclassifying to Feature/Change Request. ------------ [2004-06-25 13:20:05] black at scene-si dot org Description: Requesting additional functionality for foreach? Reproduce code: --- $table = array(); $table['username'] = array(1,"John doe"); $table['black'] = array(2,"Jane doe"); $table['yawn'] = array(3,"Undefined"); foreach ($table as $key=>list($id,$title)) { echo $key.":".$id.", ".$title."\n"; } foreach ($table as list($id,$title)) { echo $id.", ".$title."\n"; } Expected result: username:1, John doe black:2, Jane doe yawn:3, Undefined 1, John doe 2, Jane doe 3, Undefined Actual result: -- Parse error -- Edit this bug report at http://bugs.php.net/bug.php?id=28919&edit=1
#40590 [NEW]: list($k,$v) = $v; gives unexpected output
From: black at scene-si dot org Operating system: linux PHP version: 5.2.1 PHP Bug Type: Variables related Bug description: list($k,$v) = $v; gives unexpected output Description: list() overwriting variable, unexpected result (different from php4). Reproduce code: --- $v = array("00","-- Day --"); list($k,$v) = $v; var_dump(array($k,$v)); Expected result: Var dump should return: array(2) { [0]=> string(2) "00" [1]=> string(11) "-- Day -- " } Actual result: -- Var dump returns: array(2) { [0]=> string(1) "-" [1]=> string(11) "-- Day -- " } -- Edit bug report at http://bugs.php.net/?id=40590&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40590&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40590&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40590&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40590&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40590&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40590&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=40590&r=needscript Try newer version:http://bugs.php.net/fix.php?id=40590&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40590&r=support Expected behavior:http://bugs.php.net/fix.php?id=40590&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40590&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40590&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40590&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40590&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40590&r=dst IIS Stability:http://bugs.php.net/fix.php?id=40590&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40590&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40590&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40590&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=40590&r=mysqlcfg
#34477 [NEW]: strtok() treats repeat of characters as single occurance
From: black at scene-si dot org Operating system: linux deb PHP version: 4.4.0 PHP Bug Type: Strings related Bug description: strtok() treats repeat of characters as single occurance Description: strtok() ignores repeats of "arg2" ie. needle, and treats it as a single occurance, skipping all repetitions Reproduce code: --- $query = "wtf ? omg ? wtf ???, ?"; $arguments = array(1,2,3,4,5,6); var_dump($query); $sql = strtok($query,"?"); var_dump($sql); $retval = ""; while ($sql!==false) { $wasempty = empty($arguments); $val = array_shift($arguments); $retval .= $sql; if (!is_null($val) || !$wasempty) { $retval .= "'".$this->escape($val).'\''; } $sql = strtok("?"); var_dump($sql); } echo $retval; Expected result: string(22) "wtf ? omg ? wtf ???, ?" string(4) "wtf " string(5) " omg " string(5) " wtf " string(0) "" string(0) "" string(2) ", " bool(false) wtf '1' omg '2' wtf '3''4''5', '6' Actual result: -- string(22) "wtf ? omg ? wtf ???, ?" string(4) "wtf " string(5) " omg " string(5) " wtf " string(2) ", " bool(false) wtf '1' omg '2' wtf '3', '4' -- Edit bug report at http://bugs.php.net/?id=34477&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34477&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34477&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34477&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=34477&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=34477&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34477&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34477&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34477&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34477&r=support Expected behavior: http://bugs.php.net/fix.php?id=34477&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34477&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34477&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=34477&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34477&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=34477&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34477&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34477&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34477&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34477&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34477&r=mysqlcfg
#29648 [Opn]: cant throw exceptions with __autoload (to catch and handle them - workaround?)
ID: 29648 User updated by: black at scene-si dot org Reported By: black at scene-si dot org Status: Open Bug Type: Scripting Engine problem Operating System: debian -PHP Version: 5.0.0 +PHP Version: 5.0+ New Comment: requesting feedback & new versions also dont support this Previous Comments: [2004-08-13 12:49:39] black at scene-si dot org And the result: Fatal error: __autoload(object_wtf) threw an exception of type 'Exception' in /root/monotek/mono/commands/test.php on line 16 (gah) [2004-08-13 12:47:52] black at scene-si dot org ugh, forgot to add if (!class_exists($classname)) { throw new Exception(); } after the first include_once in the example. Ofcourse i'm throwing the exception im trying to catch ;) [2004-08-13 12:30:17] black at scene-si dot org Description: I've tried to create an __autoload() function which would throw an exception if it can't load the class name from a file depending on the classname i request with the php code. I couldnt catch the exception with a try/catch clause, because it always failed (see expected/actual result below). My workaround was to add this after the first include_once statement inside the __autoload: if (!class_exists($classname)) { eval("class ".$classname." { }"); } Afterwards instead of a try/catch clause i used a method_exist call to see if a general function was defined (one that i require to have). Reproduce code: --- http://bugs.php.net/?id=29648&edit=1
#29657 [NEW]: xml_* functions throw non descriptive error, compared to php4
From: black at scene-si dot org Operating system: debian PHP version: 5.0.0 PHP Bug Type: XML related Bug description: xml_* functions throw non descriptive error, compared to php4 Description: when validating an incorrectly formated xml file, the errors from php 5.0.0 are vaguely descriptive, outputting some constant name and not a human readable error message Reproduce code: --- #!/usr/bin/php5 http://bugs.php.net/?id=29657&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29657&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29657&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29657&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29657&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29657&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29657&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29657&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=29657&r=support Expected behavior: http://bugs.php.net/fix.php?id=29657&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=29657&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=29657&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29657&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29657&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29657&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29657&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=29657&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29657&r=float
#29648 [Opn]: cant throw exceptions with __autoload (to catch and handle them - workaround?)
ID: 29648 User updated by: black at scene-si dot org Reported By: black at scene-si dot org Status: Open Bug Type: Scripting Engine problem Operating System: debian PHP Version: 5.0.0 New Comment: And the result: Fatal error: __autoload(object_wtf) threw an exception of type 'Exception' in /root/monotek/mono/commands/test.php on line 16 (gah) Previous Comments: [2004-08-13 12:47:52] black at scene-si dot org ugh, forgot to add if (!class_exists($classname)) { throw new Exception(); } after the first include_once in the example. Ofcourse i'm throwing the exception im trying to catch ;) [2004-08-13 12:30:17] black at scene-si dot org Description: I've tried to create an __autoload() function which would throw an exception if it can't load the class name from a file depending on the classname i request with the php code. I couldnt catch the exception with a try/catch clause, because it always failed (see expected/actual result below). My workaround was to add this after the first include_once statement inside the __autoload: if (!class_exists($classname)) { eval("class ".$classname." { }"); } Afterwards instead of a try/catch clause i used a method_exist call to see if a general function was defined (one that i require to have). Reproduce code: --- http://bugs.php.net/?id=29648&edit=1
#29648 [Opn]: cant throw exceptions with __autoload (to catch and handle them - workaround?)
ID: 29648 User updated by: black at scene-si dot org Reported By: black at scene-si dot org Status: Open Bug Type: Scripting Engine problem Operating System: debian PHP Version: 5.0.0 New Comment: ugh, forgot to add if (!class_exists($classname)) { throw new Exception(); } after the first include_once in the example. Ofcourse i'm throwing the exception im trying to catch ;) Previous Comments: [2004-08-13 12:30:17] black at scene-si dot org Description: I've tried to create an __autoload() function which would throw an exception if it can't load the class name from a file depending on the classname i request with the php code. I couldnt catch the exception with a try/catch clause, because it always failed (see expected/actual result below). My workaround was to add this after the first include_once statement inside the __autoload: if (!class_exists($classname)) { eval("class ".$classname." { }"); } Afterwards instead of a try/catch clause i used a method_exist call to see if a general function was defined (one that i require to have). Reproduce code: --- http://bugs.php.net/?id=29648&edit=1
#29648 [NEW]: cant throw exceptions with __autoload (to catch and handle them - workaround?)
From: black at scene-si dot org Operating system: debian PHP version: 5.0.0 PHP Bug Type: Scripting Engine problem Bug description: cant throw exceptions with __autoload (to catch and handle them - workaround?) Description: I've tried to create an __autoload() function which would throw an exception if it can't load the class name from a file depending on the classname i request with the php code. I couldnt catch the exception with a try/catch clause, because it always failed (see expected/actual result below). My workaround was to add this after the first include_once statement inside the __autoload: if (!class_exists($classname)) { eval("class ".$classname." { }"); } Afterwards instead of a try/catch clause i used a method_exist call to see if a general function was defined (one that i require to have). Reproduce code: --- http://bugs.php.net/?id=29648&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29648&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29648&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29648&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29648&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29648&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29648&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29648&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=29648&r=support Expected behavior: http://bugs.php.net/fix.php?id=29648&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=29648&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=29648&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29648&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29648&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29648&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29648&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=29648&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29648&r=float
#29479 [NEW]: changing current process name
From: black at scene-si dot org Operating system: linux PHP version: Irrelevant PHP Bug Type: *General Issues Bug description: changing current process name Description: With linux it is sometimes useful to be able to change the process name (by identifying a process in the system error logs or for debugging for example).. The c(++) or the perl way doesnt work in php as far as i tried, and so i pressume that it is not possible itself. You can consult yourself with http://lightconsulting.com/~thalakan/process-title-notes.html - an extensive example of how the title should be changed Reproduce code: --- $argv[0] = "progname-debugval"; Expected result: I expect that the programs process title would be changed by modifying $argv[0], or by introducing a new function which would change the process title respectively. Actual result: -- The process name in `ps` output of the respective program should change accordingly to the change of $argv[0]; -- Edit bug report at http://bugs.php.net/?id=29479&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29479&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29479&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29479&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29479&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29479&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29479&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29479&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=29479&r=support Expected behavior: http://bugs.php.net/fix.php?id=29479&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=29479&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=29479&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29479&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29479&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29479&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29479&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=29479&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29479&r=float
#28919 [NEW]: foreach does not take list() as argument output
From: black at scene-si dot org Operating system: any PHP version: Irrelevant PHP Bug Type: Scripting Engine problem Bug description: foreach does not take list() as argument output Description: Requesting additional functionality for foreach? Reproduce code: --- $table = array(); $table['username'] = array(1,"John doe"); $table['black'] = array(2,"Jane doe"); $table['yawn'] = array(3,"Undefined"); foreach ($table as $key=>list($id,$title)) { echo $key.":".$id.", ".$title."\n"; } foreach ($table as list($id,$title)) { echo $id.", ".$title."\n"; } Expected result: username:1, John doe black:2, Jane doe yawn:3, Undefined 1, John doe 2, Jane doe 3, Undefined Actual result: -- Parse error -- Edit bug report at http://bugs.php.net/?id=28919&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28919&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28919&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28919&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28919&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28919&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28919&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28919&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=28919&r=support Expected behavior: http://bugs.php.net/fix.php?id=28919&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=28919&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=28919&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28919&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28919&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28919&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28919&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=28919&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28919&r=float
#27428 [Fbk->Opn]: serialize brakes output for unserialize, returning garbage
ID: 27428 User updated by: black at scene-si dot org Reported By: black at scene-si dot org -Status: Feedback +Status: Open Bug Type: Strings related Operating System: debian unstable PHP Version: Irrelevant New Comment: the first thing i tried was to disable it, but nothing was changed. then i tried compiling php without oracle support, nothing. then i tried compiling latest snapshots, stable relases, release candidates, older snapshots i had lying around.. everything with the same result.. of late i made a workaround by not using the database, but i still use the serialize/unserialize functions, so it probablly has something to do with the escape string / query functions (so strings related category shouldnt apply anymore?).. unserialize caused garbage to spew out because of the incorrect reported length from serialize, and the difference of length in the actual field.. (check description, original post), this behaviour is valid, but checks should still be made so that doesnt happen (accessing memory not used by the string that gets passed to is, bad thing). something seriously goes wrong, either with serialize.. or mysql_escape_string (or the acctual mysql application).. why serialize wouldnt fuck up with files is beyond me.. [anyway, as to your feedback request, i tried just about everything except compiling php in debug mode] Previous Comments: [2004-03-06 14:14:17] [EMAIL PROTECTED] Try to see if you can replicate the bug when turckmmcache is not being used. [2004-02-28 17:38:50] black at scene-si dot org i've also tried using mysql_real_escape_string, but it didnt solve anything (for long anyway, the garbage output came back at the worst of moments.) the phpinfo above is still valid - any help would be appreciated, as i really dont know what to do [2004-02-27 20:31:55] black at scene-si dot org Description: The following has been tested on: php-4.3.2 php-4.3.4 php-4.3.5rc2 php-4.3.5rc3 php4-STABLE-200310032330 php4-STABLE-200402101030 php4-STABLE-200402272030 with various compile options turned on/off (oracle support & turckmmcache), always giving same result basically with every version of this some or most serialize() calls result in an incorrectlly constructed serialized string... given i only input plaintext, the serialized string must have a length of 6+strlen(original), albeit: ["cache_data"]=> string(9277) "s:9309:"... (oops!) ["cache_data"]=> string(24259) "s:24248:"... (correct.) ["cache_data"]=> string(23850) "s:23881:"... (oops!) ["cache_data"]=> string(224081) "s:224069:"... (correct.) ["cache_data"]=> string(21055) "s:21107:"... (WTF!) ["cache_data"]=> string(19590) "s:19663:"... (wrong) ... http://scene-si.org/test.tgz - 800kb, contains 15Mb output of the reproduce code. http://193.77.198.80/phpinfo.php for phpinfo() Linux dahim 2.4.23-1-686 #1 Sun Nov 30 20:51:10 EST 2003 i686 GNU/Linux (thats the server this runs on). the funny part is, that this code (the same code to generate the entries in condor_dbcache) works also on other servers, also debian, iis, apache-win, redhat, mandrake, openbsd, freebsd.. it only fucked here.. after the serialize is done, the ONLY command it goes trough is mysql_escape_string, so there is no character or other conversions which could explain the wrong length in serialized() output Reproduce code: --- ";' ... but the content length is 9277.. the content was input with serialize in the following way: $content = serialize($content); mysql_query("update condor_dbcache set cache_timestamp='".time()."', cache_data='".mysql_escape_string($content)."' where cache_filename='".mysql_escape_string($filename)."'"); filename beeing the correspondant key to this dbcache table. -- Edit this bug report at http://bugs.php.net/?id=27428&edit=1
#27428 [Opn]: serialize brakes output for unserialize, returning garbage
ID: 27428 User updated by: black at scene-si dot org Reported By: black at scene-si dot org Status: Open Bug Type: Strings related Operating System: debian unstable PHP Version: Irrelevant New Comment: i've also tried using mysql_real_escape_string, but it didnt solve anything (for long anyway, the garbage output came back at the worst of moments.) the phpinfo above is still valid - any help would be appreciated, as i really dont know what to do Previous Comments: [2004-02-27 20:31:55] black at scene-si dot org Description: The following has been tested on: php-4.3.2 php-4.3.4 php-4.3.5rc2 php-4.3.5rc3 php4-STABLE-200310032330 php4-STABLE-200402101030 php4-STABLE-200402272030 with various compile options turned on/off (oracle support & turckmmcache), always giving same result basically with every version of this some or most serialize() calls result in an incorrectlly constructed serialized string... given i only input plaintext, the serialized string must have a length of 6+strlen(original), albeit: ["cache_data"]=> string(9277) "s:9309:"... (oops!) ["cache_data"]=> string(24259) "s:24248:"... (correct.) ["cache_data"]=> string(23850) "s:23881:"... (oops!) ["cache_data"]=> string(224081) "s:224069:"... (correct.) ["cache_data"]=> string(21055) "s:21107:"... (WTF!) ["cache_data"]=> string(19590) "s:19663:"... (wrong) ... http://scene-si.org/test.tgz - 800kb, contains 15Mb output of the reproduce code. http://193.77.198.80/phpinfo.php for phpinfo() Linux dahim 2.4.23-1-686 #1 Sun Nov 30 20:51:10 EST 2003 i686 GNU/Linux (thats the server this runs on). the funny part is, that this code (the same code to generate the entries in condor_dbcache) works also on other servers, also debian, iis, apache-win, redhat, mandrake, openbsd, freebsd.. it only fucked here.. after the serialize is done, the ONLY command it goes trough is mysql_escape_string, so there is no character or other conversions which could explain the wrong length in serialized() output Reproduce code: --- ";' ... but the content length is 9277.. the content was input with serialize in the following way: $content = serialize($content); mysql_query("update condor_dbcache set cache_timestamp='".time()."', cache_data='".mysql_escape_string($content)."' where cache_filename='".mysql_escape_string($filename)."'"); filename beeing the correspondant key to this dbcache table. -- Edit this bug report at http://bugs.php.net/?id=27428&edit=1
#27428 [NEW]: serialize brakes output for unserialize, returning garbage
From: black at scene-si dot org Operating system: debian unstable PHP version: Irrelevant PHP Bug Type: Strings related Bug description: serialize brakes output for unserialize, returning garbage Description: The following has been tested on: php-4.3.2 php-4.3.4 php-4.3.5rc2 php-4.3.5rc3 php4-STABLE-200310032330 php4-STABLE-200402101030 php4-STABLE-200402272030 with various compile options turned on/off (oracle support & turckmmcache), always giving same result basically with every version of this some or most serialize() calls result in an incorrectlly constructed serialized string... given i only input plaintext, the serialized string must have a length of 6+strlen(original), albeit: ["cache_data"]=> string(9277) "s:9309:"... (oops!) ["cache_data"]=> string(24259) "s:24248:"... (correct.) ["cache_data"]=> string(23850) "s:23881:"... (oops!) ["cache_data"]=> string(224081) "s:224069:"... (correct.) ["cache_data"]=> string(21055) "s:21107:"... (WTF!) ["cache_data"]=> string(19590) "s:19663:"... (wrong) ... http://scene-si.org/test.tgz - 800kb, contains 15Mb output of the reproduce code. http://193.77.198.80/phpinfo.php for phpinfo() Linux dahim 2.4.23-1-686 #1 Sun Nov 30 20:51:10 EST 2003 i686 GNU/Linux (thats the server this runs on). the funny part is, that this code (the same code to generate the entries in condor_dbcache) works also on other servers, also debian, iis, apache-win, redhat, mandrake, openbsd, freebsd.. it only fucked here.. after the serialize is done, the ONLY command it goes trough is mysql_escape_string, so there is no character or other conversions which could explain the wrong length in serialized() output Reproduce code: --- ";' ... but the content length is 9277.. the content was input with serialize in the following way: $content = serialize($content); mysql_query("update condor_dbcache set cache_timestamp='".time()."', cache_data='".mysql_escape_string($content)."' where cache_filename='".mysql_escape_string($filename)."'"); filename beeing the correspondant key to this dbcache table. -- Edit bug report at http://bugs.php.net/?id=27428&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27428&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27428&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27428&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27428&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27428&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27428&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27428&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=27428&r=support Expected behavior: http://bugs.php.net/fix.php?id=27428&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=27428&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=27428&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27428&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27428&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27428&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27428&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=27428&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27428&r=float
#10203 [Com]: foreach weakness
ID: 10203 Comment by: black at scene-si dot org Reported By: jack at mobil dot cz Status: Analyzed Bug Type: Feature/Change Request Operating System: all PHP Version: 4.0.4pl1 New Comment: just bumping this up, i guess someone would have to do it ;) foreach ($array as $key=>list($val1,$val2)) { .. } foreach ($array as list($val1,$val2)) { .. } the list should never take key values, the list should be only allowed in the right hand element making the following throw out an error: foreach ($array as list($k1,$k2)=>list($val1,$val2)) { .. } since afaik keys of tables are only 1 dimensional (not arrays). Previous Comments: [2002-01-29 04:19:59] [EMAIL PROTECTED] It's in TODO already :) Someone might implement it, but I guess it's not anytime soon. [2002-01-29 03:34:06] jack at mobil dot cz you haven't read the previous posts, have you? I think it's a general problem with list() construct, that you cannot use it everywhere you can use an L-value (or however you guys call it in PHP) [2002-01-28 20:45:41] [EMAIL PROTECTED] foreach ($arr as $key => $val) [2001-04-11 11:17:31] jack at mobil dot cz sure, I know I could use this way but I don't find it nice at all. [2001-04-06 14:42:55] [EMAIL PROTECTED] It's for someone else to decide whether to add this to the language, but until they do you can achieve the same effect with: $arr = array(array(1, 2), array(3, 4)); foreach ($arr as $narr) { list($a, $b) = array_values($narr); echo "$a, $b\n"; } BTW--it would have helped if you had explained what results you were after and not just the syntax you wanted. ;) 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 http://bugs.php.net/10203 -- Edit this bug report at http://bugs.php.net/?id=10203&edit=1
#24539 [Bgs]: key() in for loop "breaks" ?
ID: 24539 User updated by: black at scene-si dot org Reported By: black at scene-si dot org Status: Bogus Bug Type: Scripting Engine problem Operating System: linux debian PHP Version: 4.3.2 New Comment: [17:00:10] damn [17:00:11] i suck [17:00:16] * black|one repents Previous Comments: [2003-07-08 09:58:04] [EMAIL PROTECTED] <_Wez_> your for loop is equivalent to this: <_Wez_> reset($data); <_Wez_> while ($id = key($data)) { <_Wez_> var_dump($id); <_Wez_> next($data); <_Wez_> } ... your point? <_Wez_> $id = key($data) ==> 0 on the first iteration <_Wez_> while (0) { <_Wez_> } -------------------- [2003-07-08 09:53:42] black at scene-si dot org Description: replace key() with current() and you get the value with no problems, key() however doesnt work. the wierd part, sometimes the bellow code works, since i have 2 "identical" classes, one of which uses this method with key() - and makes correct results, however this short reproducable script doesnt. works: http://sunshine.krneki.org/files/halcyon/hal.phps doesnt: http://sunshine.krneki.org/files/halcyon/hal2.phps (search for 'reset', note that i have changed to use current in hal2.phps in the update function, so check out plot() which is still identical). cleaning up code is sometimes a b***h ;) Reproduce code: --- $data = array("foo","bar","x","y"); for (reset($data); $id=key($data); next($data)) { var_dump($id); } for (reset($data); $id=current($data); next($data)) { var_dump($id); } Expected result: int(0) int(1) int(2) int(3) string(3) "foo" string(3) "bar" string(1) "x" string(1) "y" Actual result: -- string(3) "foo" string(3) "bar" string(1) "x" string(1) "y" -- Edit this bug report at http://bugs.php.net/?id=24539&edit=1
#24539 [NEW]: key() in for loop "breaks" ?
From: black at scene-si dot org Operating system: linux debian PHP version: 4.3.2 PHP Bug Type: Scripting Engine problem Bug description: key() in for loop "breaks" ? Description: replace key() with current() and you get the value with no problems, key() however doesnt work. the wierd part, sometimes the bellow code works, since i have 2 "identical" classes, one of which uses this method with key() - and makes correct results, however this short reproducable script doesnt. works: http://sunshine.krneki.org/files/halcyon/hal.phps doesnt: http://sunshine.krneki.org/files/halcyon/hal2.phps (search for 'reset', note that i have changed to use current in hal2.phps in the update function, so check out plot() which is still identical). cleaning up code is sometimes a b***h ;) Reproduce code: --- $data = array("foo","bar","x","y"); for (reset($data); $id=key($data); next($data)) { var_dump($id); } for (reset($data); $id=current($data); next($data)) { var_dump($id); } Expected result: int(0) int(1) int(2) int(3) string(3) "foo" string(3) "bar" string(1) "x" string(1) "y" Actual result: -- string(3) "foo" string(3) "bar" string(1) "x" string(1) "y" -- Edit bug report at http://bugs.php.net/?id=24539&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24539&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24539&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24539&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24539&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24539&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24539&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=24539&r=support Expected behavior: http://bugs.php.net/fix.php?id=24539&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=24539&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=24539&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24539&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24539&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24539&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24539&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=24539&r=gnused