#29865 [Com]: serialize produces invalid output
ID: 29865 Comment by: jhargis at gmail dot com Reported By: [EMAIL PROTECTED] Status: No Feedback Bug Type: Strings related Operating System: * PHP Version: 5CVS-2005-03-07 Assigned To: derick New Comment: Can confirm this as being corrected and working in 5.0.5 as well. Previous Comments: [2005-09-20 01:00:02] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". [2005-09-12 08:40:18] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip [2005-07-14 22:40:00] php dot net at sharpdreams dot com Still busted in recent CVS, win32 & FreeBSD. Seems to work in 5.0.4. This ought to be fixed before the next b3, or at least prior to release of 5.1. [2005-01-22 13:57:12] [EMAIL PROTECTED] This is still a problem in the latest head, simple test case: $ ./php5_1 -r 'class Foo { protected $bar = 1; } $v = new Foo; echo serialize($v);' | hexdump 000 3a4f 3a33 4622 6f6f 3a22 3a31 737b 363a 010 223a 2a00 6200 7261 3b22 3a69 3b31 007d 01f [2005-01-06 20:23:42] jhargis at gmail dot com I have noticed similar. username; } } $ob_User = New User(); $wUser = serialize($ob_User); echo $wUser; $wUser2 = unserialize($wUser); echo $wUser2->getU() . "\n"; ?> Protected/private members appear to have the 0x00 bytes around the notation. For the time, I base64 the serialized string so I can store it in the DB without having to deal with it as a binary. Also, this may be related to why when using WDDX as the serialization handler it only picks up the last member var when you need implement __sleep. 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/29865 -- Edit this bug report at http://bugs.php.net/?id=29865&edit=1
#29865 [Com]: serialize produces invalid output
ID: 29865 Comment by: jhargis at gmail dot com Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Strings related Operating System: N/A PHP Version: 5CVS-2004-08-27 (dev) New Comment: I have noticed similar. username; } } $ob_User = New User(); $wUser = serialize($ob_User); echo $wUser; $wUser2 = unserialize($wUser); echo $wUser2->getU() . "\n"; ?> Protected/private members appear to have the 0x00 bytes around the notation. For the time, I base64 the serialized string so I can store it in the DB without having to deal with it as a binary. Also, this may be related to why when using WDDX as the serialization handler it only picks up the last member var when you need implement __sleep. Previous Comments: [2004-08-27 13:37:32] [EMAIL PROTECTED] Description: Using serialize() with a class produces invalid output. Reproduce code: --- I haven't had a chance to properly investigate why this particular code causes a problem, but Derick seemed ontop of it already. priv_member = $val; } function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } function comp_func_key($a, $b) { if ($a === $b) return 0; return ($a > $b)? 1:-1; } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),); $result = array_udiff_uassoc($a, $b, array("cr", "comp_func_cr"), array("cr", "comp_func_key")); $foo = serialize($result); echo $foo; ?> Actual result: -- 61 3a 33 3a 7b 73 3a 33 3a 22 30 2e 31 22 3b 4f a:3:{s:3 :"0.1";O 0010 3a 32 3a 22 63 72 22 3a 31 3a 7b 73 3a 31 35 3a :2:"cr": 1:{s:15: 0020 22 00 63 72 00 70 72 69 76 5f 6d 65 6d 62 65 72 ".cr.pri v_member 0030 22 3b 69 3a 39 3b 7d 73 3a 33 3a 22 30 2e 35 22 ";i:9;}s :3:"0.5" 0040 3b 4f 3a 32 3a 22 63 72 22 3a 31 3a 7b 73 3a 31 ;O:2:"cr ":1:{s:1 0050 35 3a 22 00 63 72 00 70 72 69 76 5f 6d 65 6d 62 5:".cr.p riv_memb 0060 65 72 22 3b 69 3a 31 32 3b 7d 69 3a 30 3b 4f 3a er";i:12 ;}i:0;O: 0070 32 3a 22 63 72 22 3a 31 3a 7b 73 3a 31 35 3a 22 2:"cr":1 :{s:15:" 0080 00 63 72 00 70 72 69 76 5f 6d 65 6d 62 65 72 22 .cr.priv _member" 0090 3b 69 3a 32 33 3b 7d 7d;i:23;}} As you can see from this hexdump, there are 0 bytes being produced. This should not happen. -- Edit this bug report at http://bugs.php.net/?id=29865&edit=1
#31304 [NEW]: Exceptions in destructor cause non descript fatal
From: jhargis at gmail dot com Operating system: Debian Linux 2.4.27-1-386 PHP version: 5.0.3 PHP Bug Type: Output Control Bug description: Exceptions in destructor cause non descript fatal Description: When the destructor issues an exception, it goes unhandled (obviously), however tossing a fatal does not seem like the appropriate course of action. Fatal error: Exception thrown without a stack frame in Unknown on line 0 Reproduce code: --- Expected result: A warning? Something other than a non descriptive fatal. -- Edit bug report at http://bugs.php.net/?id=31304&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31304&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31304&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31304&r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=31304&r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=31304&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31304&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31304&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31304&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31304&r=support Expected behavior: http://bugs.php.net/fix.php?id=31304&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31304&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31304&r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=31304&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31304&r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=31304&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31304&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31304&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31304&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31304&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31304&r=mysqlcfg