Re: severe serialize problem
| From: | Timm Friebe | Date: | Thu, 22 May 2003 23:07:13 +0000 |
| Subject: | Re: severe serialize problem | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1920@lists.php.net to get a copy of this message | ||
On Fri, 2003-05-23 at 00:58, Timm Friebe wrote:
> On Fri, 2003-05-23 at 00:20, Timm Friebe wrote:
> > On Thu, 2003-05-22 at 23:44, Timm Friebe wrote:
> > [...]
> > > These patches to php_incomplete_class.h and var_unserializer.re, though
> > > not thoroughly tested, fix this.
> >
> > Here's a patch to php_incomplete_class.h with corrected whitespace. Some
> > lines were indented with spaces instead of tabs...
>
> While I'm at it: This patch also gets rid of memory leaks that occur
> when using the unserialize_callback_func ini directive.
And this one gets rid of *all* of them. Sorry for all the spam here:)
Test script used:
<?php
function autoload($fqcn) {
list($namespace, $class)= explode('::', $fqcn);
if ('power' == $namespace) {
eval('namespace '.$namespace.' { class '.$class.' {}}');
}
}
namespace Foo:Baz {
class Bar { }
}
class Baz { }
$bar= new Foo:Baz::Bar();
var_dump($bar, serialize($bar), unserialize(serialize($bar)));
$baz= new Baz();
var_dump(serialize($baz), unserialize(serialize($baz)));
var_dump(unserialize('O:7:"Binford":0:{}'));
ini_set('unserialize_callback_func', 'autoload');
var_dump(unserialize('O:14:"Power::Binford":0:{}'));
var_dump(unserialize('O:14:"Idiot::Binford":0:{}'));
?>
- Timm
Attachment: [text/x-patch] var_unserializer.re.diff
Attachment: [text/x-patch] var_unserializer.re.diff