Bug #69691 [NEW]: ::class behaviour inside assertion

From: Date: Fri, 22 May 2015 09:09:57 +0000
Subject: Bug #69691 [NEW]: ::class behaviour inside assertion
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192821@lists.php.net to get a copy of this message
From: red dot led0 at gmail dot com Operating system: Linux PHP version: 5.6.9 Package: Class/Object related Bug Type: Bug Bug description:::class behaviour inside assertion Description: ------------ 'MyClass::class' construction works different inside and outside of assertion if namespace given. Test script: --------------- <?php namespace Test; // Without namespace works fine assert_options(ASSERT_ACTIVE, 1); class A { } class B extends A { } $test1 = $test2 = $name_a = $name_b = null; $test1 = is_subclass_of(B::class, A::class); assert('($test2 = is_subclass_of(B::class, A::class)) || 1'); assert('($name_a = A::class) || 1'); assert('($name_b = B::class) || 1'); var_dump($test1, $test2); var_dump(A::class, $name_a); var_dump(B::class, $name_b); Expected result: ---------------- bool(true) bool(true) string(6) "Test\A" string(6) "Test\A" string(6) "Test\B" string(6) "Test\B" Actual result: -------------- bool(true) bool(false) string(6) "Test\A" string(1) "A" string(6) "Test\B" string(1) "B" -- Edit bug report at https://bugs.php.net/bug.php?id=69691&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69691&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69691&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69691&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69691&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69691&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69691&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69691&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69691&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69691&r=support Expected behavior: https://bugs.php.net/fix.php?id=69691&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69691&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69691&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69691&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69691&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69691&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69691&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69691&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69691&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69691&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69691&r=mysqlcfg

« previous php.bugs (#192821) next »