Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35769 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75268 invoked by uid 1010); 24 Feb 2008 15:49:14 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75253 invoked from network); 24 Feb 2008 15:49:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2008 15:49:14 -0000 Authentication-Results: pb1.pair.com header.from=antab@valka.is; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=antab@valka.is; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain valka.is from 213.176.128.14 cause and error) X-PHP-List-Original-Sender: antab@valka.is X-Host-Fingerprint: 213.176.128.14 vxout-2.c.is Linux 2.4/2.6 Received: from [213.176.128.14] ([213.176.128.14:50640] helo=vxout-2.c.is) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/2E-30812-8F191C74 for ; Sun, 24 Feb 2008 10:49:13 -0500 Received: from mail.internet.is (mail.aknet.is [193.4.194.58]) by vxout-2.c.is (Postfix) with ESMTP id CADEE3CC6AF for ; Sun, 24 Feb 2008 15:48:50 +0000 (GMT) Received: from [10.0.0.102] (postur.valka.is [194.144.27.37]) by mail.internet.is (Postfix) with ESMTP id B615C10E4 for ; Sun, 24 Feb 2008 15:48:50 +0000 (CUT) Message-ID: To: internals@lists.php.net In-Reply-To: <3BA7F322-7E34-4F8D-BD2B-6F59DA3139FB@valka.is> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Sun, 24 Feb 2008 15:48:50 +0000 References: <3BA7F322-7E34-4F8D-BD2B-6F59DA3139FB@valka.is> X-Mailer: Apple Mail (2.919.2) X-Vodafone-MailScanner-Information: Virusskannad hja Vodafone X-Vodafone-MailScanner: Found to be clean - Enginn virus fannst X-Vodafone-MailScanner-SpamCheck: ekki ruslpostur, SpamAssassin (notcached, stigagjof=0, required 5, autolearn=disabled) X-MailScanner-From: antab@valka.is Subject: Re: [PHP-DEV] [PATCH] Fix segfault in filter extension when using callbacks From: antab@valka.is (Arnar Mar Sig) Erm, the attachement got stripped away, heres the patch.. --- php-5.2.5/ext/filter/filter.c 2007-04-04 20:50:26.000000000 +0000 +++ php-5.2.5-fixed/ext/filter/filter.c 2008-02-24 15:14:19.000000000 +0000 @@ -322,7 +322,7 @@ filter_func.function(*value, flags, options, charset TSRMLS_CC); if ( - options && + options && (Z_TYPE_P(options) == IS_ARRAY || Z_TYPE_P(options) == IS_OBJECT) && ((flags & FILTER_NULL_ON_FAILURE && Z_TYPE_PP(value) == IS_NULL) || (!(flags & FILTER_NULL_ON_FAILURE) && Z_TYPE_PP(value) == IS_BOOL && Z_LVAL_PP(value) == 0)) && zend_hash_exists(HASH_OF(options), "default", sizeof("default")) Arnar Mar Sig On Feb 24, 2008, at 3:37 PM, Arnar Mar Sig wrote: > The filter extensinon will segfault if a callback filter returns > FALSE, this little patch fixes that. > > There is also no way to set default value if the callback fails > because of a design flow. When dealing with callbacks the 'options' > key in the options parameters just be a valid callback, but to set a > default value then this key must be a array that includes the key > 'default'. > > > Test case: > function filter_test($str) { return FALSE; } > var_dump(filter_var('durty/boy', FILTER_CALLBACK, array( > 'options' => 'filter_test', > ))); > > > Arnar Mar Sig > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php