Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31830 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95780 invoked by uid 1010); 22 Aug 2007 10:07:14 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95765 invoked from network); 22 Aug 2007 10:07:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Aug 2007 10:07:14 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:40867] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/A0-12037-ECA0CC64 for ; Wed, 22 Aug 2007 06:07:13 -0400 Received: (qmail 28631 invoked from network); 22 Aug 2007 10:07:05 -0000 Received: from internal.zend.office (HELO thinkpad) (10.1.1.1) by internal.zend.office with SMTP; 22 Aug 2007 10:07:05 -0000 To: "'PHP Internals List'" Date: Wed, 22 Aug 2007 14:07:02 +0400 Message-ID: <001601c7e4a4$3038b260$6e02a8c0@thinkpad> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0017_01C7E4C5.B74A5260" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 Importance: Normal In-Reply-To: <000c01c7e49b$1b54baf0$6e02a8c0@thinkpad> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 Subject: RE: [PHP-DEV] Constans in namesapces From: dmitry@zend.com ("Dmitry Stogov") References: <000c01c7e49b$1b54baf0$6e02a8c0@thinkpad> ------=_NextPart_000_0017_01C7E4C5.B74A5260 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sorry, The patch was removed. Resending it. Dmitry. > -----Original Message----- > From: Dmitry Stogov [mailto:dmitry@zend.com] > Sent: Wednesday, August 22, 2007 1:02 PM > To: 'PHP Internals List' > Subject: [PHP-DEV] Constans in namesapces > > > Hi, > > The proposed patch implements namespace support for > constants. It allows to declare constants in namespaces in > the same way as in classes. And these constants may be used > in the same may as namespaces' functions. > > namespace Foo; > const BAR = 5; > var_dump(BAR); > ?> > > include "foo.php"; > var_dump(Foo::BAR); > ?> > > I am going to commit this patch on Friday. > Any objections? > > Thanks. Dmitry. > > ------=_NextPart_000_0017_01C7E4C5.B74A5260 Content-Type: text/plain; name="const-17.diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="const-17.diff.txt" Index: Zend/zend.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend.c,v=0A= retrieving revision 1.399=0A= diff -u -p -d -r1.399 zend.c=0A= --- Zend/zend.c 21 Jul 2007 00:34:41 -0000 1.399=0A= +++ Zend/zend.c 22 Aug 2007 08:27:42 -0000=0A= @@ -696,7 +696,7 @@ static void zend_set_default_compile_tim=0A= =0A= static void zval_copy_persistent(zval *zv) /* {{{ */=0A= {=0A= - if (Z_TYPE_P(zv) =3D=3D IS_STRING || Z_TYPE_P(zv) =3D=3D IS_CONSTANT) {=0A= + if (Z_TYPE_P(zv) =3D=3D IS_STRING || (Z_TYPE_P(zv) & = IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT) {=0A= UChar *ustr;=0A= =0A= ustr =3D malloc(UBYTES(Z_STRLEN_P(zv)+1));=0A= @@ -783,7 +783,7 @@ static void const_to_unicode(zend_consta=0A= free(c->name.s);=0A= c->name.u =3D uname;=0A= }=0A= - if (Z_TYPE(c->value) =3D=3D IS_STRING || Z_TYPE(c->value) =3D=3D = IS_CONSTANT) {=0A= + if (Z_TYPE(c->value) =3D=3D IS_STRING || (Z_TYPE(c->value) & = IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT) {=0A= UChar *ustr;=0A= =0A= ustr =3D malloc(UBYTES(Z_STRLEN(c->value)+1));=0A= Index: Zend/zend.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend.h,v=0A= retrieving revision 1.335=0A= diff -u -p -d -r1.335 zend.h=0A= --- Zend/zend.h 21 Jul 2007 05:27:06 -0000 1.335=0A= +++ Zend/zend.h 22 Aug 2007 08:27:42 -0000=0A= @@ -467,7 +467,9 @@ typedef int (*zend_write_func_t)(const c=0A= #define IS_UNICODE 10=0A= =0A= /* Ugly hack to support constants as static array indices */=0A= -#define IS_CONSTANT_INDEX 0x80=0A= +#define IS_CONSTANT_TYPE_MASK 0x0f=0A= +#define IS_CONSTANT_RT_NS_CHECK 0x10=0A= +#define IS_CONSTANT_INDEX 0x80=0A= =0A= =0A= /* overloaded elements data types */=0A= Index: Zend/zend_builtin_functions.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_builtin_functions.c,v=0A= retrieving revision 1.347=0A= diff -u -p -d -r1.347 zend_builtin_functions.c=0A= --- Zend/zend_builtin_functions.c 8 Aug 2007 13:32:58 -0000 1.347=0A= +++ Zend/zend_builtin_functions.c 22 Aug 2007 08:27:42 -0000=0A= @@ -575,7 +575,7 @@ ZEND_FUNCTION(defined)=0A= }=0A= =0A= convert_to_text_ex(var);=0A= - if (zend_u_get_constant(Z_TYPE_PP(var), Z_UNIVAL_PP(var), = Z_UNILEN_PP(var), &c, NULL TSRMLS_CC)) {=0A= + if (zend_u_get_constant_ex(Z_TYPE_PP(var), Z_UNIVAL_PP(var), = Z_UNILEN_PP(var), &c, NULL, 0 TSRMLS_CC)) {=0A= zval_dtor(&c);=0A= RETURN_TRUE;=0A= } else {=0A= @@ -772,7 +772,7 @@ static void add_class_vars(zend_class_en=0A= =0A= /* this is necessary to make it able to work with default array=0A= * properties, returned to user */=0A= - if (Z_TYPE_P(prop_copy) =3D=3D IS_CONSTANT_ARRAY || = Z_TYPE_P(prop_copy) =3D=3D IS_CONSTANT) {=0A= + if (Z_TYPE_P(prop_copy) =3D=3D IS_CONSTANT_ARRAY || = (Z_TYPE_P(prop_copy) & IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT) {=0A= zval_update_constant(&prop_copy, 0 TSRMLS_CC);=0A= }=0A= =0A= Index: Zend/zend_compile.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_compile.c,v=0A= retrieving revision 1.764=0A= diff -u -p -d -r1.764 zend_compile.c=0A= --- Zend/zend_compile.c 22 Aug 2007 07:39:37 -0000 1.764=0A= +++ Zend/zend_compile.c 22 Aug 2007 08:27:42 -0000=0A= @@ -3691,7 +3691,7 @@ void zend_do_end_new_object(znode *resul=0A= }=0A= /* }}} */=0A= =0A= -static int zend_constant_ct_subst(znode *result, zval *const_name = TSRMLS_DC) /* {{{ */=0A= +static zend_constant* zend_get_ct_const(zval *const_name TSRMLS_DC) /* = {{{ */=0A= {=0A= zend_constant *c =3D NULL;=0A= =0A= @@ -3701,14 +3701,27 @@ static int zend_constant_ct_subst(znode =0A= =0A= if (zend_u_hash_find(EG(zend_constants), Z_TYPE_P(const_name), = lookup_name, lookup_name_len+1, (void **) &c)=3D=3DSUCCESS) {=0A= 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))!=3D0)= {=0A= - c =3D NULL;=0A= + efree(lookup_name.v);=0A= + return NULL;=0A= }=0A= } else {=0A= - c =3D NULL;=0A= + efree(lookup_name.v);=0A= + return NULL;=0A= }=0A= efree(lookup_name.v);=0A= }=0A= - if (c && (c->flags & CONST_CT_SUBST)) {=0A= + if (c->flags & CONST_CT_SUBST) {=0A= + return c;=0A= + }=0A= + return NULL;=0A= +}=0A= +/* }}} */=0A= +=0A= +static int zend_constant_ct_subst(znode *result, zval *const_name = TSRMLS_DC) /* {{{ */=0A= +{=0A= + zend_constant *c =3D zend_get_ct_const(const_name TSRMLS_CC);=0A= +=0A= + if (c) {=0A= zval_dtor(const_name);=0A= result->op_type =3D IS_CONST;=0A= result->u.constant =3D c->value;=0A= @@ -3720,44 +3733,110 @@ static int zend_constant_ct_subst(znode =0A= }=0A= /* }}} */=0A= =0A= -void zend_do_fetch_constant(znode *result, znode *constant_container, = znode *constant_name, int mode TSRMLS_DC) /* {{{ */=0A= +void zend_do_fetch_constant(znode *result, znode *constant_container, = znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC) /* = {{{ */=0A= {=0A= + ulong fetch_type =3D 0;=0A= + znode tmp;=0A= +=0A= switch (mode) {=0A= case ZEND_CT:=0A= if (constant_container) {=0A= - ulong fetch_type;=0A= -=0A= if (ZEND_FETCH_CLASS_DEFAULT =3D=3D = zend_get_class_fetch_type(Z_TYPE(constant_container->u.constant), = Z_UNIVAL(constant_container->u.constant), = Z_UNILEN(constant_container->u.constant))) {=0A= zend_resolve_class_name(constant_container, &fetch_type, 1 = TSRMLS_CC);=0A= }=0A= zend_do_fetch_class_name(NULL, constant_container, constant_name = TSRMLS_CC);=0A= *result =3D *constant_container;=0A= - result->u.constant.type =3D IS_CONSTANT;=0A= + result->u.constant.type =3D IS_CONSTANT | fetch_type;=0A= } else if (!zend_constant_ct_subst(result, = &constant_name->u.constant TSRMLS_CC)) {=0A= + if (check_namespace && CG(current_namespace)) {=0A= + /* We assume we use constant from the current namespace=0A= + if it is not prefixed. */=0A= + tmp.op_type =3D IS_CONST;=0A= + tmp.u.constant =3D *CG(current_namespace);=0A= + zval_copy_ctor(&tmp.u.constant);=0A= + zend_do_build_namespace_name(&tmp, &tmp, constant_name TSRMLS_CC);=0A= + *constant_name =3D tmp;=0A= + fetch_type =3D IS_CONSTANT_RT_NS_CHECK;=0A= + }=0A= *result =3D *constant_name;=0A= - result->u.constant.type =3D IS_CONSTANT;=0A= + result->u.constant.type =3D IS_CONSTANT | fetch_type;=0A= }=0A= break;=0A= case ZEND_RT:=0A= if (constant_container ||=0A= !zend_constant_ct_subst(result, &constant_name->u.constant = TSRMLS_CC)) {=0A= zend_op *opline;=0A= - znode class_node;=0A= =0A= if (constant_container) {=0A= - zend_do_fetch_class(&class_node, constant_container TSRMLS_CC);=0A= + if (constant_container->op_type =3D=3D IS_CONST &&=0A= + ZEND_FETCH_CLASS_DEFAULT =3D=3D = zend_get_class_fetch_type(Z_TYPE(constant_container->u.constant), = Z_UNIVAL(constant_container->u.constant), = Z_UNILEN(constant_container->u.constant))) {=0A= + zend_resolve_class_name(constant_container, &fetch_type, 1 = TSRMLS_CC);=0A= + } else {=0A= + zend_do_fetch_class(&tmp, constant_container TSRMLS_CC);=0A= + constant_container =3D &tmp;=0A= + }=0A= + } else if (check_namespace && CG(current_namespace)) {=0A= + /* We assume we use constant from the current namespace=0A= + if it is not prefixed. */=0A= + tmp.op_type =3D IS_CONST;=0A= + tmp.u.constant =3D *CG(current_namespace);=0A= + zval_copy_ctor(&tmp.u.constant);=0A= + constant_container =3D &tmp;=0A= + fetch_type =3D IS_CONSTANT_RT_NS_CHECK;=0A= }=0A= opline =3D get_next_op(CG(active_op_array) TSRMLS_CC);=0A= opline->opcode =3D ZEND_FETCH_CONSTANT;=0A= + opline->extended_value =3D fetch_type & = ~ZEND_FETCH_CLASS_RT_NS_NAME;=0A= opline->result.op_type =3D IS_TMP_VAR;=0A= opline->result.u.var =3D = get_temporary_variable(CG(active_op_array));=0A= if (constant_container) {=0A= - opline->op1 =3D class_node;=0A= + opline->op1 =3D *constant_container;=0A= } else {=0A= SET_UNUSED(opline->op1);=0A= }=0A= opline->op2 =3D *constant_name;=0A= *result =3D opline->result;=0A= +=0A= + if (opline->op1.op_type =3D=3D IS_CONST) {=0A= + /* Prebuild ns::func name to speedup run-time check.=0A= + The additional names are stored in additional OP_DATA opcode. */=0A= + zstr nsname;=0A= + unsigned int nsname_len;=0A= +=0A= + opline =3D get_next_op(CG(active_op_array) TSRMLS_CC);=0A= + opline->opcode =3D ZEND_OP_DATA;=0A= + opline->op1.op_type =3D IS_CONST;=0A= + SET_UNUSED(opline->op2);=0A= +=0A= + nsname =3D Z_UNIVAL(constant_container->u.constant);=0A= + nsname_len =3D Z_UNILEN(constant_container->u.constant);=0A= + if (fetch_type & ZEND_FETCH_CLASS_RT_NS_NAME) {=0A= + /* Remove namespace name */=0A= + if (Z_TYPE(constant_container->u.constant) =3D=3D IS_UNICODE) {=0A= + nsname.u =3D u_memchr(nsname.u, ':', nsname_len) + 2;=0A= + nsname_len -=3D (nsname.u - = Z_USTRVAL(constant_container->u.constant));=0A= + } else {=0A= + nsname.s =3D memchr(nsname.s, ':', nsname_len) + 2;=0A= + nsname_len -=3D (nsname.s - = Z_STRVAL(constant_container->u.constant));=0A= + }=0A= + }=0A= +=0A= + Z_TYPE(opline->op1.u.constant) =3D = Z_TYPE(constant_container->u.constant);=0A= + Z_UNIVAL(opline->op1.u.constant) =3D = zend_u_str_case_fold(Z_TYPE(constant_container->u.constant), nsname, = nsname_len, 0, &Z_UNILEN(opline->op1.u.constant));=0A= + if (UG(unicode)) {=0A= + Z_USTRVAL(opline->op1.u.constant) =3D = erealloc(Z_USTRVAL(opline->op1.u.constant), = UBYTES(Z_USTRLEN(opline->op1.u.constant) + 2 + = Z_USTRLEN(constant_name->u.constant) + 1));=0A= + = Z_USTRVAL(opline->op1.u.constant)[Z_USTRLEN(opline->op1.u.constant)] =3D = ':';=0A= + = Z_USTRVAL(opline->op1.u.constant)[Z_USTRLEN(opline->op1.u.constant)+1] = =3D ':';=0A= + = memcpy(Z_USTRVAL(opline->op1.u.constant)+Z_USTRLEN(opline->op1.u.constant= )+2, Z_USTRVAL(constant_name->u.constant), = UBYTES(Z_USTRLEN(constant_name->u.constant) + 1));=0A= + } else {=0A= + Z_STRVAL(opline->op1.u.constant) =3D = erealloc(Z_STRVAL(opline->op1.u.constant), = Z_STRLEN(opline->op1.u.constant) + 2 + = Z_STRLEN(constant_name->u.constant) + 1);=0A= + = Z_STRVAL(opline->op1.u.constant)[Z_STRLEN(opline->op1.u.constant)] =3D = ':';=0A= + = Z_STRVAL(opline->op1.u.constant)[Z_STRLEN(opline->op1.u.constant)+1] =3D = ':';=0A= + = memcpy(Z_STRVAL(opline->op1.u.constant)+Z_STRLEN(opline->op1.u.constant)+= 2, Z_STRVAL(constant_name->u.constant), = Z_STRLEN(constant_name->u.constant) + 1);=0A= + }=0A= + Z_UNILEN(opline->op1.u.constant) +=3D 2 + = Z_UNILEN(constant_name->u.constant);=0A= + opline->extended_value =3D = zend_u_hash_func(Z_TYPE(opline->op1.u.constant), = Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant) + 1);=0A= + }=0A= }=0A= break;=0A= }=0A= @@ -3846,7 +3925,7 @@ void zend_do_add_static_array_element(zn=0A= if (offset) {=0A= zend_uchar utype =3D Z_TYPE(offset->u.constant);=0A= =0A= - switch (Z_TYPE(offset->u.constant)) {=0A= + switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) {=0A= case IS_CONSTANT:=0A= /* Ugly hack to denote that this value has a constant index */=0A= Z_TYPE_P(element) |=3D IS_CONSTANT_INDEX;=0A= @@ -5051,6 +5130,37 @@ void zend_do_import(znode *ns_name, znod=0A= }=0A= /* }}} */=0A= =0A= +void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC) /* = {{{ */=0A= +{=0A= + zend_op *opline;=0A= +=0A= + if (zend_get_ct_const(&name->u.constant TSRMLS_CC)) {=0A= + zend_error(E_COMPILE_ERROR, "Cannot redeclare constant '%R'", = Z_TYPE(name->u.constant), Z_UNIVAL(name->u.constant));=0A= + }=0A= +=0A= + if (CG(current_namespace)) {=0A= + /* Prefix constant name with name of current namespace */=0A= + znode tmp;=0A= + zstr lcname;=0A= + uint lcname_len;=0A= +=0A= + tmp.op_type =3D IS_CONST;=0A= + tmp.u.constant =3D *CG(current_namespace);=0A= + lcname =3D zend_u_str_case_fold(Z_TYPE(tmp.u.constant), = Z_UNIVAL(tmp.u.constant), Z_UNILEN(tmp.u.constant), 0, &lcname_len);=0A= + Z_UNIVAL(tmp.u.constant) =3D lcname;=0A= + Z_UNILEN(tmp.u.constant) =3D lcname_len;=0A= + zend_do_build_namespace_name(&tmp, &tmp, name TSRMLS_CC);=0A= + *name =3D tmp;=0A= + }=0A= +=0A= + opline =3D get_next_op(CG(active_op_array) TSRMLS_CC);=0A= + opline->opcode =3D ZEND_DECLARE_CONST;=0A= + SET_UNUSED(opline->result);=0A= + opline->op1 =3D *name;=0A= + opline->op2 =3D *value;=0A= +}=0A= +/* }}} */=0A= +=0A= void zend_do_end_compilation(TSRMLS_D) /* {{{ */=0A= {=0A= if (CG(current_namespace)) {=0A= Index: Zend/zend_compile.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_compile.h,v=0A= retrieving revision 1.363=0A= diff -u -p -d -r1.363 zend_compile.h=0A= --- Zend/zend_compile.h 20 Aug 2007 09:48:41 -0000 1.363=0A= +++ Zend/zend_compile.h 22 Aug 2007 08:27:43 -0000=0A= @@ -470,7 +470,7 @@ void zend_do_pop_object(znode *object TS=0A= void zend_do_begin_new_object(znode *new_token, znode *class_type = TSRMLS_DC);=0A= void zend_do_end_new_object(znode *result, znode *new_token, znode = *argument_list TSRMLS_DC);=0A= =0A= -void zend_do_fetch_constant(znode *result, znode *constant_container, = znode *constant_name, int mode TSRMLS_DC);=0A= +void zend_do_fetch_constant(znode *result, znode *constant_container, = znode *constant_name, int mode, zend_bool check_namespace TSRMLS_DC);=0A= =0A= void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC);=0A= =0A= @@ -519,6 +519,7 @@ void zend_do_ticks(TSRMLS_D);=0A= =0A= void zend_do_abstract_method(znode *function_name, znode *modifiers, = znode *body TSRMLS_DC);=0A= =0A= +void zend_do_declare_constant(znode *name, znode *value TSRMLS_DC);=0A= void zend_do_build_namespace_name(znode *result, znode *prefix, znode = *name TSRMLS_DC);=0A= void zend_do_namespace(znode *name TSRMLS_DC);=0A= void zend_do_import(znode *name, znode *new_name TSRMLS_DC);=0A= Index: Zend/zend_constants.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_constants.c,v=0A= retrieving revision 1.97=0A= diff -u -p -d -r1.97 zend_constants.c=0A= --- Zend/zend_constants.c 27 Jul 2007 16:29:25 -0000 1.97=0A= +++ Zend/zend_constants.c 22 Aug 2007 08:27:43 -0000=0A= @@ -258,21 +258,88 @@ ZEND_API void zend_register_string_const=0A= }=0A= /* }}} */=0A= =0A= -ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint = name_len, zval *result, zend_class_entry *scope TSRMLS_DC) /* {{{ */=0A= +ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint = name_len, zval *result TSRMLS_DC) /* {{{ */=0A= {=0A= zend_constant *c;=0A= int retval =3D 1;=0A= zstr lookup_name;=0A= +=0A= + if (zend_u_hash_find(EG(zend_constants), type, name, name_len+1, (void = **) &c) =3D=3D FAILURE) {=0A= + unsigned int lookup_name_len;=0A= +=0A= + lookup_name =3D zend_u_str_case_fold(type, name, name_len, 1, = &lookup_name_len);=0A= +=0A= + if (zend_u_hash_find(EG(zend_constants), type, lookup_name, = lookup_name_len+1, (void **) &c)=3D=3DSUCCESS) {=0A= + if ((c->flags & CONST_CS) && memcmp(c->name.v, name.v, = UG(unicode)?UBYTES(name_len):name_len)!=3D0) {=0A= + retval=3D0;=0A= + }=0A= + } else {=0A= + if (!EG(in_execution)) {=0A= + retval =3D 0;=0A= + } else if (name_len =3D=3D sizeof(ZEND_HALT_CONSTANT_NAME)-1 && = ZEND_U_EQUAL(type, name, name_len, ZEND_HALT_CONSTANT_NAME, = sizeof(ZEND_HALT_CONSTANT_NAME)-1)) {=0A= + char *cfilename;=0A= + zstr haltname;=0A= + int len, clen;=0A= + cfilename =3D zend_get_executed_filename(TSRMLS_C);=0A= + clen =3D strlen(cfilename);=0A= + /* check for __COMPILER_HALT_OFFSET__ */=0A= + zend_mangle_property_name(&haltname.s, &len, = ZEND_HALT_CONSTANT_NAME,=0A= + sizeof(ZEND_HALT_CONSTANT_NAME) - 1, cfilename, clen, 0);=0A= + if (zend_u_hash_find(EG(zend_constants), IS_STRING, haltname, = len+1, (void **) &c) =3D=3D SUCCESS) {=0A= + retval=3D1;=0A= + } else {=0A= + retval=3D0;=0A= + }=0A= + pefree(haltname.s, 0);=0A= + } else {=0A= + retval=3D0;=0A= + }=0A= + }=0A= + efree(lookup_name.v);=0A= + }=0A= +=0A= + if (retval) {=0A= + *result =3D c->value;=0A= + zval_copy_ctor(result);=0A= + result->refcount =3D 1;=0A= + result->is_ref =3D 0;=0A= + }=0A= +=0A= + return retval;=0A= +}=0A= +/* }}} */=0A= +=0A= +ZEND_API int zend_u_get_constant_ex(zend_uchar type, zstr name, uint = name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC) = /* {{{ */=0A= +{=0A= + zend_constant *c;=0A= + int retval =3D 1;=0A= zstr colon;=0A= =0A= + /* Skip leading :: */=0A= + if (type =3D=3D IS_UNICODE &&=0A= + name.u[0] =3D=3D ':' &&=0A= + name.u[1] =3D=3D ':') {=0A= + name.u +=3D 2;=0A= + name_len -=3D 2;=0A= + flags =3D 0;=0A= + } else if (type =3D=3D IS_STRING &&=0A= + name.s[0] =3D=3D ':' &&=0A= + name.s[1] =3D=3D ':') {=0A= + name.s +=3D 2;=0A= + name_len -=3D 2;=0A= + flags =3D 0;=0A= + }=0A= +=0A= if ((UG(unicode) && (colon.u =3D u_memrchr(name.u, ':', name_len)) && = colon.u > name.u && *(colon.u-1) =3D=3D ':') ||=0A= (!UG(unicode) && (colon.s =3D zend_memrchr(name.s, ':', = name_len))&& colon.s > name.s && *(colon.s-1) =3D=3D ':')) {=0A= - /* class constant */=0A= + /* compound constant name */=0A= zend_class_entry **ce =3D NULL;=0A= int class_name_len =3D UG(unicode)?colon.u-name.u-1:colon.s-name.s-1;=0A= int const_name_len =3D name_len - class_name_len - 2;=0A= zstr constant_name, class_name;=0A= zval **ret_constant;=0A= + zstr lcname;=0A= + unsigned int lcname_len;=0A= =0A= if (UG(unicode)) {=0A= constant_name.u =3D colon.u + 1;=0A= @@ -294,16 +361,19 @@ ZEND_API int zend_u_get_constant(zend_uc=0A= class_name.s =3D estrndup(name.s, class_name_len);=0A= }=0A= =0A= - if (class_name_len =3D=3D sizeof("self")-1 &&=0A= - ZEND_U_EQUAL(type, class_name, class_name_len, "self", = sizeof("self")-1)) {=0A= + lcname =3D zend_u_str_case_fold(type, class_name, class_name_len, 0, = &lcname_len);=0A= +=0A= + if (lcname_len =3D=3D sizeof("self")-1 &&=0A= + ZEND_U_EQUAL(type, lcname, lcname_len, "self", sizeof("self")-1)) = {=0A= if (scope) {=0A= ce =3D &scope;=0A= } else {=0A= zend_error(E_ERROR, "Cannot access self:: when no class scope is = active");=0A= retval =3D 0;=0A= }=0A= - } else if (class_name_len =3D=3D sizeof("parent")-1 &&=0A= - ZEND_U_EQUAL(type, class_name, class_name_len, "parent", = sizeof("parent")-1)) {=0A= + efree(lcname.v);=0A= + } else if (lcname_len =3D=3D sizeof("parent")-1 &&=0A= + ZEND_U_EQUAL(type, lcname, lcname_len, "parent", = sizeof("parent")-1)) {=0A= if (!scope) {=0A= zend_error(E_ERROR, "Cannot access parent:: when no class scope is = active");=0A= } else if (!scope->parent) {=0A= @@ -311,14 +381,57 @@ ZEND_API int zend_u_get_constant(zend_uc=0A= } else {=0A= ce =3D &scope->parent;=0A= }=0A= + efree(lcname.v);=0A= } else {=0A= - if (zend_u_lookup_class(type, class_name, class_name_len, &ce = TSRMLS_CC) !=3D SUCCESS) {=0A= + /* Check for namespace constant */=0A= + zstr nsname;=0A= + unsigned int nsname_len;=0A= +=0A= + /* Concatenate lowercase namespace name and constant name */=0A= + if (UG(unicode)) {=0A= + lcname.u =3D erealloc(lcname.u, UBYTES(lcname_len + 2 + = const_name_len + 1));=0A= + lcname.u[lcname_len] =3D ':';=0A= + lcname.u[lcname_len+1] =3D ':';=0A= + memcpy(lcname.u+lcname_len+2, constant_name.u, = UBYTES(const_name_len + 1));=0A= + } else {=0A= + lcname.s =3D erealloc(lcname.s, lcname_len + 2 + const_name_len + = 1);=0A= + lcname.s[lcname_len] =3D ':';=0A= + lcname.s[lcname_len+1] =3D ':';=0A= + memcpy(lcname.s+lcname_len+2, constant_name.s, const_name_len + 1);=0A= + }=0A= + lcname_len +=3D 2 + const_name_len;=0A= +=0A= + nsname =3D lcname;=0A= + nsname_len =3D lcname_len;=0A= + if (flags & ZEND_FETCH_CLASS_RT_NS_NAME) {=0A= + /* Remove namespace name */=0A= + if (UG(unicode)) {=0A= + nsname.u =3D u_memchr(nsname.u, ':', nsname_len) + 2;=0A= + nsname_len -=3D (nsname.u - lcname.u);=0A= + } else {=0A= + nsname.s =3D memchr(nsname.s, ':', nsname_len) + 2;=0A= + nsname_len -=3D (nsname.s - lcname.s);=0A= + }=0A= + }=0A= +=0A= + if (zend_u_hash_find(EG(zend_constants), type, nsname, nsname_len+1, = (void **) &c) =3D=3D SUCCESS) {=0A= + efree(lcname.v);=0A= + efree(class_name.v);=0A= + *result =3D c->value;=0A= + zval_update_constant_ex(&result, (void*)1, NULL TSRMLS_CC);=0A= + zval_copy_ctor(result);=0A= + result->refcount =3D 1;=0A= + result->is_ref =3D 0;=0A= + return 1;=0A= + }=0A= + efree(lcname.v);=0A= +=0A= + /* Check for class */=0A= + if (zend_u_lookup_class(type, class_name, class_name_len, &ce = TSRMLS_CC) !=3D SUCCESS &&=0A= + (flags & ZEND_FETCH_CLASS_RT_NS_CHECK) !=3D 0) {=0A= retval =3D 0;=0A= if ((UG(unicode) && (colon.u =3D u_memrchr(class_name.u, ':', = class_name_len)) && colon.u > class_name.u && *(colon.u-1) =3D=3D ':') ||=0A= (!UG(unicode) && (colon.s =3D zend_memrchr(class_name.s, ':', = class_name_len))&& colon.s > class_name.s && *(colon.s-1) =3D=3D ':')) {=0A= - zend_class_entry **pce;=0A= - zstr lcname;=0A= - unsigned int lcname_len;=0A= =0A= if (UG(unicode)) {=0A= colon.u++;=0A= @@ -342,7 +455,16 @@ ZEND_API int zend_u_get_constant(zend_uc=0A= retval =3D 0;=0A= }=0A= } else {=0A= - zend_error(E_ERROR, "Class '%R' not found", type, class_name);=0A= + if ((flags & ZEND_FETCH_CLASS_RT_NS_NAME) =3D=3D 0) {=0A= + if ((flags & IS_CONSTANT_RT_NS_CHECK) !=3D 0) {=0A= + name =3D constant_name;=0A= + name_len =3D const_name_len;=0A= + efree(class_name.v);=0A= + retval =3D 1;=0A= + return zend_u_get_constant(type, name, name_len, result TSRMLS_CC);=0A= + }=0A= + zend_error(E_ERROR, "Class '%R' not found", type, class_name);=0A= + }=0A= retval =3D 0;=0A= }=0A= efree(class_name.v);=0A= @@ -356,54 +478,13 @@ ZEND_API int zend_u_get_constant(zend_uc=0A= return retval;=0A= }=0A= =0A= - if (zend_u_hash_find(EG(zend_constants), type, name, name_len+1, (void = **) &c) =3D=3D FAILURE) {=0A= - unsigned int lookup_name_len;=0A= -=0A= - lookup_name =3D zend_u_str_case_fold(type, name, name_len, 1, = &lookup_name_len);=0A= -=0A= - if (zend_u_hash_find(EG(zend_constants), type, lookup_name, = lookup_name_len+1, (void **) &c)=3D=3DSUCCESS) {=0A= - if ((c->flags & CONST_CS) && memcmp(c->name.v, name.v, = UG(unicode)?UBYTES(name_len):name_len)!=3D0) {=0A= - retval=3D0;=0A= - }=0A= - } else {=0A= - if (!EG(in_execution)) {=0A= - retval =3D 0;=0A= - } else if (name_len =3D=3D sizeof(ZEND_HALT_CONSTANT_NAME)-1 && = ZEND_U_EQUAL(type, name, name_len, ZEND_HALT_CONSTANT_NAME, = sizeof(ZEND_HALT_CONSTANT_NAME)-1)) {=0A= - char *cfilename;=0A= - zstr haltname;=0A= - int len, clen;=0A= - cfilename =3D zend_get_executed_filename(TSRMLS_C);=0A= - clen =3D strlen(cfilename);=0A= - /* check for __COMPILER_HALT_OFFSET__ */=0A= - zend_mangle_property_name(&haltname.s, &len, = ZEND_HALT_CONSTANT_NAME,=0A= - sizeof(ZEND_HALT_CONSTANT_NAME) - 1, cfilename, clen, 0);=0A= - if (zend_u_hash_find(EG(zend_constants), IS_STRING, haltname, = len+1, (void **) &c) =3D=3D SUCCESS) {=0A= - retval=3D1;=0A= - } else {=0A= - retval=3D0;=0A= - }=0A= - pefree(haltname.s, 0);=0A= - } else {=0A= - retval=3D0;=0A= - }=0A= - }=0A= - efree(lookup_name.v);=0A= - }=0A= -=0A= - if (retval) {=0A= - *result =3D c->value;=0A= - zval_copy_ctor(result);=0A= - result->refcount =3D 1;=0A= - result->is_ref =3D 0;=0A= - }=0A= -=0A= - return retval;=0A= + return zend_u_get_constant(type, name, name_len, result TSRMLS_CC);=0A= }=0A= /* }}} */=0A= =0A= ZEND_API int zend_get_constant(char *name, uint name_len, zval *result = TSRMLS_DC) /* {{{ */=0A= {=0A= - return zend_u_get_constant(IS_STRING, ZSTR(name), name_len, result, = NULL TSRMLS_CC);=0A= + return zend_u_get_constant_ex(IS_STRING, ZSTR(name), name_len, result, = NULL, 0 TSRMLS_CC);=0A= }=0A= /* }}} */=0A= =0A= @@ -461,7 +542,7 @@ ZEND_API int zend_register_constant(zend=0A= free(c->name.s);=0A= c->name.u =3D ustr;=0A= }=0A= - if (Z_TYPE(c->value) =3D=3D IS_STRING || Z_TYPE(c->value) =3D=3D = IS_CONSTANT) {=0A= + if (Z_TYPE(c->value) =3D=3D IS_STRING || (Z_TYPE(c->value) & = IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT) {=0A= ustr =3D pemalloc(UBYTES(Z_STRLEN(c->value)+1), c->flags & = CONST_PERSISTENT);=0A= u_charsToUChars(Z_STRVAL(c->value), ustr, Z_STRLEN(c->value)+1);=0A= pefree(Z_STRVAL(c->value), c->flags & CONST_PERSISTENT);=0A= Index: Zend/zend_constants.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_constants.h,v=0A= retrieving revision 1.40=0A= diff -u -p -d -r1.40 zend_constants.h=0A= --- Zend/zend_constants.h 3 Aug 2007 18:41:07 -0000 1.40=0A= +++ Zend/zend_constants.h 22 Aug 2007 08:27:43 -0000=0A= @@ -56,7 +56,8 @@ int zend_shutdown_constants(TSRMLS_D);=0A= void zend_register_standard_constants(TSRMLS_D);=0A= void clean_non_persistent_constants(TSRMLS_D);=0A= ZEND_API int zend_get_constant(char *name, uint name_len, zval *result = TSRMLS_DC);=0A= -ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint = name_len, zval *result, zend_class_entry *scope TSRMLS_DC);=0A= +ZEND_API int zend_u_get_constant(zend_uchar type, zstr name, uint = name_len, zval *result TSRMLS_DC);=0A= +ZEND_API int zend_u_get_constant_ex(zend_uchar type, zstr name, uint = name_len, zval *result, zend_class_entry *scope, ulong flags TSRMLS_DC);=0A= ZEND_API void zend_register_long_constant(char *name, uint name_len, = long lval, int flags, int module_number TSRMLS_DC);=0A= ZEND_API void zend_register_double_constant(char *name, uint name_len, = double dval, int flags, int module_number TSRMLS_DC);=0A= ZEND_API void zend_register_string_constant(char *name, uint name_len, = char *strval, int flags, int module_number TSRMLS_DC);=0A= Index: Zend/zend_execute_API.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_execute_API.c,v=0A= retrieving revision 1.412=0A= diff -u -p -d -r1.412 zend_execute_API.c=0A= --- Zend/zend_execute_API.c 22 Aug 2007 07:39:37 -0000 1.412=0A= +++ Zend/zend_execute_API.c 22 Aug 2007 08:27:43 -0000=0A= @@ -485,10 +485,11 @@ ZEND_API int zval_update_constant_ex(zva=0A= zend_bool inline_change =3D (zend_bool) (zend_uintptr_t) arg;=0A= zval const_value;=0A= zstr colon;=0A= + int len;=0A= =0A= if (IS_CONSTANT_VISITED(p)) {=0A= zend_error(E_ERROR, "Cannot declare self-referencing constant '%v'", = Z_UNIVAL_P(p));=0A= - } else if (Z_TYPE_P(p) =3D=3D IS_CONSTANT) {=0A= + } else if ((Z_TYPE_P(p) & IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT) {=0A= int refcount;=0A= zend_uchar is_ref;=0A= =0A= @@ -500,10 +501,15 @@ ZEND_API int zval_update_constant_ex(zva=0A= refcount =3D p->refcount;=0A= is_ref =3D p->is_ref;=0A= =0A= - if (!zend_u_get_constant(ZEND_STR_TYPE, Z_UNIVAL_P(p), Z_UNILEN_P(p), = &const_value, scope TSRMLS_CC)) {=0A= - if ((UG(unicode) && (colon.u =3D u_memchr(Z_USTRVAL_P(p), ':', = Z_USTRLEN_P(p))) && colon.u[1] =3D=3D ':') ||=0A= - (!UG(unicode) && (colon.s =3D memchr(Z_STRVAL_P(p), ':', = Z_STRLEN_P(p))) && colon.s[1] =3D=3D ':')) {=0A= - zend_error(E_ERROR, "Undefined class constant '%v'", Z_UNIVAL_P(p));=0A= + if (!zend_u_get_constant_ex(ZEND_STR_TYPE, Z_UNIVAL_P(p), = Z_UNILEN_P(p), &const_value, scope, Z_TYPE_P(p) TSRMLS_CC)) {=0A= + if ((UG(unicode) && (colon.u =3D u_memrchr(Z_USTRVAL_P(p), ':', = Z_USTRLEN_P(p))) && colon.u > Z_USTRVAL_P(p) && *(colon.u-1) =3D=3D ':') = ||=0A= + (!UG(unicode) && (colon.s =3D zend_memrchr(Z_STRVAL_P(p), ':', = Z_STRLEN_P(p))) && colon.s > Z_STRVAL_P(p) && *(colon.s-1) =3D=3D ':')) {=0A= + if (UG(unicode)) {=0A= + colon.u++;=0A= + } else {=0A= + colon.s++;=0A= + }=0A= + zend_error(E_ERROR, "Undefined class constant '%v'", colon);=0A= }=0A= zend_error(E_NOTICE, "Use of undefined constant %v - assumed '%v'",=0A= Z_UNIVAL_P(p),=0A= @@ -543,7 +549,7 @@ ZEND_API int zval_update_constant_ex(zva=0A= zend_hash_move_forward(Z_ARRVAL_P(p));=0A= continue;=0A= }=0A= - if (!zend_u_get_constant(ZEND_STR_TYPE, str_index, str_index_len-1, = &const_value, scope TSRMLS_CC)) {=0A= + if (!zend_u_get_constant_ex(ZEND_STR_TYPE, str_index, = str_index_len-1, &const_value, scope, 0 TSRMLS_CC)) {=0A= if ((UG(unicode) && (colon.u =3D u_memchr(str_index.u, ':', = str_index_len-1)) && colon.u[1] =3D=3D ':') ||=0A= (!UG(unicode) && (colon.s =3D memchr(str_index.s, ':', = str_index_len-1)) && colon.s[1] =3D=3D ':')) {=0A= zend_error(E_ERROR, "Undefined class constant '%v'", str_index);=0A= Index: Zend/zend_language_parser.y=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_language_parser.y,v=0A= retrieving revision 1.188=0A= diff -u -p -d -r1.188 zend_language_parser.y=0A= --- Zend/zend_language_parser.y 20 Aug 2007 09:48:41 -0000 1.188=0A= +++ Zend/zend_language_parser.y 22 Aug 2007 08:27:43 -0000=0A= @@ -174,8 +174,13 @@ top_statement:=0A= | T_NAMESPACE namespace_name ';' { zend_do_namespace(&$2 TSRMLS_CC); }=0A= | T_IMPORT namespace_name ';' { zend_do_import(&$2, NULL TSRMLS_CC); }=0A= | T_IMPORT namespace_name T_AS T_STRING ';' { zend_do_import(&$2, &$4 = TSRMLS_CC); }=0A= + | constant_declaration ';'=0A= ;=0A= =0A= +constant_declaration:=0A= + constant_declaration ',' T_STRING '=3D' expr { = zend_do_declare_constant(&$3, &$5 TSRMLS_CC); }=0A= + | T_CONST T_STRING '=3D' expr { zend_do_declare_constant(&$2, &$4 = TSRMLS_CC); }=0A= +;=0A= =0A= inner_statement_list:=0A= inner_statement_list { zend_do_extended_info(TSRMLS_C); } = inner_statement { HANDLE_INTERACTIVE(); }=0A= @@ -722,7 +727,8 @@ common_scalar:=0A= =0A= static_scalar: /* compile-time evaluated scalars */=0A= common_scalar { $$ =3D $1; }=0A= - | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT = TSRMLS_CC); }=0A= + | T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_CT, 1 = TSRMLS_CC); }=0A= + | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, NULL, = &$2, ZEND_CT, 0 TSRMLS_CC); }=0A= | '+' static_scalar { $$ =3D $2; }=0A= | '-' static_scalar { zval minus_one; Z_TYPE(minus_one) =3D IS_LONG; = Z_LVAL(minus_one) =3D -1; mul_function(&$2.u.constant, &$2.u.constant, = &minus_one TSRMLS_CC); $$ =3D $2; }=0A= | T_ARRAY '(' static_array_pair_list ')' { $$ =3D $3; = Z_TYPE($$.u.constant) =3D IS_CONSTANT_ARRAY; }=0A= @@ -730,11 +736,12 @@ static_scalar: /* compile-time evaluated=0A= ;=0A= =0A= static_class_constant:=0A= - fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { = zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT TSRMLS_CC); }=0A= + fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { = zend_do_fetch_constant(&$$, &$1, &$3, ZEND_CT, 0 TSRMLS_CC); }=0A= ;=0A= =0A= scalar:=0A= - T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT = TSRMLS_CC); }=0A= + T_STRING { zend_do_fetch_constant(&$$, NULL, &$1, ZEND_RT, 1 = TSRMLS_CC); }=0A= + | T_PAAMAYIM_NEKUDOTAYIM T_STRING { zend_do_fetch_constant(&$$, NULL, = &$2, ZEND_RT, 0 TSRMLS_CC); }=0A= | T_STRING_VARNAME { $$ =3D $1; }=0A= | class_constant { $$ =3D $1; }=0A= | common_scalar { $$ =3D $1; }=0A= @@ -945,8 +952,8 @@ isset_variables:=0A= ;=0A= =0A= class_constant:=0A= - fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { = zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT TSRMLS_CC); }=0A= - | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { = zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT TSRMLS_CC); }=0A= + fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { = zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }=0A= + | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { = zend_do_fetch_constant(&$$, &$1, &$3, ZEND_RT, 0 TSRMLS_CC); }=0A= ;=0A= =0A= %%=0A= Index: Zend/zend_variables.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_variables.c,v=0A= retrieving revision 1.70=0A= diff -u -p -d -r1.70 zend_variables.c=0A= --- Zend/zend_variables.c 11 Jul 2007 11:19:58 -0000 1.70=0A= +++ Zend/zend_variables.c 22 Aug 2007 08:27:43 -0000=0A= @@ -28,7 +28,7 @@=0A= =0A= ZEND_API void _zval_dtor_func(zval *zvalue ZEND_FILE_LINE_DC) /* {{{ */=0A= {=0A= - switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) {=0A= + switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {=0A= case IS_CONSTANT: {=0A= TSRMLS_FETCH();=0A= =0A= @@ -81,7 +81,7 @@ dtor_unicode:=0A= =0A= ZEND_API void _zval_internal_dtor(zval *zvalue ZEND_FILE_LINE_DC) /* = {{{ */=0A= {=0A= - switch (Z_TYPE_P(zvalue) & ~IS_CONSTANT_INDEX) {=0A= + switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {=0A= case IS_CONSTANT: {=0A= TSRMLS_FETCH();=0A= =0A= @@ -120,7 +120,7 @@ ZEND_API void zval_add_ref(zval **p) /* =0A= =0A= ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) /* = {{{ */=0A= {=0A= - switch (Z_TYPE_P(zvalue)) {=0A= + switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) {=0A= case IS_RESOURCE: {=0A= TSRMLS_FETCH();=0A= =0A= Index: Zend/zend_vm_def.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_def.h,v=0A= retrieving revision 1.178=0A= diff -u -p -d -r1.178 zend_vm_def.h=0A= --- Zend/zend_vm_def.h 22 Aug 2007 07:39:37 -0000 1.178=0A= +++ Zend/zend_vm_def.h 22 Aug 2007 08:27:43 -0000=0A= @@ -2466,7 +2466,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY,=0A= zend_free_op free_res;=0A= =0A= if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m = TSRMLS_CC)=3D=3DFAILURE) {=0A= - if (Z_TYPE(opline->op2.u.constant) =3D=3D IS_CONSTANT || = Z_TYPE(opline->op2.u.constant)=3D=3DIS_CONSTANT_ARRAY) {=0A= + if ((Z_TYPE(opline->op2.u.constant) & IS_CONSTANT_TYPE_MASK) =3D=3D = IS_CONSTANT || Z_TYPE(opline->op2.u.constant)=3D=3DIS_CONSTANT_ARRAY) {=0A= zval *default_value;=0A= =0A= ALLOC_ZVAL(default_value);=0A= @@ -2700,37 +2700,51 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|T=0A= ZEND_VM_NEXT_OPCODE();=0A= }=0A= =0A= -ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|UNUSED, CONST)=0A= +ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|UNUSED|CONST, CONST)=0A= {=0A= zend_op *opline =3D EX(opline);=0A= zend_class_entry *ce =3D NULL;=0A= zval **value;=0A= =0A= if (OP1_TYPE =3D=3D IS_UNUSED) {=0A= -/* This seems to be a reminant of namespaces=0A= - if (EG(scope)) {=0A= - ce =3D EG(scope);=0A= - if (zend_hash_find(&ce->constants_table, = Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, = (void **) &value) =3D=3D SUCCESS) {=0A= - zval_update_constant(value, (void *) 1 TSRMLS_CC);=0A= - EX_T(opline->result.u.var).tmp_var =3D **value;=0A= - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= - ZEND_VM_NEXT_OPCODE();=0A= - }=0A= - }=0A= -*/=0A= - 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, NULL TSRMLS_CC)) {=0A= + 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)) {=0A= zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= - Z_TYPE(opline->op2.u.constant),=0A= - Z_UNIVAL(opline->op2.u.constant),=0A= - Z_TYPE(opline->op2.u.constant),=0A= - Z_UNIVAL(opline->op2.u.constant));=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= }=0A= ZEND_VM_NEXT_OPCODE();=0A= - }=0A= + } else if (OP1_TYPE =3D=3D IS_CONST) {=0A= + zend_op *op_data =3D opline + 1;=0A= + zend_constant *c;=0A= =0A= - ce =3D EX_T(opline->op1.u.var).class_entry;=0A= + ZEND_VM_INC_OPCODE();=0A= +=0A= + /* try a constant in namespace */=0A= + if (zend_u_hash_quick_find(EG(zend_constants), = Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), = Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) = &c)=3D=3DSUCCESS) {=0A= + EX_T(opline->result.u.var).tmp_var =3D c->value;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + ZEND_VM_NEXT_OPCODE();=0A= + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) !=3D 0) = {=0A= + 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)) {=0A= + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + }=0A= + ZEND_VM_NEXT_OPCODE();=0A= + }=0A= +=0A= + /* no constant found. try a constant in class */ =0A= + ce =3D zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), = Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), = opline->extended_value TSRMLS_CC); =0A= + if (!ce) {=0A= + zend_error_noreturn(E_ERROR, "Undefined class constant '%R'", = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + }=0A= + } else {=0A= + ce =3D EX_T(opline->op1.u.var).class_entry;=0A= + }=0A= =0A= if (zend_u_hash_find(&ce->constants_table, = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), = Z_UNILEN(opline->op2.u.constant)+1, (void **) &value) =3D=3D SUCCESS) {=0A= zend_class_entry *old_scope =3D EG(scope);=0A= @@ -4116,4 +4130,43 @@ ZEND_VM_HANDLER(151, ZEND_U_NORMALIZE, C=0A= ZEND_VM_NEXT_OPCODE();=0A= }=0A= =0A= +ZEND_VM_HANDLER(143, ZEND_DECLARE_CONST, CONST, CONST|TMP|VAR|CV)=0A= +{=0A= + zend_op *opline =3D EX(opline);=0A= + zend_free_op free_op1, free_op2;=0A= + zval *name =3D GET_OP1_ZVAL_PTR(BP_VAR_R);=0A= + zval *val =3D GET_OP2_ZVAL_PTR(BP_VAR_R);=0A= + zend_constant c;=0A= +=0A= + if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT || = Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval tmp =3D *val;=0A= + zval *tmp_ptr =3D &tmp;=0A= +=0A= + if (Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval_copy_ctor(&tmp); =0A= + }=0A= + INIT_PZVAL(&tmp);=0A= + zval_update_constant(&tmp_ptr, NULL TSRMLS_CC);=0A= + c.value =3D *tmp_ptr;=0A= + } else {=0A= + c.value =3D *val;=0A= + zval_copy_ctor(&c.value);=0A= + }=0A= + c.flags =3D CONST_CS; /* non persistent, case sensetive */=0A= + if (Z_TYPE_P(name) =3D=3D IS_UNICODE) {=0A= + c.name.u =3D zend_ustrndup(Z_USTRVAL_P(name), Z_USTRLEN_P(name));=0A= + } else {=0A= + c.name.s =3D zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));=0A= + }=0A= + c.name_len =3D Z_UNILEN_P(name)+1;=0A= + c.module_number =3D PHP_USER_CONSTANT;=0A= +=0A= + if (zend_u_register_constant(Z_TYPE_P(name), &c TSRMLS_CC) =3D=3D = FAILURE) {=0A= + }=0A= +=0A= + FREE_OP1();=0A= + FREE_OP2();=0A= + ZEND_VM_NEXT_OPCODE();=0A= +}=0A= +=0A= ZEND_VM_EXPORT_HELPER(zend_do_fcall, zend_do_fcall_common_helper)=0A= Index: Zend/zend_vm_execute.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_execute.h,v=0A= retrieving revision 1.182=0A= diff -u -p -d -r1.182 zend_vm_execute.h=0A= --- Zend/zend_vm_execute.h 22 Aug 2007 07:39:37 -0000 1.182=0A= +++ Zend/zend_vm_execute.h 22 Aug 2007 08:27:43 -0000=0A= @@ -757,7 +757,7 @@ static int ZEND_RECV_INIT_SPEC_CONST_HAN=0A= zend_free_op free_res;=0A= =0A= if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m = TSRMLS_CC)=3D=3DFAILURE) {=0A= - if (Z_TYPE(opline->op2.u.constant) =3D=3D IS_CONSTANT || = Z_TYPE(opline->op2.u.constant)=3D=3DIS_CONSTANT_ARRAY) {=0A= + if ((Z_TYPE(opline->op2.u.constant) & IS_CONSTANT_TYPE_MASK) =3D=3D = IS_CONSTANT || Z_TYPE(opline->op2.u.constant)=3D=3DIS_CONSTANT_ARRAY) {=0A= zval *default_value;=0A= =0A= ALLOC_ZVAL(default_value);=0A= @@ -2651,6 +2651,67 @@ static int ZEND_CASE_SPEC_CONST_CONST_HA=0A= ZEND_VM_NEXT_OPCODE();=0A= }=0A= =0A= +static int = ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= +{=0A= + zend_op *opline =3D EX(opline);=0A= + zend_class_entry *ce =3D NULL;=0A= + zval **value;=0A= +=0A= + if (IS_CONST =3D=3D IS_UNUSED) {=0A= + 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)) {=0A= + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + }=0A= + ZEND_VM_NEXT_OPCODE();=0A= + } else if (IS_CONST =3D=3D IS_CONST) {=0A= + zend_op *op_data =3D opline + 1;=0A= + zend_constant *c;=0A= +=0A= + ZEND_VM_INC_OPCODE();=0A= +=0A= + /* try a constant in namespace */=0A= + if (zend_u_hash_quick_find(EG(zend_constants), = Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), = Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) = &c)=3D=3DSUCCESS) {=0A= + EX_T(opline->result.u.var).tmp_var =3D c->value;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + ZEND_VM_NEXT_OPCODE();=0A= + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) !=3D 0) = {=0A= + 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)) {=0A= + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + }=0A= + ZEND_VM_NEXT_OPCODE();=0A= + }=0A= +=0A= + /* no constant found. try a constant in class */=0A= + ce =3D zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), = Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), = opline->extended_value TSRMLS_CC);=0A= + if (!ce) {=0A= + zend_error_noreturn(E_ERROR, "Undefined class constant '%R'", = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + }=0A= + } else {=0A= + ce =3D EX_T(opline->op1.u.var).class_entry;=0A= + }=0A= +=0A= + if (zend_u_hash_find(&ce->constants_table, = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), = Z_UNILEN(opline->op2.u.constant)+1, (void **) &value) =3D=3D SUCCESS) {=0A= + zend_class_entry *old_scope =3D EG(scope);=0A= +=0A= + EG(scope) =3D ce;=0A= + zval_update_constant(value, (void *) 1 TSRMLS_CC);=0A= + EG(scope) =3D old_scope;=0A= + EX_T(opline->result.u.var).tmp_var =3D **value;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + } else {=0A= + zend_error_noreturn(E_ERROR, "Undefined class constant '%R'", = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + }=0A= +=0A= + ZEND_VM_NEXT_OPCODE();=0A= +}=0A= +=0A= static int = ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= {=0A= zend_op *opline =3D EX(opline);=0A= @@ -2745,6 +2806,44 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_CO=0A= }=0A= }=0A= =0A= +static int = ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= +{=0A= + zend_op *opline =3D EX(opline);=0A= +=0A= + zval *name =3D &opline->op1.u.constant;=0A= + zval *val =3D &opline->op2.u.constant;=0A= + zend_constant c;=0A= +=0A= + if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT || = Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval tmp =3D *val;=0A= + zval *tmp_ptr =3D &tmp;=0A= +=0A= + if (Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval_copy_ctor(&tmp);=0A= + }=0A= + INIT_PZVAL(&tmp);=0A= + zval_update_constant(&tmp_ptr, NULL TSRMLS_CC);=0A= + c.value =3D *tmp_ptr;=0A= + } else {=0A= + c.value =3D *val;=0A= + zval_copy_ctor(&c.value);=0A= + }=0A= + c.flags =3D CONST_CS; /* non persistent, case sensetive */=0A= + if (Z_TYPE_P(name) =3D=3D IS_UNICODE) {=0A= + c.name.u =3D zend_ustrndup(Z_USTRVAL_P(name), Z_USTRLEN_P(name));=0A= + } else {=0A= + c.name.s =3D zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));=0A= + }=0A= + c.name_len =3D Z_UNILEN_P(name)+1;=0A= + c.module_number =3D PHP_USER_CONSTANT;=0A= +=0A= + if (zend_u_register_constant(Z_TYPE_P(name), &c TSRMLS_CC) =3D=3D = FAILURE) {=0A= + }=0A= +=0A= +=0A= + ZEND_VM_NEXT_OPCODE();=0A= +}=0A= +=0A= static int ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= {=0A= zend_op *opline =3D EX(opline);=0A= @@ -3190,6 +3289,44 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_TM=0A= }=0A= }=0A= =0A= +static int = ZEND_DECLARE_CONST_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= +{=0A= + zend_op *opline =3D EX(opline);=0A= + zend_free_op free_op2;=0A= + zval *name =3D &opline->op1.u.constant;=0A= + zval *val =3D _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 = TSRMLS_CC);=0A= + zend_constant c;=0A= +=0A= + if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT || = Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval tmp =3D *val;=0A= + zval *tmp_ptr =3D &tmp;=0A= +=0A= + if (Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval_copy_ctor(&tmp);=0A= + }=0A= + INIT_PZVAL(&tmp);=0A= + zval_update_constant(&tmp_ptr, NULL TSRMLS_CC);=0A= + c.value =3D *tmp_ptr;=0A= + } else {=0A= + c.value =3D *val;=0A= + zval_copy_ctor(&c.value);=0A= + }=0A= + c.flags =3D CONST_CS; /* non persistent, case sensetive */=0A= + if (Z_TYPE_P(name) =3D=3D IS_UNICODE) {=0A= + c.name.u =3D zend_ustrndup(Z_USTRVAL_P(name), Z_USTRLEN_P(name));=0A= + } else {=0A= + c.name.s =3D zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));=0A= + }=0A= + c.name_len =3D Z_UNILEN_P(name)+1;=0A= + c.module_number =3D PHP_USER_CONSTANT;=0A= +=0A= + if (zend_u_register_constant(Z_TYPE_P(name), &c TSRMLS_CC) =3D=3D = FAILURE) {=0A= + }=0A= +=0A= + zval_dtor(free_op2.var);=0A= + ZEND_VM_NEXT_OPCODE();=0A= +}=0A= +=0A= static int ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= {=0A= zend_op *opline =3D EX(opline);=0A= @@ -3635,6 +3772,44 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_VA=0A= }=0A= }=0A= =0A= +static int = ZEND_DECLARE_CONST_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= +{=0A= + zend_op *opline =3D EX(opline);=0A= + zend_free_op free_op2;=0A= + zval *name =3D &opline->op1.u.constant;=0A= + zval *val =3D _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 = TSRMLS_CC);=0A= + zend_constant c;=0A= +=0A= + if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT || = Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval tmp =3D *val;=0A= + zval *tmp_ptr =3D &tmp;=0A= +=0A= + if (Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval_copy_ctor(&tmp);=0A= + }=0A= + INIT_PZVAL(&tmp);=0A= + zval_update_constant(&tmp_ptr, NULL TSRMLS_CC);=0A= + c.value =3D *tmp_ptr;=0A= + } else {=0A= + c.value =3D *val;=0A= + zval_copy_ctor(&c.value);=0A= + }=0A= + c.flags =3D CONST_CS; /* non persistent, case sensetive */=0A= + if (Z_TYPE_P(name) =3D=3D IS_UNICODE) {=0A= + c.name.u =3D zend_ustrndup(Z_USTRVAL_P(name), Z_USTRLEN_P(name));=0A= + } else {=0A= + c.name.s =3D zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));=0A= + }=0A= + c.name_len =3D Z_UNILEN_P(name)+1;=0A= + c.module_number =3D PHP_USER_CONSTANT;=0A= +=0A= + if (zend_u_register_constant(Z_TYPE_P(name), &c TSRMLS_CC) =3D=3D = FAILURE) {=0A= + }=0A= +=0A= + if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};=0A= + ZEND_VM_NEXT_OPCODE();=0A= +}=0A= +=0A= static int = ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLE= R_ARGS)=0A= {=0A= zend_op *opline =3D EX(opline);=0A= @@ -4258,6 +4433,44 @@ static int ZEND_INIT_ARRAY_SPEC_CONST_CV=0A= }=0A= }=0A= =0A= +static int = ZEND_DECLARE_CONST_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= +{=0A= + zend_op *opline =3D EX(opline);=0A= +=0A= + zval *name =3D &opline->op1.u.constant;=0A= + zval *val =3D _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R = TSRMLS_CC);=0A= + zend_constant c;=0A= +=0A= + if ((Z_TYPE_P(val) & IS_CONSTANT_TYPE_MASK) =3D=3D IS_CONSTANT || = Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval tmp =3D *val;=0A= + zval *tmp_ptr =3D &tmp;=0A= +=0A= + if (Z_TYPE_P(val) =3D=3D IS_CONSTANT_ARRAY) {=0A= + zval_copy_ctor(&tmp);=0A= + }=0A= + INIT_PZVAL(&tmp);=0A= + zval_update_constant(&tmp_ptr, NULL TSRMLS_CC);=0A= + c.value =3D *tmp_ptr;=0A= + } else {=0A= + c.value =3D *val;=0A= + zval_copy_ctor(&c.value);=0A= + }=0A= + c.flags =3D CONST_CS; /* non persistent, case sensetive */=0A= + if (Z_TYPE_P(name) =3D=3D IS_UNICODE) {=0A= + c.name.u =3D zend_ustrndup(Z_USTRVAL_P(name), Z_USTRLEN_P(name));=0A= + } else {=0A= + c.name.s =3D zend_strndup(Z_STRVAL_P(name), Z_STRLEN_P(name));=0A= + }=0A= + c.name_len =3D Z_UNILEN_P(name)+1;=0A= + c.module_number =3D PHP_USER_CONSTANT;=0A= +=0A= + if (zend_u_register_constant(Z_TYPE_P(name), &c TSRMLS_CC) =3D=3D = FAILURE) {=0A= + }=0A= +=0A= +=0A= + ZEND_VM_NEXT_OPCODE();=0A= +}=0A= +=0A= static int ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)=0A= {=0A= zend_op *opline =3D EX(opline);=0A= @@ -10016,30 +10229,44 @@ static int ZEND_FETCH_CONSTANT_SPEC_VAR_=0A= zval **value;=0A= =0A= if (IS_VAR =3D=3D IS_UNUSED) {=0A= -/* This seems to be a reminant of namespaces=0A= - if (EG(scope)) {=0A= - ce =3D EG(scope);=0A= - if (zend_hash_find(&ce->constants_table, = Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, = (void **) &value) =3D=3D SUCCESS) {=0A= - zval_update_constant(value, (void *) 1 TSRMLS_CC);=0A= - EX_T(opline->result.u.var).tmp_var =3D **value;=0A= - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= - ZEND_VM_NEXT_OPCODE();=0A= - }=0A= - }=0A= -*/=0A= - 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, NULL TSRMLS_CC)) {=0A= + 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)) {=0A= zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= - Z_TYPE(opline->op2.u.constant),=0A= - Z_UNIVAL(opline->op2.u.constant),=0A= - Z_TYPE(opline->op2.u.constant),=0A= - Z_UNIVAL(opline->op2.u.constant));=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= }=0A= ZEND_VM_NEXT_OPCODE();=0A= - }=0A= + } else if (IS_VAR =3D=3D IS_CONST) {=0A= + zend_op *op_data =3D opline + 1;=0A= + zend_constant *c;=0A= =0A= - ce =3D EX_T(opline->op1.u.var).class_entry;=0A= + ZEND_VM_INC_OPCODE();=0A= +=0A= + /* try a constant in namespace */=0A= + if (zend_u_hash_quick_find(EG(zend_constants), = Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), = Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) = &c)=3D=3DSUCCESS) {=0A= + EX_T(opline->result.u.var).tmp_var =3D c->value;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + ZEND_VM_NEXT_OPCODE();=0A= + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) !=3D 0) = {=0A= + 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)) {=0A= + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + }=0A= + ZEND_VM_NEXT_OPCODE();=0A= + }=0A= +=0A= + /* no constant found. try a constant in class */=0A= + ce =3D zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), = Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), = opline->extended_value TSRMLS_CC);=0A= + if (!ce) {=0A= + zend_error_noreturn(E_ERROR, "Undefined class constant '%R'", = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + }=0A= + } else {=0A= + ce =3D EX_T(opline->op1.u.var).class_entry;=0A= + }=0A= =0A= if (zend_u_hash_find(&ce->constants_table, = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), = Z_UNILEN(opline->op2.u.constant)+1, (void **) &value) =3D=3D SUCCESS) {=0A= zend_class_entry *old_scope =3D EG(scope);=0A= @@ -16724,30 +16951,44 @@ static int ZEND_FETCH_CONSTANT_SPEC_UNUS=0A= zval **value;=0A= =0A= if (IS_UNUSED =3D=3D IS_UNUSED) {=0A= -/* This seems to be a reminant of namespaces=0A= - if (EG(scope)) {=0A= - ce =3D EG(scope);=0A= - if (zend_hash_find(&ce->constants_table, = Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, = (void **) &value) =3D=3D SUCCESS) {=0A= - zval_update_constant(value, (void *) 1 TSRMLS_CC);=0A= - EX_T(opline->result.u.var).tmp_var =3D **value;=0A= - zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= - ZEND_VM_NEXT_OPCODE();=0A= - }=0A= - }=0A= -*/=0A= - 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, NULL TSRMLS_CC)) {=0A= + 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)) {=0A= zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= - Z_TYPE(opline->op2.u.constant),=0A= - Z_UNIVAL(opline->op2.u.constant),=0A= - Z_TYPE(opline->op2.u.constant),=0A= - Z_UNIVAL(opline->op2.u.constant));=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= }=0A= ZEND_VM_NEXT_OPCODE();=0A= - }=0A= + } else if (IS_UNUSED =3D=3D IS_CONST) {=0A= + zend_op *op_data =3D opline + 1;=0A= + zend_constant *c;=0A= =0A= - ce =3D EX_T(opline->op1.u.var).class_entry;=0A= + ZEND_VM_INC_OPCODE();=0A= +=0A= + /* try a constant in namespace */=0A= + if (zend_u_hash_quick_find(EG(zend_constants), = Z_TYPE(op_data->op1.u.constant), Z_UNIVAL(op_data->op1.u.constant), = Z_UNILEN(op_data->op1.u.constant)+1, op_data->extended_value, (void **) = &c)=3D=3DSUCCESS) {=0A= + EX_T(opline->result.u.var).tmp_var =3D c->value;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + ZEND_VM_NEXT_OPCODE();=0A= + } else if ((opline->extended_value & IS_CONSTANT_RT_NS_CHECK) !=3D 0) = {=0A= + 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)) {=0A= + zend_error(E_NOTICE, "Use of undefined constant %R - assumed '%R'",=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant),=0A= + Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + EX_T(opline->result.u.var).tmp_var =3D opline->op2.u.constant;=0A= + zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);=0A= + }=0A= + ZEND_VM_NEXT_OPCODE();=0A= + }=0A= +=0A= + /* no constant found. try a constant in class */=0A= + ce =3D zend_u_fetch_class(Z_TYPE(opline->op1.u.constant), = Z_UNIVAL(opline->op1.u.constant), Z_UNILEN(opline->op1.u.constant), = opline->extended_value TSRMLS_CC);=0A= + if (!ce) {=0A= + zend_error_noreturn(E_ERROR, "Undefined class constant '%R'", = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant));=0A= + }=0A= + } else {=0A= + ce =3D EX_T(opline->op1.u.var).class_entry;=0A= + }=0A= =0A= if (zend_u_hash_find(&ce->constants_table, = Z_TYPE(opline->op2.u.constant), Z_UNIVAL(opline->op2.u.constant), = Z_UNILEN(opline->op2.u.constant)+1, (void **) &value) =3D=3D SUCCESS) {=0A= zend_class_entry *old_scope =3D EG(scope);=0A= @@ -30882,7 +31123,7 @@ void zend_init_opcodes_handlers(void)=0A= ZEND_NULL_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= - ZEND_NULL_HANDLER,=0A= + ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= @@ -31982,11 +32223,11 @@ void zend_init_opcodes_handlers(void)=0A= ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,=0A= ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,=0A= ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER,=0A= + ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER,=0A= + ZEND_DECLARE_CONST_SPEC_CONST_TMP_HANDLER,=0A= + ZEND_DECLARE_CONST_SPEC_CONST_VAR_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= - ZEND_NULL_HANDLER,=0A= - ZEND_NULL_HANDLER,=0A= - ZEND_NULL_HANDLER,=0A= - ZEND_NULL_HANDLER,=0A= + ZEND_DECLARE_CONST_SPEC_CONST_CV_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= ZEND_NULL_HANDLER,=0A= Index: Zend/zend_vm_opcodes.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_opcodes.h,v=0A= retrieving revision 1.69=0A= diff -u -p -d -r1.69 zend_vm_opcodes.h=0A= --- Zend/zend_vm_opcodes.h 8 Mar 2007 17:30:28 -0000 1.69=0A= +++ Zend/zend_vm_opcodes.h 22 Aug 2007 08:27:43 -0000=0A= @@ -142,6 +142,7 @@=0A= #define ZEND_DECLARE_INHERITED_CLASS 140=0A= #define ZEND_DECLARE_FUNCTION 141=0A= #define ZEND_RAISE_ABSTRACT_ERROR 142=0A= +#define ZEND_DECLARE_CONST 143=0A= #define ZEND_ADD_INTERFACE 144=0A= #define ZEND_VERIFY_ABSTRACT_CLASS 146=0A= #define ZEND_ASSIGN_DIM 147=0A= Index: Zend/tests/bug41633_2.phpt=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/tests/bug41633_2.phpt,v=0A= retrieving revision 1.2=0A= diff -u -p -d -r1.2 bug41633_2.phpt=0A= --- Zend/tests/bug41633_2.phpt 13 Jun 2007 14:50:33 -0000 1.2=0A= +++ Zend/tests/bug41633_2.phpt 22 Aug 2007 08:27:43 -0000=0A= @@ -8,4 +8,4 @@ class Foo { echo Foo::A."\n"; ?> --EXPECTF-- -Fatal error: Undefined class constant 'self::B' in %sbug41633_2.php on = line 5 +Fatal error: Undefined class constant 'B' in %sbug41633_2.php on line 5 Index: Zend/tests/ns_039.phpt=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: Zend/tests/ns_039.phpt=0A= diff -N Zend/tests/ns_039.phpt=0A= --- /dev/null 1 Jan 1970 00:00:00 -0000=0A= +++ Zend/tests/ns_039.phpt 22 Aug 2007 08:27:43 -0000=0A= @@ -0,0 +1,23 @@=0A= +--TEST--=0A= +039: Constant declaration=0A= +--FILE--=0A= + ok=0A= +)=0A= +Array=0A= +(=0A= + [0] =3D> ok=0A= +)=0A= Index: Zend/tests/ns_040.phpt=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: Zend/tests/ns_040.phpt=0A= diff -N Zend/tests/ns_040.phpt=0A= --- /dev/null 1 Jan 1970 00:00:00 -0000=0A= +++ Zend/tests/ns_040.phpt 22 Aug 2007 08:27:43 -0000=0A= @@ -0,0 +1,68 @@=0A= +--TEST--=0A= +040: Constant declaration and usage in namespace=0A= +--FILE--=0A= +A);=0A= +const E =3D array(A=3D>"aaa\n");=0A= +function f1($x=3DA) {=0A= + echo $x;=0A= +}=0A= +function f2($x=3DX::A) {=0A= + echo $x;=0A= +}=0A= +function f3($x=3DY::A) {=0A= + echo $x;=0A= +}=0A= +function f4($x=3D::X::A) {=0A= + echo $x;=0A= +}=0A= +function f5($x=3DB) {=0A= + echo $x;=0A= +}=0A= +function f6($x=3Darray(A)) {=0A= + echo $x[0];=0A= +}=0A= +function f7($x=3Darray("aaa"=3D>A)) {=0A= + echo $x["aaa"];=0A= +}=0A= +function f8($x=3Darray(A=3D>"aaa\n")) {=0A= + echo $x["ok\n"];=0A= +}=0A= +echo A;=0A= +echo X::A;=0A= +echo Y::A;=0A= +echo ::X::A;=0A= +f1();=0A= +f2();=0A= +f3();=0A= +f4();=0A= +echo B;=0A= +$x =3D C; echo $x[0];=0A= +$x =3D D; echo $x["aaa"];=0A= +$x =3D E; echo $x["ok\n"];=0A= +f5();=0A= +f6();=0A= +f7();=0A= +f8();=0A= +--EXPECT--=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +ok=0A= +aaa=0A= +ok=0A= +ok=0A= +ok=0A= +aaa=0A= Index: Zend/tests/ns_041.phpt=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: Zend/tests/ns_041.phpt=0A= diff -N Zend/tests/ns_041.phpt=0A= --- /dev/null 1 Jan 1970 00:00:00 -0000=0A= +++ Zend/tests/ns_041.phpt 22 Aug 2007 08:27:43 -0000=0A= @@ -0,0 +1,22 @@=0A= +--TEST--=0A= +041: Constants in namespace=0A= +--FILE--=0A= +