Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:1931 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74903 invoked from network); 23 May 2003 15:40:05 -0000 Received: from unknown (HELO bs.tv2.dk) (193.88.89.68) by pb1.pair.com with SMTP; 23 May 2003 15:40:05 -0000 Received: from note201043 (unknown [10.10.102.198]) by bs.tv2.dk (Postfix) with ESMTP id 6C76D2A96E3 for ; Fri, 23 May 2003 17:40:02 +0200 (CEST) To: PHP Internals List Content-Type: multipart/mixed; boundary="=-CiJchcyzBsxnIklTtfzE" Organization: Message-ID: <1053704626.1035.21.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.3.1 (Preview Release) Date: 23 May 2003 17:43:46 +0200 Subject: [PATCH] make "Call to a member function on a non-object" non-fatal From: morten+php@afdelingp.dk (Morten Poulsen) --=-CiJchcyzBsxnIklTtfzE Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, The attached patch (against zend_execute.c 1.316.2.10) changes a "Call to a member function on a non-object" from E_ERROR to E_WARNING so it can be handled by a "user space" error handler. Best regards, Morten Poulsen -- Morten Poulsen --=-CiJchcyzBsxnIklTtfzE Content-Disposition: attachment; filename=patch-php-cvs-nonfatal.diff Content-Type: text/x-patch; name=patch-php-cvs-nonfatal.diff; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit diff -urN php-4.3.1-orig/Zend/zend_execute.c php-4.3.1/Zend/zend_execute.c --- php-4.3.1-orig/Zend/zend_execute.c Mon Mar 31 14:01:54 2003 +++ php-4.3.1/Zend/zend_execute.c Fri May 23 15:48:40 2003 @@ -1551,7 +1551,14 @@ } if (!EX(object).ptr || EX(object).ptr->type != IS_OBJECT) { - zend_error(E_ERROR, "Call to a member function on a non-object"); + zend_error(E_WARNING, "Call to a member function on a non-object"); + zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(ce), &EX(object).ptr, &EX(fbc)); + while (EX(opline)->opcode != ZEND_DO_FCALL_BY_NAME) EX(opline)++; /* jump past arguments */ + if (RETURN_VALUE_USED(EX(opline))) { /* return null */ + ALLOC_ZVAL(EX(Ts)[EX(opline)->result.u.var].var.ptr); + INIT_ZVAL(*EX(Ts)[EX(opline)->result.u.var].var.ptr); + } + NEXT_OPCODE(); /* jump past ZEND_DO_FCALL_BY_NAME */ } if (!EX(object).ptr->is_ref && EX(object).ptr->refcount > 1) { zend_error(E_ERROR, "Bug: Problem in method call"); --=-CiJchcyzBsxnIklTtfzE--