dmitry Thu Sep 8 07:10:36 2005 EDT
Modified files:
/ZendEngine2 zend_builtin_functions.c zend_constants.c
zend_constants.h zend_execute_API.c zend_vm_def.h
zend_vm_execute.h
/php-src/ext/standard basic_functions.c
Log:
Unicode support for PHP constants
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.292&r2=1.293&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.292
ZendEngine2/zend_builtin_functions.c:1.293
--- ZendEngine2/zend_builtin_functions.c:1.292 Thu Sep 1 06:04:56 2005
+++ ZendEngine2/zend_builtin_functions.c Thu Sep 8 07:10:27 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.292 2005/09/01 10:04:56 dmitry Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.293 2005/09/08 11:10:27 dmitry Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -558,7 +558,7 @@
}
convert_to_text_ex(var);
- if (zend_get_constant(Z_UNIVAL_PP(var), Z_UNILEN_PP(var), &c
TSRMLS_CC)) {
+ if (zend_u_get_constant(Z_TYPE_PP(var), Z_UNIVAL_PP(var),
Z_UNILEN_PP(var), &c TSRMLS_CC)) {
zval_dtor(&c);
RETURN_TRUE;
} else {
http://cvs.php.net/diff.php/ZendEngine2/zend_constants.c?r1=1.73&r2=1.74&ty=u
Index: ZendEngine2/zend_constants.c
diff -u ZendEngine2/zend_constants.c:1.73 ZendEngine2/zend_constants.c:1.74
--- ZendEngine2/zend_constants.c:1.73 Mon Aug 15 10:39:18 2005
+++ ZendEngine2/zend_constants.c Thu Sep 8 07:10:28 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_constants.c,v 1.73 2005/08/15 14:39:18 dmitry Exp $ */
+/* $Id: zend_constants.c,v 1.74 2005/09/08 11:10:28 dmitry Exp $ */
#include "zend.h"
#include "zend_constants.h"
@@ -214,19 +214,18 @@
}
-ZEND_API int zend_get_constant(char *name, uint name_len, zval *result
TSRMLS_DC)
+ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len,
zval *result TSRMLS_DC)
{
zend_constant *c;
int retval = 1;
char *lookup_name;
char *colon;
- zend_uchar type = UG(unicode)?IS_UNICODE:IS_STRING;
if ((UG(unicode) && (colon = (char*)u_memchr((UChar*)name, ':',
name_len)) && ((UChar*)colon)[1] == ':') ||
(!UG(unicode) && (colon = memchr(name, ':', name_len)) && colon[1]
== ':')) {
/* class constant */
zend_class_entry **ce = NULL, *scope;
- int class_name_len =
UG(unicode)?((colon-name)/sizeof(UChar)):colon-name;
+ int class_name_len =
UG(unicode)?((colon-(char*)name)/sizeof(UChar)):colon-(char*)name;
int const_name_len = name_len - class_name_len - 2;
char *constant_name = colon + (UG(unicode)?UBYTES(2):2);
zval **ret_constant;
@@ -310,6 +309,10 @@
return retval;
}
+ZEND_API int zend_get_constant(char *name, uint name_len, zval *result
TSRMLS_DC)
+{
+ return zend_u_get_constant(IS_STRING, name, name_len, result TSRMLS_CC);
+}
ZEND_API int zend_u_register_constant(zend_uchar type, zend_constant *c
TSRMLS_DC)
{
http://cvs.php.net/diff.php/ZendEngine2/zend_constants.h?r1=1.32&r2=1.33&ty=u
Index: ZendEngine2/zend_constants.h
diff -u ZendEngine2/zend_constants.h:1.32 ZendEngine2/zend_constants.h:1.33
--- ZendEngine2/zend_constants.h:1.32 Thu Aug 11 19:34:55 2005
+++ ZendEngine2/zend_constants.h Thu Sep 8 07:10:28 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_constants.h,v 1.32 2005/08/11 23:34:55 andrei Exp $ */
+/* $Id: zend_constants.h,v 1.33 2005/09/08 11:10:28 dmitry Exp $ */
#ifndef ZEND_CONSTANTS_H
#define ZEND_CONSTANTS_H
@@ -55,6 +55,7 @@
void zend_register_standard_constants(TSRMLS_D);
void clean_non_persistent_constants(TSRMLS_D);
ZEND_API int zend_get_constant(char *name, uint name_len, zval *result
TSRMLS_DC);
+ZEND_API int zend_u_get_constant(zend_uchar type, void *name, uint name_len,
zval *result TSRMLS_DC);
ZEND_API void zend_register_long_constant(char *name, uint name_len, long
lval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_double_constant(char *name, uint name_len, double
dval, int flags, int module_number TSRMLS_DC);
ZEND_API void zend_register_string_constant(char *name, uint name_len, char
*strval, int flags, int module_number TSRMLS_DC);
http://cvs.php.net/diff.php/ZendEngine2/zend_execute_API.c?r1=1.340&r2=1.341&ty=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.340
ZendEngine2/zend_execute_API.c:1.341
--- ZendEngine2/zend_execute_API.c:1.340 Fri Sep 2 03:46:30 2005
+++ ZendEngine2/zend_execute_API.c Thu Sep 8 07:10:28 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_execute_API.c,v 1.340 2005/09/02 07:46:30 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.341 2005/09/08 11:10:28 dmitry Exp $ */
#include <stdio.h>
#include <signal.h>
@@ -439,7 +439,7 @@
refcount = p->refcount;
is_ref = p->is_ref;
- if (!zend_get_constant(Z_UNIVAL_P(p), Z_UNILEN_P(p),
&const_value TSRMLS_CC)) {
+ if (!zend_u_get_constant(UG(unicode)?IS_UNICODE:IS_STRING,
Z_UNIVAL_P(p), Z_UNILEN_P(p), &const_value TSRMLS_CC)) {
zend_error(E_NOTICE, "Use of undefined constant %v -
assumed '%v'",
Z_UNIVAL_P(p),
Z_UNIVAL_P(p));
@@ -478,7 +478,7 @@
zend_hash_move_forward(p->value.ht);
continue;
}
- if (!zend_get_constant(str_index, str_index_len-1,
&const_value TSRMLS_CC)) {
+ if
(!zend_u_get_constant(UG(unicode)?IS_UNICODE:IS_STRING, str_index,
str_index_len-1, &const_value TSRMLS_CC)) {
zend_error(E_NOTICE, "Use of undefined constant
%v - assumed '%v'", str_index, str_index);
zend_hash_move_forward(p->value.ht);
continue;
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_def.h?r1=1.70&r2=1.71&ty=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.70 ZendEngine2/zend_vm_def.h:1.71
--- ZendEngine2/zend_vm_def.h:1.70 Wed Aug 24 16:42:08 2005
+++ ZendEngine2/zend_vm_def.h Thu Sep 8 07:10:28 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.70 2005/08/24 20:42:08 andrei Exp $ */
+/* $Id: zend_vm_def.h,v 1.71 2005/09/08 11:10:28 dmitry Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -2552,7 +2552,7 @@
}
}
*/
- if (!zend_get_constant(Z_UNIVAL(opline->op2.u.constant),
Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var
TSRMLS_CC)) {
+ if (!zend_u_get_constant(Z_TYPE(opline->op2.u.constant),
Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant),
&EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
zend_error(E_NOTICE, "Use of undefined constant %R -
assumed '%R'",
Z_TYPE(opline->op2.u.constant),
Z_UNIVAL(opline->op2.u.constant),
http://cvs.php.net/diff.php/ZendEngine2/zend_vm_execute.h?r1=1.73&r2=1.74&ty=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.73 ZendEngine2/zend_vm_execute.h:1.74
--- ZendEngine2/zend_vm_execute.h:1.73 Wed Aug 24 16:42:08 2005
+++ ZendEngine2/zend_vm_execute.h Thu Sep 8 07:10:28 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_execute.h,v 1.73 2005/08/24 20:42:08 andrei Exp $ */
+/* $Id: zend_vm_execute.h,v 1.74 2005/09/08 11:10:28 dmitry Exp $ */
static opcode_handler_t zend_user_opcode_handlers[256] =
{(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL};
@@ -15334,7 +15334,7 @@
}
}
*/
- if (!zend_get_constant(Z_UNIVAL(opline->op2.u.constant),
Z_UNILEN(opline->op2.u.constant), &EX_T(opline->result.u.var).tmp_var
TSRMLS_CC)) {
+ if (!zend_u_get_constant(Z_TYPE((opline->op2.u.constant)),
Z_UNIVAL(opline->op2.u.constant), Z_UNILEN(opline->op2.u.constant),
&EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
zend_error(E_NOTICE, "Use of undefined constant %R -
assumed '%R'",
Z_TYPE(opline->op2.u.constant),
Z_UNIVAL(opline->op2.u.constant),
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.731&r2=1.732&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.731
php-src/ext/standard/basic_functions.c:1.732
--- php-src/ext/standard/basic_functions.c:1.731 Tue Aug 23 05:33:45 2005
+++ php-src/ext/standard/basic_functions.c Thu Sep 8 07:10:34 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.731 2005/08/23 09:33:45 dmitry Exp $ */
+/* $Id: basic_functions.c,v 1.732 2005/09/08 11:10:34 dmitry Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1273,7 +1273,7 @@
}
convert_to_string_ex(const_name);
- if (!zend_get_constant(Z_STRVAL_PP(const_name),
Z_STRLEN_PP(const_name), return_value TSRMLS_CC)) {
+ if (!zend_u_get_constant(Z_TYPE_PP(const_name),
Z_STRVAL_PP(const_name), Z_STRLEN_PP(const_name), return_value TSRMLS_CC)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find
constant %s", Z_STRVAL_PP(const_name));
RETURN_NULL();
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php