cvs: ZendEngine2(PHP_5_2) / zend_builtin_functions.c
"Ilia Alshanetsky" <[email protected]> Mon, 08 Jun 2009 13:34:45 -0000
| Newsgroups | gmane.comp.php.cvs.zend |
|---|---|
| Message-ID | <cvsiliaa1244468085@cvsserver> |
iliaa Mon Jun 8 13:34:45 2009 UTC
Modified files: (Branch: PHP_5_2)
/ZendEngine2 zend_builtin_functions.c
Log:
Re-apply patch with fixed build
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.277.2.12.2.37&r2=1.277.2.12.2.38&diff_format=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.37 ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.38
--- ZendEngine2/zend_builtin_functions.c:1.277.2.12.2.37 Mon Jun 8 13:09:30 2009
+++ ZendEngine2/zend_builtin_functions.c Mon Jun 8 13:34:45 2009
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.37 2009/06/08 13:09:30 tony2001 Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.277.2.12.2.38 2009/06/08 13:34:45 iliaa Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -461,6 +461,7 @@
zend_bool non_cs = 0;
int case_sensitive = CONST_CS;
zend_constant c;
+ char *p;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz|b", &name, &name_len, &val, &non_cs) == FAILURE) {
return;
@@ -470,6 +471,34 @@
case_sensitive = 0;
}
+ /* class constant, check if there is name and make sure class is valid & exists */
+ if ((p = zend_memnstr(name, "::", sizeof("::") - 1, name + name_len))) {
+ char *class_name;
+ int found;
+ zend_class_entry **ce;
+ ALLOCA_FLAG(use_heap)
+
+ if (p == (name + name_len - sizeof("::") + 1)) {
+ zend_error(E_WARNING, "Class constant must have a name");
+ RETURN_FALSE;
+ } else if (p == name) {
+ zend_error(E_WARNING, "Missing class name");
+ RETURN_FALSE;
+ }
+
+ class_name = do_alloca_with_limit((p - name + 1), use_heap);
+ zend_str_tolower_copy(class_name, name, (p - name));
+
+ found = zend_hash_find(EG(class_table), class_name, p - name + 1, (void **) &ce);
+
+ if (found != SUCCESS) {
+ zend_error(E_WARNING, "Class '%s' does not exists", class_name);
+ free_alloca_with_limit(class_name, use_heap);
+ RETURN_FALSE;
+ }
+ free_alloca_with_limit(class_name, use_heap);
+ }
+
repeat:
switch (Z_TYPE_P(val)) {
case IS_LONG:
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php