Bug #67672 [NEW]: const in trait differs and is considered incompatible
| From: | carschrotter at gmail dot com | Date: | Wed, 23 Jul 2014 20:12:27 +0000 |
| Subject: | Bug #67672 [NEW]: const in trait differs and is considered incompatible | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186790@lists.php.net to get a copy of this message | ||
From: carschrotter at gmail dot com
Operating system: Debian 8
PHP version: 5.6.0RC2
Package: *General Issues
Bug Type: Bug
Bug description:const in trait differs and is considered incompatible
Description:
------------
The use of a constant as a value results in an error. The direct contact
of the string not:
...
public static $staticvar = "Hello World";
....
Test script:
---------------
<?php
namespace {
const HELLO_WORLD = "Hello World";
trait TraitParent {
public static $staticvar = HELLO_WORLD;
public static function test() {
return self::$staticvar;
}
}
trait TraitChild {
use TraitParent;
}
Class ClassWhitChildTrait {
use TraitChild;
}
Class ClassWhitOverideChildTrait extends ClassWhitChildTrait {
use TraitParent;
}
echo ClassWhitChildTrait::test() . PHP_EOL;
echo ClassWhitOverideChildTrait::test();
}
--
Edit bug report at https://bugs.php.net/bug.php?id=67672&edit=1
--