]> granicus.if.org Git - php/commitdiff
Fix #41640 (get_class_vars produces error on class constants)
authorJohannes Schlüter <johannes@php.net>
Sat, 9 Jun 2007 08:38:44 +0000 (08:38 +0000)
committerJohannes Schlüter <johannes@php.net>
Sat, 9 Jun 2007 08:38:44 +0000 (08:38 +0000)
NEWS
Zend/tests/bug41640.phpt [new file with mode: 0644]
Zend/zend_builtin_functions.c

diff --git a/NEWS b/NEWS
index dd632c5718f618aa84ba26b0a12ab3ca5f82d8ce..7f299024ff001cac649ad75764e5d46a417c5f08 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,8 @@ PHP                                                                        NEWS
 - Fixed money_format() not to accept multiple %i or %n tokens. (Stas, Ilia)
 - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory 
   already exists). (Pierre)
+- Fixed bug #41640 (get_class_vars produces error on class constants).
+  (Johannes)
 - Fixed bug #41630 (segfault when an invalid color index is present in
   the image data). (Reported by Elliot <wccoder@gmail dot com>) (Pierre)
 - Fixed bug #41608 (segfault on a weird code with objects and switch()). 
diff --git a/Zend/tests/bug41640.phpt b/Zend/tests/bug41640.phpt
new file mode 100644 (file)
index 0000000..c859d90
--- /dev/null
@@ -0,0 +1,15 @@
+--TEST--
+Bug #41640 (get_class_vars produces error on class constants)
+--FILE--
+<?php
+class foo {
+        const FOO = 1;
+        public $x = self::FOO;
+}
+
+var_dump(get_class_vars("foo"));
+--EXPECT--
+array(1) {
+  ["x"]=>
+  int(1)
+}
index 0ce917d3274f3cde01062aee494d44a26e0f11cd..785709f51b13747be05b6e8b50d205d3a4d05fb3 100644 (file)
@@ -770,8 +770,8 @@ ZEND_FUNCTION(get_class_vars)
                RETURN_FALSE;
        } else {
                array_init(return_value);
-               add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
                zend_update_class_constants(*pce TSRMLS_CC);
+               add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
                add_class_vars(*pce, CE_STATIC_MEMBERS(*pce), return_value TSRMLS_CC);
        }
 }