Doc #69475 [Fbk->NoF]: Not clear get_class function behavior

From: Date: Sun, 03 May 2015 04:22:21 +0000
Subject: Doc #69475 [Fbk->NoF]: Not clear get_class function behavior
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12288@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69475&edit=1 ID: 69475 Updated by: php-bugs@lists.php.net Reported by: sergey-1987 at yandex dot ru Summary: Not clear get_class function behavior -Status: Feedback +Status: No Feedback Type: Documentation Problem Package: Reflection related PHP Version: 5.4.40 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2015-04-20 01:07:05] danack@php.net It says on the manual page: "NULL became the default value for object, so passing NULL to object now has the same result as not passing any value." and "If object is omitted when inside a class, the name of that class is returned." If that isn't clear enough please can you provide the text you think should be there, preferably as an edit to the manual, through clicking the edit button. ------------------------------------------------------------------------ [2015-04-17 10:12:43] sergey-1987 at yandex dot ru Description: ------------ --- From manual page: http://www.php.net/function.get-class --- Its not clear that get_class($someClassInstance) will return wrapper class name, instead of FALSE in case $someClassInstance = null. Test script: --------------- <?php class ModelFactory { public static function create($type) { switch ($type) { case 'ModelA': return new ModelA(); break; case 'ModelB': return new ModelB(); break; case 'ModelC': return new ModelC(); break; default: return null; } } } class Controller { function render($type) { $model = ModelFactory::create($type); $view = get_class($model); echo "View name = ".$view; } } $controller = new Controller(); $controller->render('ModelD'); Expected result: ---------------- View name = Actual result: -------------- View name = Controller ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69475&edit=1

« previous php.doc.bugs (#12288) next »