johannes                Fri Feb 24 23:09:22 2006 UTC

  Added files:                 (Branch: PHP_5_1)
    /php-src/ext/reflection/tests       bug29986.phpt 

  Modified files:              
    /php-src/ext/reflection     php_reflection.c 
  Log:
  - MFH: Fix #29986 (Class constants won't work with predefined constants when
    using ReflectionClass)
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.25&r2=1.164.2.26&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.25 
php-src/ext/reflection/php_reflection.c:1.164.2.26
--- php-src/ext/reflection/php_reflection.c:1.164.2.25  Mon Feb 20 23:33:32 2006
+++ php-src/ext/reflection/php_reflection.c     Fri Feb 24 23:09:22 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.25 2006/02/20 23:33:32 johannes Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.26 2006/02/24 23:09:22 johannes Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -352,6 +352,7 @@
 
        /* Constants */
        if (&ce->constants_table) {
+               zend_hash_apply_with_argument(&ce->constants_table, 
(apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
                string_printf(str, "\n");
                count = zend_hash_num_elements(&ce->constants_table);
                string_printf(str, "%s  - Constants [%d] {\n", indent, count);
@@ -4329,7 +4330,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.164.2.25 2006/02/20 23:33:32 johannes Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 
1.164.2.26 2006/02/24 23:09:22 johannes Exp $");
 
        php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewcvs.cgi/php-src/ext/reflection/tests/bug29986.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug29986.phpt
+++ php-src/ext/reflection/tests/bug29986.phpt
--TEST--
Reflection::export
--SKIPIF--
<?php extension_loaded('reflection') or die('skip'); ?>
--FILE--
<?php
class just_constants
{
    const BOOLEAN_CONSTANT = true;
    const NULL_CONSTANT = null;
    const STRING_CONSTANT = 'This is a string';
    const INTEGER_CONSTANT = 1000;
    const FLOAT_CONSTANT = 3.14159265;
}

Reflection::export(new ReflectionClass('just_constants'));
?>
--EXPECTF--
Class [ <user> class just_constants ] {
  @@ %s

  - Constants [5] {
    Constant [ boolean BOOLEAN_CONSTANT ] { }
    Constant [ null NULL_CONSTANT ] { }
    Constant [ native string STRING_CONSTANT ] { }
    Constant [ integer INTEGER_CONSTANT ] { }
    Constant [ double FLOAT_CONSTANT ] { }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}
--UEXPECTF--
Class [ <user> class just_constants ] {
  @@ %s

  - Constants [5] {
    Constant [ boolean BOOLEAN_CONSTANT ] { }
    Constant [ null NULL_CONSTANT ] { }
    Constant [ Unicode string STRING_CONSTANT ] { }
    Constant [ integer INTEGER_CONSTANT ] { }
    Constant [ double FLOAT_CONSTANT ] { }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}

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

Reply via email to