Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24279 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17452 invoked by uid 1010); 5 Jul 2006 20:59:43 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 17435 invoked from network); 5 Jul 2006 20:59:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jul 2006 20:59:43 -0000 X-PHP-List-Original-Sender: pollita@php.net X-Host-Fingerprint: 65.111.164.201 danica.alphaweb.net Linux 2.4/2.6 Received: from ([65.111.164.201:59514] helo=danica.alphaweb.net) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id F2/87-16663-E382CA44 for ; Wed, 05 Jul 2006 16:59:43 -0400 Received: from dhcp-139-92.ohr.berkeley.edu ([169.229.139.92] helo=peiscg33m) by danica.alphaweb.net with esmtpsa (TLS-1.0:RSA_ARCFOUR_MD5:16) (Exim 4.50) id 1FyESf-0001z4-LY for internals@lists.php.net; Wed, 05 Jul 2006 16:59:06 -0400 Message-ID: <010401c6a075$ee6f7ee0$0000fea9@ohr.berkeley.edu> Reply-To: "Sara Golemon" To: Date: Wed, 5 Jul 2006 13:59:35 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0101_01C6A03B.3F5864B0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Subject: Inconsistency between FETCH_DIM_IS and FETCH_OBJ_IS From: pollita@php.net ("Sara Golemon") ------=_NextPart_000_0101_01C6A03B.3F5864B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable When executing ZEND_FETCH_OBJ_IS on a non-object, the handler dispatches = to zend_fetch_property_address_read_helper with type=3D=3DBP_VAR_IS and = ends up generating an error (isset() is supposed to be quiet) here: if (Z_TYPE_P(container) !=3D IS_OBJECT || = !Z_OBJ_HT_P(container)->read_property) { zend_error(E_NOTICE, "Trying to get property of non-object"); *retval =3D EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); It's cousin ZEND_FETCH_DIM_IS winds up at zend_fetch_dimension_address() = where the non-arrayness of op1 is handled via these case statements: case IS_NULL: { /* for read-mode only */ if (result) { result->var.ptr_ptr =3D &EG(uninitialized_zval_ptr); PZVAL_LOCK(*result->var.ptr_ptr); } if (type=3D=3DBP_VAR_W || type=3D=3DBP_VAR_RW) { zend_error(E_WARNING, "Cannot use a NULL value as an = array"); } break; } default: { switch (type) { case BP_VAR_UNSET: zend_error(E_WARNING, "Cannot unset offset in a = non-array variable"); /* break missing intentionally */ case BP_VAR_R: case BP_VAR_IS: retval =3D &EG(uninitialized_zval_ptr); break; default: retval =3D &EG(error_zval_ptr); break; } if (result) { result->var.ptr_ptr =3D retval; PZVAL_LOCK(*result->var.ptr_ptr); } if (type=3D=3DBP_VAR_W || type=3D=3DBP_VAR_RW) { zend_error(E_WARNING, "Cannot use a scalar value as = an array"); } } Which indicate the expected behavior of silent failure. It's probably = gone undetected till now as it requires fetching a property or dimension = offset from a property in a third (non-object) variable within an = isset() statement: $foo =3D NULL; isset($foo->bar->baz); Unless someone can suggest why Objects should be noisy inside isset(), = I'd like to suggest the following fix: Index: Zend/zend_vm_def.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /repository/ZendEngine2/zend_vm_def.h,v retrieving revision 1.120 diff -u -r1.120 zend_vm_def.h --- Zend/zend_vm_def.h 13 Jun 2006 12:56:20 -0000 1.120 +++ Zend/zend_vm_def.h 5 Jul 2006 20:52:41 -0000 @@ -1176,7 +1176,9 @@ if (Z_TYPE_P(container) !=3D IS_OBJECT || = !Z_OBJ_HT_P(container)->read_property) { - zend_error(E_NOTICE, "Trying to get property of = non-object"); + if (type !=3D BP_VAR_IS) { + zend_error(E_NOTICE, "Trying to get property of = non-object"); + } *retval =3D EG(uninitialized_zval_ptr); SELECTIVE_PZVAL_LOCK(*retval, &opline->result); AI_USE_PTR(EX_T(opline->result.u.var).var); I suggest only excluding BP_VAR_IS since the matching behavior for = unset()/DIM is to throw a notice. I could potentially see excluding = BP_VAR_R in order to match read/DIM, but personally I never liked that = behavior :) -Sara ------=_NextPart_000_0101_01C6A03B.3F5864B0--