note 130058 added to class.php-incomplete-class

From: Date: Wed, 26 Feb 2025 10:16:41 +0000
Subject: note 130058 added to class.php-incomplete-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-221884@lists.php.net to get a copy of this message
You need to leverage the ArrayObject to access the name of an incomplete class. <?php $serialized = <<<END O:6:"Player":1:{s:12:"\000Player\000name";s:4:"John";} END; $player = unserialize($serialized); if ($player instanceof __PHP_Incomplete_Class) { $o = new ArrayObject($player); echo $o['__PHP_Incomplete_Class_Name']; // Player } ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 84.55.60.33) ---- Manual Page -- https://php.net/manual/en/class.php-incomplete-class.php Edit -- https://main.php.net/note/edit/130058 Del: integrated -- https://main.php.net/note/delete/130058/integrated Del: useless -- https://main.php.net/note/delete/130058/useless Del: bad code -- https://main.php.net/note/delete/130058/bad+code Del: spam -- https://main.php.net/note/delete/130058/spam Del: non-english -- https://main.php.net/note/delete/130058/non-english Del: in docs -- https://main.php.net/note/delete/130058/in+docs Del: other reasons-- https://main.php.net/note/delete/130058 Reject -- https://main.php.net/note/reject/130058 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221884) next »