felipe          Mon Aug 11 00:46:14 2008 UTC

  Added files:                 
    /php-src/ext/reflection/tests       bug45765.phpt 

  Modified files:              
    /php-src/ext/reflection     php_reflection.c 
  Log:
  - Fixed bug #45765 (ReflectionObject with default parameters of self::xxx 
cause an error)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.309&r2=1.310&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.309 
php-src/ext/reflection/php_reflection.c:1.310
--- php-src/ext/reflection/php_reflection.c:1.309       Fri Aug  8 10:53:39 2008
+++ php-src/ext/reflection/php_reflection.c     Mon Aug 11 00:46:14 2008
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.309 2008/08/08 10:53:39 felixdv Exp $ */
+/* $Id: php_reflection.c,v 1.310 2008/08/11 00:46:14 felipe Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -644,7 +644,7 @@
                        *zv = precv->op2.u.constant;
                        zval_copy_ctor(zv);
                        INIT_PZVAL(zv);
-                       zval_update_constant(&zv, (void*)1 TSRMLS_CC);
+                       zval_update_constant_ex(&zv, (void*)1, 
fptr->common.scope TSRMLS_CC);
                        if (Z_TYPE_P(zv) == IS_BOOL) {
                                if (Z_LVAL_P(zv)) {
                                        string_write(str, "true", 
sizeof("true")-1);
@@ -5262,7 +5262,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Reflection", "enabled");
 
-       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.309 
2008/08/08 10:53:39 felixdv Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.310 
2008/08/11 00:46:14 felipe Exp $");
 
        php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug45765.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug45765.phpt
+++ php-src/ext/reflection/tests/bug45765.phpt
--TEST--
Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause 
an error)
--FILE--
<?php

class foo2 {
        const BAR = 'foobar';
}

class foo extends foo2 {
        const BAR = "foo's bar";
        
        function test($a = self::BAR) {
        }
        
        function test2($a = parent::BAR) {
        }

        function test3($a = foo::BAR) {
        }
        
        function test4($a = foo2::BAR) {
        }
}

ReflectionObject::export(new foo);

?>
--EXPECTF--
Object of class [ <user> class foo extends foo2 ] {
  @@ %s 7-21

  - Constants [1] {
    Constant [ Unicode string BAR ] { foo's bar }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Dynamic properties [0] {
  }

  - Methods [4] {
    Method [ <user> public method test ] {
      @@ %s 10 - 11

      - Parameters [1] {
        Parameter #0 [ <optional> $a = 'foo's bar' ]
      }
    }

    Method [ <user> public method test2 ] {
      @@ %s 13 - 14

      - Parameters [1] {
        Parameter #0 [ <optional> $a = 'foobar' ]
      }
    }

    Method [ <user> public method test3 ] {
      @@ %s 16 - 17

      - Parameters [1] {
        Parameter #0 [ <optional> $a = 'foo's bar' ]
      }
    }

    Method [ <user> public method test4 ] {
      @@ %s 19 - 20

      - Parameters [1] {
        Parameter #0 [ <optional> $a = 'foobar' ]
      }
    }
  }
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to