]> granicus.if.org Git - php/commit
Bug #72663 - part 1
authorNikita Popov <nikic@php.net>
Mon, 8 Aug 2016 16:05:29 +0000 (18:05 +0200)
committerStanislav Malyshev <stas@php.net>
Wed, 17 Aug 2016 07:45:57 +0000 (00:45 -0700)
commit2135fdef9b588a34f8805b2bbf10704e36163d5a
tree77c5d2591425df1625893229e33027f71281bc35
parent0d13325b660b5ae64267dffcc9a153c7634fdfe2
Bug #72663 - part 1

Don't call __destruct() on an unserialized object that has a
__wakeup() method if either
a) unserialization of its properties fails or
b) the __wakeup() call fails (e.g. by throwing).

This basically treats __wakeup() as a form of constructor and
aligns us with the usual behavior that if the constructor call
fails the destructor should not be called.

The security aspect here is that people use __wakeup() to prevent
unserialization of objects with dangerous __destruct() methods,
but this is ineffective if __destruct() can still be called while
__wakeup() was skipped.
ext/standard/tests/serialize/bug72663.phpt [new file with mode: 0644]
ext/standard/var_unserializer.c
ext/standard/var_unserializer.re