Does anyone know how this works?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This works by unserializing objects. Unserializing in PHP does prevent the constructor to be called as the serialized object has been already constructed.
Create an object without calling it's constructor in PHP:
$className = 'stdClass'; # set classname here
$serialized = sprintf('O:%d:"%s":0:{}', strlen($className), $className);
$object = unserialize($serialized);
For more details please see this article: Doctrine 2: Give me my constructor back