Bug #71044 [Opn->Nab]: Get class datetime

From: Date: Sun, 06 Dec 2015 21:36:17 +0000
Subject: Bug #71044 [Opn->Nab]: Get class datetime
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197644@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71044&edit=1 ID: 71044 Updated by: danack@php.net Reported by: fabien dot papet at gmail dot com Summary: Get class datetime -Status: Open +Status: Not a bug Type: Bug Package: *General Issues PHP Version: 5.5.30 Block user comment: N Private report: N New Comment: The '::class' construct is done purely at compile time, based of the apparent classname passed in. It does not check the spelling of the actual class name, or even that the class exists e.g. echo dAtEtImE::class; Output is "dAtEtImE" echo ThisDoesNotExist::class; Output is "ThisDoesNotExist" i.e. if you want var_dump(Datetime::class); to output a capital T, then spell it with a capital T. Previous Comments: ------------------------------------------------------------------------ [2015-12-06 17:26:27] fabien dot papet at gmail dot com Description: ------------ Get class and ::class different are not equal. (at least for Datetime object) http://stackoverflow.com/questions/34118725/diffence-between-class-and-get-class Test script: --------------- <?php // PHP 5.5 var_dump(get_class(new Datetime())); // string(8) "DateTime" var_dump(Datetime::class); // string(8) "Datetime" with lower t ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71044&edit=1

« previous php.bugs (#197644) next »