#39836 [NEW]: SplObjectStorage empty after unserialize
From: doublecompile at gmail dot com Operating system: Win32 PHP version: 5.2.0 PHP Bug Type: SPL related Bug description: SplObjectStorage empty after unserialize Description: I serialized a SplObjectStorage instance containing several objects. After unserialization, the SplObjectStorage object contained nothing. It doesn't say in the SPL documentation that SplObjectStorage cannot be serialized. Reproduce code: --- example = 'testing'.$i; $storage->attach( $test ); } echo "Before: ".count($storage).""; $str = serialize($storage); $storage2 = unserialize( $str ); echo "After: ".count($storage2).""; ?> Expected result: Before: 5 After: 5 Actual result: -- Before: 5 After: 0 -- Edit bug report at http://bugs.php.net/?id=39836&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39836&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39836&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39836&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39836&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39836&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39836&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39836&r=needscript Try newer version:http://bugs.php.net/fix.php?id=39836&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39836&r=support Expected behavior:http://bugs.php.net/fix.php?id=39836&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39836&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39836&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39836&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39836&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39836&r=dst IIS Stability:http://bugs.php.net/fix.php?id=39836&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39836&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39836&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39836&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39836&r=mysqlcfg
#38508 [NEW]: Addition of Magic __toArray() function
From: doublecompile at gmail dot com Operating system: PHP version: 5.2.0RC2 PHP Bug Type: Feature/Change Request Bug description: Addition of Magic __toArray() function Description: Doing this: $newarray = (array)$object; will take the properties of an object and assign them as the values of keys in an array. As of PHP 5.2, doing this: $stringified = (string)$object; will call the magic __toString() function for a user-specified formatting of the object as a string. It would be a great addition to call a magic __toArray() function if an object is cast as an array, instead of converting its public members to array elements. (For instance, the class might not have public members). Classes without the function could use the default method of mapping property names to array keys. Just my two cents. Reproduce code: --- 'bar'); } } $test = new magicExample(); $array = (array)$test; print_r($array); // should show foo=>bar, not aoeu=>htns ?> -- Edit bug report at http://bugs.php.net/?id=38508&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38508&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38508&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38508&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38508&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38508&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38508&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=38508&r=needscript Try newer version:http://bugs.php.net/fix.php?id=38508&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38508&r=support Expected behavior:http://bugs.php.net/fix.php?id=38508&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38508&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38508&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38508&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38508&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38508&r=dst IIS Stability:http://bugs.php.net/fix.php?id=38508&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38508&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38508&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38508&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=38508&r=mysqlcfg
#37597 [Bgs->Opn]: Cannot stringify objects without __toString
ID: 37597 User updated by: doublecompile at gmail dot com Reported By: doublecompile at gmail dot com -Status: Bogus +Status: Open Bug Type: Strings related Operating System: * PHP Version: 5.2.* Assigned To: helly New Comment: Try this on for size: value = "1234"; $test2 = new test(); $test->value = "5678"; $test3 = new test(); $test->value = "7890"; $example = array( $test, $test2, $test3, $test3 ); $filtered = array_unique( $example ); ?> Outputs: Catchable fatal error: Object of class test could not be converted to string in ... Previous Comments: [2006-05-26 01:56:29] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The object id is not useable in any way. ---- [2006-05-26 01:49:53] doublecompile at gmail dot com Description: Attempting to stringify (casting, strval, echo) an instantiated class without a __toString() method results in the following error: Catchable fatal error: Object of class test could not be converted to string in... Built using php5.2-200605252230 Snap with the following config statement: './configure' '--with-mysql=/usr/local/php5/ext/mysql' '--with-pdo' '--with-pdo-mysql' '--with-apxs2=/usr/bin/apxs2' '--with-zlib' '--enable-bcmath' '--enable-calendar' '--with-gd=/usr' '--with-jpeg-dir=/usr/include' '--with-zlib-dir=/usr/include' '--with-png-dir=/usr/include' '--with-xpm-dir=/usr/include' '--with-freetype-dir=/usr/include' '--with-ldap' '--with-mcrypt' '--with-mhash' '--with-bz2' '--with-curl' '--enable-ftp' '--with-openssl' '--with-mysqli' '--enable-exif' '--enable-wddx' '--with-xsl' '--enable-sockets' '--enable-soap' '--with-pgsql=/usr/lib/postgresql' '--with-pdo-pgsql=/usr/lib/postgresql' '--with-sqlite' '--with-pdo-sqlite' '--with-ibm-db2=/home/db2inst1/sqllib' '--with-pdo-odbc=ibm-db2,/home/db2inst1/sqllib' '--enable-mbstring' '--with-gettext' Reproduce code: --- class test { } $test = new test(); // any of the following would produce the error $value = (string)$test; $value = strval($test); echo $test; Expected result: $value to be set to "Object #1" or the echo to output "Object #1" Actual result: -- Catchable fatal error: Object of class test could not be converted to string in... -- Edit this bug report at http://bugs.php.net/?id=37597&edit=1
#37597 [NEW]: Cannot stringify objects without __toString
From: doublecompile at gmail dot com Operating system: Ubuntu Linux 5.04 PHP version: 5CVS-2006-05-26 (snap) PHP Bug Type: Strings related Bug description: Cannot stringify objects without __toString Description: Attempting to stringify (casting, strval, echo) an instantiated class without a __toString() method results in the following error: Catchable fatal error: Object of class test could not be converted to string in... Built using php5.2-200605252230 Snap with the following config statement: './configure' '--with-mysql=/usr/local/php5/ext/mysql' '--with-pdo' '--with-pdo-mysql' '--with-apxs2=/usr/bin/apxs2' '--with-zlib' '--enable-bcmath' '--enable-calendar' '--with-gd=/usr' '--with-jpeg-dir=/usr/include' '--with-zlib-dir=/usr/include' '--with-png-dir=/usr/include' '--with-xpm-dir=/usr/include' '--with-freetype-dir=/usr/include' '--with-ldap' '--with-mcrypt' '--with-mhash' '--with-bz2' '--with-curl' '--enable-ftp' '--with-openssl' '--with-mysqli' '--enable-exif' '--enable-wddx' '--with-xsl' '--enable-sockets' '--enable-soap' '--with-pgsql=/usr/lib/postgresql' '--with-pdo-pgsql=/usr/lib/postgresql' '--with-sqlite' '--with-pdo-sqlite' '--with-ibm-db2=/home/db2inst1/sqllib' '--with-pdo-odbc=ibm-db2,/home/db2inst1/sqllib' '--enable-mbstring' '--with-gettext' Reproduce code: --- class test { } $test = new test(); // any of the following would produce the error $value = (string)$test; $value = strval($test); echo $test; Expected result: $value to be set to "Object #1" or the echo to output "Object #1" Actual result: -- Catchable fatal error: Object of class test could not be converted to string in... -- Edit bug report at http://bugs.php.net/?id=37597&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37597&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37597&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37597&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37597&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37597&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37597&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=37597&r=needscript Try newer version:http://bugs.php.net/fix.php?id=37597&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37597&r=support Expected behavior:http://bugs.php.net/fix.php?id=37597&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37597&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37597&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37597&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37597&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37597&r=dst IIS Stability:http://bugs.php.net/fix.php?id=37597&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37597&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37597&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37597&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=37597&r=mysqlcfg