21
21
22
22
#include "php.h"
23
23
#include "php_xsl.h"
24
+ #include "php_xsl_arginfo.h"
24
25
#include "ext/libxml/php_libxml.h"
25
26
26
- /* {{{ arginfo */
27
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_import_stylesheet , 0 , 0 , 1 )
28
- ZEND_ARG_INFO (0 , doc )
29
- ZEND_END_ARG_INFO ();
30
-
31
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_transform_to_doc , 0 , 0 , 1 )
32
- ZEND_ARG_INFO (0 , doc )
33
- ZEND_END_ARG_INFO ();
34
-
35
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_transform_to_uri , 0 , 0 , 2 )
36
- ZEND_ARG_INFO (0 , doc )
37
- ZEND_ARG_INFO (0 , uri )
38
- ZEND_END_ARG_INFO ();
39
-
40
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_transform_to_xml , 0 , 0 , 1 )
41
- ZEND_ARG_INFO (0 , doc )
42
- ZEND_END_ARG_INFO ();
43
-
44
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_set_parameter , 0 , 0 , 2 )
45
- ZEND_ARG_INFO (0 , namespace )
46
- ZEND_ARG_INFO (0 , name )
47
- ZEND_ARG_INFO (0 , value )
48
- ZEND_END_ARG_INFO ();
49
-
50
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_get_parameter , 0 , 0 , 2 )
51
- ZEND_ARG_INFO (0 , namespace )
52
- ZEND_ARG_INFO (0 , name )
53
- ZEND_END_ARG_INFO ();
54
-
55
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_remove_parameter , 0 , 0 , 2 )
56
- ZEND_ARG_INFO (0 , namespace )
57
- ZEND_ARG_INFO (0 , name )
58
- ZEND_END_ARG_INFO ();
59
-
60
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_has_exslt_support , 0 , 0 , 0 )
61
- ZEND_END_ARG_INFO ();
62
-
63
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_register_php_functions , 0 , 0 , 0 )
64
- ZEND_ARG_INFO (0 , restrict )
65
- ZEND_END_ARG_INFO ();
66
-
67
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_set_profiling , 0 , 0 , 1 )
68
- ZEND_ARG_INFO (0 , filename )
69
- ZEND_END_ARG_INFO ();
70
-
71
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_set_security_prefs , 0 , 0 , 1 )
72
- ZEND_ARG_INFO (0 , securityPrefs )
73
- ZEND_END_ARG_INFO ();
74
-
75
- ZEND_BEGIN_ARG_INFO_EX (arginfo_xsl_xsltprocessor_get_security_prefs , 0 , 0 , 0 )
76
- ZEND_END_ARG_INFO ();
77
- /* }}} */
78
-
79
27
/*
80
28
* class xsl_xsltprocessor
81
29
*
@@ -84,18 +32,18 @@ ZEND_END_ARG_INFO();
84
32
*/
85
33
86
34
const zend_function_entry php_xsl_xsltprocessor_class_functions [] = {
87
- PHP_FALIAS (importStylesheet , xsl_xsltprocessor_import_stylesheet , arginfo_xsl_xsltprocessor_import_stylesheet )
88
- PHP_FALIAS (transformToDoc , xsl_xsltprocessor_transform_to_doc , arginfo_xsl_xsltprocessor_transform_to_doc )
89
- PHP_FALIAS (transformToUri , xsl_xsltprocessor_transform_to_uri , arginfo_xsl_xsltprocessor_transform_to_uri )
90
- PHP_FALIAS (transformToXml , xsl_xsltprocessor_transform_to_xml , arginfo_xsl_xsltprocessor_transform_to_xml )
91
- PHP_FALIAS (setParameter , xsl_xsltprocessor_set_parameter , arginfo_xsl_xsltprocessor_set_parameter )
92
- PHP_FALIAS (getParameter , xsl_xsltprocessor_get_parameter , arginfo_xsl_xsltprocessor_get_parameter )
93
- PHP_FALIAS (removeParameter , xsl_xsltprocessor_remove_parameter , arginfo_xsl_xsltprocessor_remove_parameter )
94
- PHP_FALIAS (hasExsltSupport , xsl_xsltprocessor_has_exslt_support , arginfo_xsl_xsltprocessor_has_exslt_support )
95
- PHP_FALIAS (registerPHPFunctions , xsl_xsltprocessor_register_php_functions , arginfo_xsl_xsltprocessor_register_php_functions )
96
- PHP_FALIAS (setProfiling , xsl_xsltprocessor_set_profiling , arginfo_xsl_xsltprocessor_set_profiling )
97
- PHP_FALIAS (setSecurityPrefs , xsl_xsltprocessor_set_security_prefs , arginfo_xsl_xsltprocessor_set_security_prefs )
98
- PHP_FALIAS (getSecurityPrefs , xsl_xsltprocessor_get_security_prefs , arginfo_xsl_xsltprocessor_get_security_prefs )
35
+ PHP_ME_MAPPING (importStylesheet , xsl_xsltprocessor_import_stylesheet , arginfo_class_XSLTProcessor_importStylesheet , ZEND_ACC_PUBLIC )
36
+ PHP_ME_MAPPING (transformToDoc , xsl_xsltprocessor_transform_to_doc , arginfo_class_XSLTProcessor_transformToDoc , ZEND_ACC_PUBLIC )
37
+ PHP_ME_MAPPING (transformToUri , xsl_xsltprocessor_transform_to_uri , arginfo_class_XSLTProcessor_transformToUri , ZEND_ACC_PUBLIC )
38
+ PHP_ME_MAPPING (transformToXml , xsl_xsltprocessor_transform_to_xml , arginfo_class_XSLTProcessor_transformToXml , ZEND_ACC_PUBLIC )
39
+ PHP_ME_MAPPING (setParameter , xsl_xsltprocessor_set_parameter , arginfo_class_XSLTProcessor_setParameter , ZEND_ACC_PUBLIC )
40
+ PHP_ME_MAPPING (getParameter , xsl_xsltprocessor_get_parameter , arginfo_class_XSLTProcessor_getParameter , ZEND_ACC_PUBLIC )
41
+ PHP_ME_MAPPING (removeParameter , xsl_xsltprocessor_remove_parameter , arginfo_class_XSLTProcessor_removeParameter , ZEND_ACC_PUBLIC )
42
+ PHP_ME_MAPPING (hasExsltSupport , xsl_xsltprocessor_has_exslt_support , arginfo_class_XSLTProcessor_hasExsltSupport , ZEND_ACC_PUBLIC )
43
+ PHP_ME_MAPPING (registerPHPFunctions , xsl_xsltprocessor_register_php_functions , arginfo_class_XSLTProcessor_registerPHPFunctions , ZEND_ACC_PUBLIC )
44
+ PHP_ME_MAPPING (setProfiling , xsl_xsltprocessor_set_profiling , arginfo_class_XSLTProcessor_setProfiling , ZEND_ACC_PUBLIC )
45
+ PHP_ME_MAPPING (setSecurityPrefs , xsl_xsltprocessor_set_security_prefs , arginfo_class_XSLTProcessor_setSecurityPrefs , ZEND_ACC_PUBLIC )
46
+ PHP_ME_MAPPING (getSecurityPrefs , xsl_xsltprocessor_get_security_prefs , arginfo_class_XSLTProcessor_getSecurityPrefs , ZEND_ACC_PUBLIC )
99
47
PHP_FE_END
100
48
};
101
49
@@ -765,7 +713,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
765
713
}
766
714
str = zval_try_get_string (entry );
767
715
if (UNEXPECTED (!str )) {
768
- return ;
716
+ RETURN_THROWS () ;
769
717
}
770
718
ZVAL_STR (& tmp , str );
771
719
zend_hash_update (intern -> parameter , string_key , & tmp );
@@ -867,11 +815,10 @@ PHP_FUNCTION(xsl_xsltprocessor_register_php_functions)
867
815
zend_hash_update (intern -> registered_phpfunctions , name , & new_string );
868
816
intern -> registerPhpFunctions = 2 ;
869
817
870
- } else {
818
+ } else if ( zend_parse_parameters_none () == SUCCESS ) {
871
819
intern = Z_XSL_P (id );
872
820
intern -> registerPhpFunctions = 1 ;
873
821
}
874
-
875
822
}
876
823
/* }}} end xsl_xsltprocessor_register_php_functions(); */
877
824
@@ -883,21 +830,21 @@ PHP_FUNCTION(xsl_xsltprocessor_set_profiling)
883
830
char * filename = NULL ;
884
831
size_t filename_len ;
885
832
DOM_GET_THIS (id );
833
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "p!" , & filename , & filename_len ) == FAILURE ) {
834
+ RETURN_THROWS ();
835
+ }
886
836
887
- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "p!" , & filename , & filename_len ) == SUCCESS ) {
888
- intern = Z_XSL_P (id );
889
- if (intern -> profiling ) {
890
- efree (intern -> profiling );
891
- }
892
- if (filename != NULL ) {
893
- intern -> profiling = estrndup (filename , filename_len );
894
- } else {
895
- intern -> profiling = NULL ;
896
- }
897
- RETURN_TRUE ;
837
+ intern = Z_XSL_P (id );
838
+ if (intern -> profiling ) {
839
+ efree (intern -> profiling );
840
+ }
841
+ if (filename != NULL ) {
842
+ intern -> profiling = estrndup (filename , filename_len );
898
843
} else {
899
- WRONG_PARAM_COUNT ;
844
+ intern -> profiling = NULL ;
900
845
}
846
+
847
+ RETURN_TRUE ;
901
848
}
902
849
/* }}} end xsl_xsltprocessor_set_profiling */
903
850
@@ -928,19 +875,24 @@ PHP_FUNCTION(xsl_xsltprocessor_get_security_prefs)
928
875
xsl_object * intern ;
929
876
930
877
DOM_GET_THIS (id );
931
- if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "" ) == SUCCESS ) {
932
- intern = Z_XSL_P (id );
933
- RETURN_LONG (intern -> securityPrefs );
934
- } else {
935
- WRONG_PARAM_COUNT ;
878
+ if (zend_parse_parameters_none () == FAILURE ) {
879
+ RETURN_THROWS ();
936
880
}
881
+
882
+ intern = Z_XSL_P (id );
883
+
884
+ RETURN_LONG (intern -> securityPrefs );
937
885
}
938
886
/* }}} end xsl_xsltprocessor_get_security_prefs */
939
887
940
888
/* {{{ proto bool xsl_xsltprocessor_has_exslt_support()
941
889
*/
942
890
PHP_FUNCTION (xsl_xsltprocessor_has_exslt_support )
943
891
{
892
+ if (zend_parse_parameters_none () == FAILURE ) {
893
+ RETURN_THROWS ();
894
+ }
895
+
944
896
#if HAVE_XSL_EXSLT
945
897
RETURN_TRUE ;
946
898
#else
0 commit comments