cvs: ZendEngine2 / zend_compile.c zend_constants.c /tests constants_005.phpt

"Dmitry Stogov" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1217254392@cvsserver>
dmitry		Mon Jul 28 14:13:12 2008 UTC

  Modified files:              
    /ZendEngine2	zend_compile.c zend_constants.c 
    /ZendEngine2/tests	constants_005.phpt 
  Log:
  Fixed constant substitution (Matt)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.833&r2=1.834&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.833 ZendEngine2/zend_compile.c:1.834
--- ZendEngine2/zend_compile.c:1.833	Sat Jul 26 15:31:37 2008
+++ ZendEngine2/zend_compile.c	Mon Jul 28 14:13:12 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.833 2008/07/26 15:31:37 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.834 2008/07/28 14:13:12 dmitry Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -3972,15 +3972,13 @@
 		zstr lookup_name = zend_u_str_case_fold(Z_TYPE_P(const_name), Z_UNIVAL_P(const_name), Z_UNILEN_P(const_name), 1, &lookup_name_len);
 
 		if (zend_u_hash_find(EG(zend_constants), Z_TYPE_P(const_name), lookup_name, lookup_name_len+1, (void **) &c)==SUCCESS) {
-			if ((c->flags & CONST_CS) && memcmp(c->name.v, Z_UNIVAL_P(const_name).v, UG(unicode)?UBYTES(Z_USTRLEN_P(const_name)):Z_STRLEN_P(const_name))!=0) {
+			if ((c->flags & CONST_CT_SUBST) && !(c->flags & CONST_CS)) {
 				efree(lookup_name.v);
-				return NULL;
+				return c;
 			}
-		} else {
-			efree(lookup_name.v);
-			return NULL;
 		}
 		efree(lookup_name.v);
+		return NULL;
 	}
 	if (c->flags & CONST_CT_SUBST) {
 		return c;
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.c?r1=1.111&r2=1.112&diff_format=u
Index: ZendEngine2/zend_constants.c
diff -u ZendEngine2/zend_constants.c:1.111 ZendEngine2/zend_constants.c:1.112
--- ZendEngine2/zend_constants.c:1.111	Mon Jul 21 09:36:21 2008
+++ ZendEngine2/zend_constants.c	Mon Jul 28 14:13:12 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_constants.c,v 1.111 2008/07/21 09:36:21 bjori Exp $ */
+/* $Id: zend_constants.c,v 1.112 2008/07/28 14:13:12 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_constants.h"
@@ -278,7 +278,7 @@
 		lookup_name = zend_u_str_case_fold(type, name, name_len, 1, &lookup_name_len);
 
 		if (zend_u_hash_find(EG(zend_constants), type, lookup_name, lookup_name_len+1, (void **) &c)==SUCCESS) {
-			if ((c->flags & CONST_CS) && memcmp(c->name.v, name.v, UG(unicode)?UBYTES(name_len):name_len)!=0) {
+			if (c->flags & CONST_CS) {
 				retval=0;
 			}
 		} else {
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/constants_005.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/constants_005.phpt
diff -u /dev/null ZendEngine2/tests/constants_005.phpt:1.2
--- /dev/null	Mon Jul 28 14:13:12 2008
+++ ZendEngine2/tests/constants_005.phpt	Mon Jul 28 14:13:12 2008
@@ -0,0 +1,11 @@
+--TEST--
+Persistent case insensetive and user defined constants
+--FILE--
+<?php
+var_dump(ZEND_THREAD_safe);
+define("ZEND_THREAD_safe", 123);
+var_dump(ZEND_THREAD_safe);
+?>
+--EXPECTF--
+bool(%s)
+int(123)



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.