From: foobar Date: Fri, 22 Mar 2002 01:12:52 +0000 (+0000) Subject: MFH fix for bug #16182 X-Git-Tag: php-4.2.0RC2~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a0ab5d239e00b1a84d6d8af3848123051ea16db1;p=php MFH fix for bug #16182 --- diff --git a/ext/standard/aggregation.c b/ext/standard/aggregation.c index 4a2c0c194d..1e1ffd4aa3 100644 --- a/ext/standard/aggregation.c +++ b/ext/standard/aggregation.c @@ -72,20 +72,25 @@ static void aggregate_methods(zend_class_entry *ce, zend_class_entry *from_ce, i uint func_name_len; ulong num_key; zval *list_hash = NULL; +#if HAVE_PCRE || HAVE_BUNDLED_PCRE pcre *re = NULL; pcre_extra *re_extra = NULL; int re_options = 0; +#endif /* * Flip the array for easy lookup, or compile the regexp. */ if (aggr_type == AGGREGATE_BY_LIST) { list_hash = array_to_hash(aggr_filter); - } else if (aggr_type == AGGREGATE_BY_REGEXP) { + } +#if HAVE_PCRE || HAVE_BUNDLED_PCRE + else if (aggr_type == AGGREGATE_BY_REGEXP) { if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options)) == NULL) { return; } } +#endif /* * "Just because it's not nice doesn't mean it's not miraculous." @@ -108,9 +113,13 @@ static void aggregate_methods(zend_class_entry *ce, zend_class_entry *from_ce, i /* 2. private methods (heh, like we really have them) */ func_name[0] == '_' || /* 3. explicitly excluded methods */ - (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), func_name, func_name_len)) || + (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), func_name, func_name_len)) +#if HAVE_PCRE || HAVE_BUNDLED_PCRE + || /* 4. methods matching regexp as modified by the exclusion flag */ - (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, func_name, func_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1) { + (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, func_name, func_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1 +#endif + ) { zend_hash_move_forward_ex(&from_ce->function_table, &pos); continue; } @@ -163,9 +172,11 @@ static void aggregate_properties(zval *obj, zend_class_entry *from_ce, int aggr_ uint prop_name_len; ulong num_key; zval *list_hash = NULL; +#if HAVE_PCRE || HAVE_BUNDLED_PCRE pcre *re = NULL; pcre_extra *re_extra = NULL; int re_options = 0; +#endif if (!from_ce->constants_updated) { zend_hash_apply_with_argument(&from_ce->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); @@ -177,11 +188,14 @@ static void aggregate_properties(zval *obj, zend_class_entry *from_ce, int aggr_ */ if (aggr_type == AGGREGATE_BY_LIST) { list_hash = array_to_hash(aggr_filter); - } else if (aggr_type == AGGREGATE_BY_REGEXP) { + } +#if HAVE_PCRE || HAVE_BUNDLED_PCRE + else if (aggr_type == AGGREGATE_BY_REGEXP) { if ((re = pcre_get_compiled_regex(Z_STRVAL_P(aggr_filter), &re_extra, &re_options)) == NULL) { return; } } +#endif /* * "Just because it's not nice doesn't mean it's not miraculous." @@ -202,9 +216,13 @@ static void aggregate_properties(zval *obj, zend_class_entry *from_ce, int aggr_ * 1. private properties (heh, like we really have them) */ if (prop_name[0] == '_' || /* 2. explicitly excluded properties */ - (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), prop_name, prop_name_len)) || + (aggr_type == AGGREGATE_BY_LIST && zend_hash_exists(Z_ARRVAL_P(list_hash), prop_name, prop_name_len)) +#if HAVE_PCRE || HAVE_BUNDLED_PCRE + || /* 3. properties matching regexp as modified by the exclusion flag */ - (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, prop_name, prop_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1) { + (aggr_type == AGGREGATE_BY_REGEXP && (pcre_exec(re, re_extra, prop_name, prop_name_len-1, 0, 0, NULL, 0) < 0) ^ exclude) == 1 +#endif + ) { zend_hash_move_forward_ex(&from_ce->default_properties, &pos); continue; } @@ -310,6 +328,9 @@ static void aggregate(INTERNAL_FUNCTION_PARAMETERS, int aggr_what, int aggr_type efree(class_name_lc); return; } +#ifdef ZEND_ENGINE_2 + ce = *(zend_class_entry**)ce; +#endif /* * And God said, Let there be light; and there was light. But only once. @@ -439,15 +460,6 @@ PHP_FUNCTION(aggregate_methods_by_list) /* }}} */ -/* {{{ proto void aggregate_methods_by_regexp(object obj, string class, string regexp [, bool exclude]) - */ -PHP_FUNCTION(aggregate_methods_by_regexp) -{ - aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_METHODS, AGGREGATE_BY_REGEXP); -} -/* }}} */ - - /* {{{ proto void aggregate_properties(object obj, string class) */ PHP_FUNCTION(aggregate_properties) @@ -465,6 +477,15 @@ PHP_FUNCTION(aggregate_properties_by_list) } /* }}} */ +#if HAVE_PCRE || HAVE_BUNDLED_PCRE +/* {{{ proto void aggregate_methods_by_regexp(object obj, string class, string regexp [, bool exclude]) + */ +PHP_FUNCTION(aggregate_methods_by_regexp) +{ + aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_METHODS, AGGREGATE_BY_REGEXP); +} +/* }}} */ + /* {{{ proto void aggregate_properties_by_regexp(object obj, string class, string regexp [, bool exclude]) */ @@ -473,6 +494,7 @@ PHP_FUNCTION(aggregate_properties_by_regexp) aggregate(INTERNAL_FUNCTION_PARAM_PASSTHRU, AGGREGATE_PROPERTIES, AGGREGATE_BY_REGEXP); } /* }}} */ +#endif /* {{{ proto array aggregation_info(object obj)