File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / classes / constants_basic_006.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    1: --TEST--
    2: Ensure class constants are not evaluated when a class is looked up to resolve inheritance during runtime.
    3: --FILE--
    4: <?php
    5:   class C
    6:   {
    7:       const X = E::A;
    8:       public static $a = array(K => D::V, E::A => K);
    9:   }
   10:   
   11:   eval('class D extends C { const V = \'test\'; }');
   12:   
   13:   class E extends D
   14:   {
   15:       const A = "hello";
   16:   }
   17:   
   18:   define('K', "nasty");
   19:   
   20:   var_dump(C::X, C::$a, D::X, D::$a, E::X, E::$a);
   21: ?>
   22: --EXPECTF--
   23: string(5) "hello"
   24: array(2) {
   25:   ["nasty"]=>
   26:   string(4) "test"
   27:   ["hello"]=>
   28:   string(5) "nasty"
   29: }
   30: string(5) "hello"
   31: array(2) {
   32:   ["nasty"]=>
   33:   string(4) "test"
   34:   ["hello"]=>
   35:   string(5) "nasty"
   36: }
   37: string(5) "hello"
   38: array(2) {
   39:   ["nasty"]=>
   40:   string(4) "test"
   41:   ["hello"]=>
   42:   string(5) "nasty"
   43: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>