felipe                                   Thu, 13 May 2010 02:13:30 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299320

Log:
- Fixed bug #51791 (constant() aborts execution when fail to check undefined 
constant)

Bug: http://bugs.php.net/51791 (Verified) constant() aborts execution when fail 
to check undefined constant
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    A   php/php-src/branches/PHP_5_3/Zend/tests/bug51791.phpt
    U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
    A   php/php-src/trunk/Zend/tests/bug51791.phpt
    U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-13 01:59:20 UTC (rev 299319)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-13 02:13:30 UTC (rev 299320)
@@ -50,6 +50,8 @@
   requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert)
 - Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas)

+- Fixed bug #51791 (constant() aborts execution when fail to check undefined
+  constant). (Felipe)
 - Fixed bug #51732 (Fileinfo __construct or open does not work with NULL).
   (Pierre)
 - Fixed bug #51725 (xmlrpc_get_type() returns true on invalid dates). (Mike)

Added: php/php-src/branches/PHP_5_3/Zend/tests/bug51791.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/tests/bug51791.phpt                       
        (rev 0)
+++ php/php-src/branches/PHP_5_3/Zend/tests/bug51791.phpt       2010-05-13 
02:13:30 UTC (rev 299320)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #51791 (constant() failed to check undefined constant and php interpreter 
stoped)
+--FILE--
+<?php
+
+class A  {
+    const B = 1;
+}
+var_dump(constant('A::B1'));
+
+?>
+--EXPECTF--
+Warning: constant(): Couldn't find constant A::B1 in %s on line %d
+NULL


Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug51791.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-05-13 
01:59:20 UTC (rev 299319)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-05-13 
02:13:30 UTC (rev 299320)
@@ -3826,7 +3826,7 @@
                return;
        }

-       if (!zend_get_constant_ex(const_name, const_name_len, return_value, 
NULL, 0 TSRMLS_CC)) {
+       if (!zend_get_constant_ex(const_name, const_name_len, return_value, 
NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find 
constant %s", const_name);
                RETURN_NULL();
        }

Added: php/php-src/trunk/Zend/tests/bug51791.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/bug51791.phpt                          (rev 0)
+++ php/php-src/trunk/Zend/tests/bug51791.phpt  2010-05-13 02:13:30 UTC (rev 
299320)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #51791 (constant() failed to check undefined constant and php interpreter 
stoped)
+--FILE--
+<?php
+
+class A  {
+    const B = 1;
+}
+var_dump(constant('A::B1'));
+
+?>
+--EXPECTF--
+Warning: constant(): Couldn't find constant A::B1 in %s on line %d
+NULL


Property changes on: php/php-src/trunk/Zend/tests/bug51791.phpt
___________________________________________________________________
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===================================================================
--- php/php-src/trunk/ext/standard/basic_functions.c    2010-05-13 01:59:20 UTC 
(rev 299319)
+++ php/php-src/trunk/ext/standard/basic_functions.c    2010-05-13 02:13:30 UTC 
(rev 299320)
@@ -3771,7 +3771,7 @@
                return;
        }

-       if (!zend_get_constant_ex(const_name, const_name_len, return_value, 
NULL, 0 TSRMLS_CC)) {
+       if (!zend_get_constant_ex(const_name, const_name_len, return_value, 
NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find 
constant %s", const_name);
                RETURN_NULL();
        }

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

Reply via email to