Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_builtin_functions.c
[email protected] (Dmitry Stogov) Thu, 05 Mar 2009 12:39:28 +0300
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <[email protected]> |
Hi Ilia,
It can't be compiled.
Thanks. Dmitry.
Ilia Alshanetsky wrote:
> iliaa Tue Mar 3 23:43:06 2009 UTC
>
> Modified files:
> /ZendEngine2 zend_builtin_functions.c
> Log:
>
> MFB: Fixed bug #47549 (get_defined_constants() return array with broken
> array categories)
>
>
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_builtin_functions.c?r1=1.397&r2=1.398&diff_format=u
> Index: ZendEngine2/zend_builtin_functions.c
> diff -u ZendEngine2/zend_builtin_functions.c:1.397 ZendEngine2/zend_builtin_functions.c:1.398
> --- ZendEngine2/zend_builtin_functions.c:1.397 Sat Jan 10 19:14:27 2009
> +++ ZendEngine2/zend_builtin_functions.c Tue Mar 3 23:43:06 2009
> @@ -17,7 +17,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: zend_builtin_functions.c,v 1.397 2009/01/10 19:14:27 felipe Exp $ */
> +/* $Id: zend_builtin_functions.c,v 1.398 2009/03/03 23:43:06 iliaa Exp $ */
>
> #include "zend.h"
> #include "zend_API.h"
> @@ -25,6 +25,7 @@
> #include "zend_constants.h"
> #include "zend_ini.h"
> #include "zend_extensions.h"
> +#include <ctype.h>
>
> #undef ZEND_TEST_EXCEPTIONS
>
> @@ -626,6 +627,40 @@
> return;
> }
>
> + /* check if class constant */
> + if ((p = memchr(name, ':', name_len))) {
> + char *s = name;
> + zend_class_entry **ce;
> +
> + if (*(p + 1) != ':') { /* invalid constant specifier */
> + RETURN_FALSE;
> + } else if ((p + 2) >= (name + name_len)) { /* constant name length < 1 */
> + zend_error(E_WARNING, "Constants name cannot be empty");
> + RETURN_FALSE;
> + } else if (zend_lookup_class(s, (p - s), &ce TSRMLS_CC) != SUCCESS) { /* invalid class name */
> + zend_error(E_WARNING, "Class does not exists");
> + RETURN_FALSE;
> + } else { /* check of constant name contains invalid chars */
> + int ok = 1;
> + p += 2; /* move beyond :: to 1st char of constant's name */
> +
> + if (!isalpha(*p) && *p != '_') {
> + ok = 0;
> + }
> +
> + while (ok && *++p) {
> + if (!isalnum(*p) && *p != '_') {
> + ok = 0;
> + break;
> + }
> + }
> +
> + if (!ok) {
> + RETURN_FALSE;
> + }
> + }
> + }
> +
> if(non_cs) {
> case_sensitive = 0;
> }
> @@ -1885,7 +1920,8 @@
> module_names[0] = "internal";
> zend_hash_internal_pointer_reset_ex(&module_registry, &pos);
> while (zend_hash_get_current_data_ex(&module_registry, (void *) &module, &pos) != FAILURE) {
> - module_names[i++] = (char*)module->name;
> + module_names[module->module_number] = (char *)module->name;
> + i++;
> zend_hash_move_forward_ex(&module_registry, &pos);
> }
> module_names[i] = "user";
>
>
>