|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-13 17:49 UTC] dave dot a dot roberts at gmail dot com
Description: ------------ I have an object I created from class Post. $p = new Post(); get_class($p) will return the class Post. After I assign a variable to the class using the magic method __set $p->datereceived = "1234"; get_class($p) will return stdClass. Test script: --------------- $p = new Post(); print(get_class($p)); // returns Post $p->datereceived = "1234"; print(get_class($p)); // returns stdClass. Expected result: ---------------- The classname of Post should be returned twice. Actual result: -------------- Post is returned the first time, stdClass is returned the second time. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 13:00:01 2025 UTC |
Please provide a complete reproduction script, preferably (well) under 50 lines of code. For the record, I can't reproduce this with the following script: <?php class C { public function __set($name, $value) { $this->$name = $value; } } $c = new C; var_dump(get_class($c)); $c->foo = 'bar'; var_dump(get_class($c)); ?>