From f75a2de1c17836b97cdc8f6bd9b269b745bf5c0a Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 24 Feb 2008 18:34:30 +0000 Subject: [PATCH] Fixed segfault in filter extension when using callbacks. (reported & patched by Arnar Mar Sig) --- NEWS | 2 ++ ext/filter/filter.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 52429777ef..52b68a9972 100644 --- 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) diff --git a/ext/filter/filter.c b/ext/filter/filter.c index c2c097759a..91b89dad78 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -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")) -- 2.50.1