#23951 [Ver->Csd]: Defines not working in inherited classes
| From: | wez@php.net | Date: | Mon, 09 Jun 2003 17:03:13 +0000 |
| Subject: | #23951 [Ver->Csd]: Defines not working in inherited classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-41543@lists.php.net to get a copy of this message | ||
ID: 23951
Updated by: wez@php.net
Reported By: sbecker at justseven dot de
-Status: Verified
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Linux 2.4
PHP Version: 4CVS-2003-06-02 (stable)
New Comment:
Fixed in CVS.
You can apply this patch to make it work for you, or try the next
stable snapshot.
http://www.php.net/~wez/define_inherit.diff
Previous Comments:
------------------------------------------------------------------------
[2003-06-04 17:37:54] wez@php.net
You can't use define()'s as constant scalar initializers; this
behaviour is documented in the manual somewhere.
To initialize the array that way, do it in your object constructor.
------------------------------------------------------------------------
[2003-06-02 06:05:39] derick@php.net
Interesting behavior... I could replicate this and it's definitely a
bug.
------------------------------------------------------------------------
[2003-06-02 06:01:29] sbecker at justseven dot de
This bug is in some way the same as reported in #14064.
I got the following code:
<?php
define('FOO1', 1);
define('FOO2', 2);
class A {
var $a_var = array(FOO1=>'foo1_value', FOO2=>'foo2_value');
}
class B extends A {
var $b_var = 'foo';
}
$a = new A;
$b = new B;
print_r($a);
print_r($b);
?>
Class A is doing fine but in Class B the Zend-Engine converts my
constants to strings, is that what you want?
-
Stefan
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23951&edit=1