]> granicus.if.org Git - php/commitdiff
Fixed segfault in filter extension when using callbacks. (reported & patched by Arnar...
authorFelipe Pena <felipe@php.net>
Sun, 24 Feb 2008 18:34:30 +0000 (18:34 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 24 Feb 2008 18:34:30 +0000 (18:34 +0000)
NEWS
ext/filter/filter.c

diff --git a/NEWS b/NEWS
index 52429777efc312945c059e4935a83f998fafef5b..52b68a9972141e251967ab9adec58348d6f7588f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ PHP                                                                        NEWS
   (Ilia)
 - Fixed a bug with PDO::FETCH_COLUMN|PDO::FETCH_GROUP mode when a column # by
   which to group by data is specified. (Ilia)
+- Fixed segfault in filter extension when using callbacks. (Arnar Mar Sig,
+  Felipe)
 - Upgraded PCRE to version 7.6 (Nuno)
 
 
index c2c097759aea7a99a858c5804d71a91b174b9941..91b89dad78756dca6b06dabead1ee8f6a5492211 100644 (file)
@@ -322,7 +322,7 @@ static void php_zval_filter(zval **value, long filter, long flags, zval *options
        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"))