Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8865 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70483 invoked by uid 1010); 1 Apr 2004 16:05:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70433 invoked from network); 1 Apr 2004 16:05:38 -0000 Received: from unknown (HELO phoebe.host4u.net) (209.150.128.26) by pb1.pair.com with SMTP; 1 Apr 2004 16:05:38 -0000 Received: from ctdprimary (dsta-aa203.pivot.net [66.186.171.203]) by phoebe.host4u.net (8.11.6/8.11.6) with SMTP id i31G5bL12192 for ; Thu, 1 Apr 2004 10:05:37 -0600 Message-ID: <034a01c41803$81767890$f7dea8c0@cyberware.local> To: Date: Thu, 1 Apr 2004 11:08:00 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0347_01C417D9.984F6A60" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Subject: xml ext and objects From: rrichards@ctindustries.net ("Rob Richards") ------=_NextPart_000_0347_01C417D9.984F6A60 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Attached is a patch for the xml extension which fixes the segfault with objects such as in bug 27821 as well as a few other scripts i've seen floating around. Is there a reason why zval_add_ref in xml_set_object was commented out? Yes I already asked thies and was directed here. It doesnt make sense that this function will dtor the object but not increment the ref on the object, which in bug 27821, the engine ended up destyoing the object while running the methods of the object. The changes in compat.c are unrelated mem leak fixes Rob ------=_NextPart_000_0347_01C417D9.984F6A60 Content-Type: text/plain; name="xml.diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xml.diff.txt" Index: compat.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/php-src/ext/xml/compat.c,v retrieving revision 1.31 diff -u -r1.31 compat.c --- compat.c 24 Feb 2004 12:03:32 -0000 1.31 +++ compat.c 1 Apr 2004 15:44:41 -0000 @@ -232,6 +232,7 @@ =20 _build_comment(comment, xmlStrlen(comment), &d_comment, = &d_comment_len); parser->h_default(parser->user, d_comment, d_comment_len); + xmlFree(d_comment); } } =20 @@ -257,6 +258,7 @@ =09 _build_entity(name, xmlStrlen(name), &entity, &len); parser->h_default(parser->user, (const xmlChar *) entity, len); + xmlFree(entity); } =20 return NULL; Index: xml.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=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/php-src/ext/xml/xml.c,v retrieving revision 1.150 diff -u -r1.150 xml.c --- xml.c 23 Feb 2004 16:19:39 -0000 1.150 +++ xml.c 1 Apr 2004 15:44:42 -0000 @@ -1145,9 +1145,9 @@ parser->object =3D *mythis; =20 /* please leave this commented - or ask thies@thieso.net before doing = it (again) */ -/* #ifdef ZEND_ENGINE_2 - zval_add_ref(&parser->object);=20 -#endif */ +#ifdef ZEND_ENGINE_2 + zval_add_ref(&parser->object); +#endif =20 RETVAL_TRUE; } @@ -1486,6 +1486,12 @@ =20 ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", = le_xml_parser); =20 +#ifdef ZEND_ENGINE_2 + if (parser->object) { + zval_ptr_dtor(&parser->object); + } +#endif + if (zend_list_delete(parser->index) =3D=3D FAILURE) { RETURN_FALSE; } ------=_NextPart_000_0347_01C417D9.984F6A60--