Bug #67672 [Opn->Dup]: const in trait differs and is considered incompatible
Edit report at https://bugs.php.net/bug.php?id=67672&edit=1
ID: 67672
Updated by: nikic@php.net
Reported by: carschrotter at gmail dot com
Summary: const in trait differs and is considered
incompatible
-Status: Open
+Status: Duplicate
Type: Bug
Package: *General Issues
Operating System: Debian 8
PHP Version: 5.6.0RC2
Block user comment: N
Private report: N
New Comment:
This has the same root cause as bug #74922, which is fixed in master.
Previous Comments:
------------------------------------------------------------------------
[2014-07-23 20:12:27] carschrotter at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=67672&edit=1
Thread (2 messages)