From:
Operating system: CentOS kernel 2.6.18-164.11.1
PHP version: 5.3.2
Package: SPL related
Bug Type: Bug
Bug description:serializing an object that implements serializable
Description:
------------
Hello,
Create a class and implement Serializable, then use the serialize function
to return the value of serialize($this), apache crashes with an internal
server error, the apache error log reports a Premature end of script
headers error.
If line 17 is commented then the apache server does not crash.
Test script:
---------------
<?php
/**Simple class that is serializable and implements the serializable
interface */
class ImplementsSerializable implements Serializable {
/** returns the serialization of itself */
public function serialize() {
return serialize($this);
}
/** returns unserialized object passed in $serialized */
public function unserialize($serialized) {
return unserialize($serialized);
}
}
/** Create a new ImplementSerializable object */
$serializable = new ImplementsSerializable();
/** Store the serialized value in $serialized, this causes apache to crash,
with a
* Premature end of script headers error in the apache error log */
$serialized = $serializable->serialize();
/**point of execution does not reach here */
$unserialized = $serializable->unserialize($serialized);
echo "finished!";
?>
Expected result:
----------------
return value equal to the object serialized using the serialize function.
Actual result:
--------------
Apache crashes with internal server error and a Premature end of script
headers error.
--
Edit bug report at http://bugs.php.net/bug.php?id=51938&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51938&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51938&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=51938&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=51938&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=51938&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51938&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=51938&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=51938&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=51938&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=51938&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=51938&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=51938&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=51938&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51938&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51938&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51938&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=51938&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=51938&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=51938&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=51938&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=51938&r=mysqlcfg