@@ -1761,7 +1761,7 @@ PHP_FUNCTION(dom_document_save)
1761
1761
char * file ;
1762
1762
long options = 0 ;
1763
1763
1764
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1764
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op |l" , & id , dom_document_class_entry , & file , & file_len , & options ) == FAILURE ) {
1765
1765
return ;
1766
1766
}
1767
1767
@@ -1990,7 +1990,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
1990
1990
int is_valid ;
1991
1991
char resolved_path [MAXPATHLEN + 1 ];
1992
1992
1993
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
1993
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
1994
1994
return ;
1995
1995
}
1996
1996
@@ -2003,6 +2003,10 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
2003
2003
2004
2004
switch (type ) {
2005
2005
case DOM_LOAD_FILE :
2006
+ if (CHECK_NULL_PATH (source , source_len )) {
2007
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid Schema file source" );
2008
+ RETURN_FALSE ;
2009
+ }
2006
2010
valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
2007
2011
if (!valid_file ) {
2008
2012
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid Schema file source" );
@@ -2079,7 +2083,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
2079
2083
int is_valid ;
2080
2084
char resolved_path [MAXPATHLEN + 1 ];
2081
2085
2082
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
2086
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os " , & id , dom_document_class_entry , & source , & source_len ) == FAILURE ) {
2083
2087
return ;
2084
2088
}
2085
2089
@@ -2092,6 +2096,10 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ
2092
2096
2093
2097
switch (type ) {
2094
2098
case DOM_LOAD_FILE :
2099
+ if (CHECK_NULL_PATH (source , source_len )) {
2100
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid RelaxNG file source" );
2101
+ RETURN_FALSE ;
2102
+ }
2095
2103
valid_file = _dom_get_valid_file_path (source , resolved_path , MAXPATHLEN TSRMLS_CC );
2096
2104
if (!valid_file ) {
2097
2105
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid RelaxNG file source" );
@@ -2172,7 +2180,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
2172
2180
2173
2181
id = getThis ();
2174
2182
2175
- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "p |l" , & source , & source_len , & options ) == FAILURE ) {
2183
+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "s |l" , & source , & source_len , & options ) == FAILURE ) {
2176
2184
return ;
2177
2185
}
2178
2186
@@ -2182,6 +2190,10 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
2182
2190
}
2183
2191
2184
2192
if (mode == DOM_LOAD_FILE ) {
2193
+ if (CHECK_NULL_PATH (source , source_len )) {
2194
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid file source ");
2195
+ RETURN_FALSE ;
2196
+ }
2185
2197
ctxt = htmlCreateFileParserCtxt (source , NULL );
2186
2198
} else {
2187
2199
source_len = xmlStrlen (source );
@@ -2270,7 +2282,7 @@ PHP_FUNCTION(dom_document_save_html_file)
2270
2282
char * file ;
2271
2283
const char * encoding ;
2272
2284
2273
- if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Os " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2285
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "Op " , & id , dom_document_class_entry , & file , & file_len ) == FAILURE ) {
2274
2286
return ;
2275
2287
}
2276
2288
0 commit comments