Bug #75126 [Com]: get_class returns the Class Name with namespace
| From: | Wes dot example at example dot org | Date: | Sun, 27 Aug 2017 18:59:33 +0000 |
| Subject: | Bug #75126 [Com]: get_class returns the Class Name with namespace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210839@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75126&edit=1
ID: 75126
Comment by: Wes dot example at example dot org
Reported by: raylee dot stu at gmail dot com
Summary: get_class returns the Class Name with namespace
Status: Open
Type: Bug
Package: Class/Object related
Operating System: Window10.16253.rs3_release
PHP Version: 7.1.8
Block user comment: N
Private report: N
New Comment:
add a test script that actually works. get_class didn't change in decades
Previous Comments:
------------------------------------------------------------------------
[2017-08-27 18:46:34] raylee dot stu at gmail dot com
Description:
------------
get_class in the versions before 7.1.8 returns only the class name, but now prefixed with namespace.
A option should be added in get_class([[object $object],[bool $include_namespace]])
Test script:
---------------
<?php
namespace db\update\watcher;
class Foo {
public function get_class_name(){
echo get_class($this);
}
}
// outputs
// db\update\watcher\Foo;
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75126&edit=1