note 49576 added to language.oop5.autoload

From: Date: Wed, 02 Feb 2005 04:04:19 +0000
Subject: note 49576 added to language.oop5.autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-84353@lists.php.net to get a copy of this message
Be careful with using that eval() trick within __autoload(). If you use reflection in your code, the so called trick, *can* provide ill side effects. For example -> $reflection = new reflectionClass('some_class'); if (FALSE === $reflection->isSubClassOf('another_class')) { throw new Exception('Class "some_class" must extend base class "another_class"'); } If the real class "another_class" doesnt exist at the time, or "some_class" doesn't extend "another_class", with the reflection test, the so called eval() trick, creates a dummy "another_class", thereby making the reflection test useless... ---- Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49576 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49576&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49576&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49576&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49576&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49576&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49576&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84353) next »