@@ -760,13 +760,19 @@ PHP_METHOD(XSLTProcessor, registerPHPFunctions)
760
760
{
761
761
zval * id = ZEND_THIS ;
762
762
xsl_object * intern ;
763
- zval * array_value , * entry , new_string ;
764
- zend_string * name ;
763
+ zval * entry , new_string ;
764
+ zend_string * restrict_str = NULL ;
765
+ HashTable * restrict_ht = NULL ;
765
766
766
- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "a" , & array_value ) == SUCCESS ) {
767
- intern = Z_XSL_P (id );
767
+ ZEND_PARSE_PARAMETERS_START (0 , 1 )
768
+ Z_PARAM_OPTIONAL
769
+ Z_PARAM_STR_OR_ARRAY_HT_OR_NULL (restrict_str , restrict_ht )
770
+ ZEND_PARSE_PARAMETERS_END ();
771
+
772
+ intern = Z_XSL_P (id );
768
773
769
- ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (array_value ), entry ) {
774
+ if (restrict_ht ) {
775
+ ZEND_HASH_FOREACH_VAL (restrict_ht , entry ) {
770
776
zend_string * str = zval_try_get_string (entry );
771
777
if (UNEXPECTED (!str )) {
772
778
return ;
@@ -777,15 +783,11 @@ PHP_METHOD(XSLTProcessor, registerPHPFunctions)
777
783
} ZEND_HASH_FOREACH_END ();
778
784
779
785
intern -> registerPhpFunctions = 2 ;
780
- } else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "S" , & name ) == SUCCESS ) {
781
- intern = Z_XSL_P (id );
782
-
783
- ZVAL_LONG (& new_string ,1 );
784
- zend_hash_update (intern -> registered_phpfunctions , name , & new_string );
786
+ } else if (restrict_str ) {
787
+ ZVAL_LONG (& new_string , 1 );
788
+ zend_hash_update (intern -> registered_phpfunctions , restrict_str , & new_string );
785
789
intern -> registerPhpFunctions = 2 ;
786
-
787
- } else if (zend_parse_parameters_none () == SUCCESS ) {
788
- intern = Z_XSL_P (id );
790
+ } else {
789
791
intern -> registerPhpFunctions = 1 ;
790
792
}
791
793
}
0 commit comments