From: Rasmus Lerdorf Date: Sun, 12 Jun 2011 14:49:10 +0000 (+0000) Subject: Don't expect a path for tidy_repair_string() and fix the tests X-Git-Tag: php-5.5.0alpha1~1946 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b88a5db4dd9e50bdf515e1176250835eba897b2d;p=php Don't expect a path for tidy_repair_string() and fix the tests --- diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt index 91bbc016ed..5e9c38d75a 100644 --- a/ext/tidy/tests/019.phpt +++ b/ext/tidy/tests/019.phpt @@ -38,5 +38,5 @@ Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d -Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s on line %d +Warning: tidy_repair_file() expects parameter 1 to be a valid path, array given in %s on line %d Done diff --git a/ext/tidy/tests/022.phpt b/ext/tidy/tests/022.phpt index 91bbc016ed..5e9c38d75a 100644 --- a/ext/tidy/tests/022.phpt +++ b/ext/tidy/tests/022.phpt @@ -38,5 +38,5 @@ Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d Warning: tidy_repair_file(): Filename cannot be empty in %s on line %d -Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s on line %d +Warning: tidy_repair_file() expects parameter 1 to be a valid path, array given in %s on line %d Done diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index cf8e290569..2b859683f3 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -558,15 +558,17 @@ static void php_tidy_quick_repair(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_fil TidyBuffer *errbuf; zval **config = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|Zsb", &arg1, &arg1_len, &config, &enc, &enc_len, &use_include_path) == FAILURE) { - RETURN_FALSE; - } - if (is_file) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|Zsb", &arg1, &arg1_len, &config, &enc, &enc_len, &use_include_path) == FAILURE) { + RETURN_FALSE; + } if (!(data = php_tidy_file_to_mem(arg1, use_include_path, &data_len TSRMLS_CC))) { RETURN_FALSE; } } else { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|Zsb", &arg1, &arg1_len, &config, &enc, &enc_len, &use_include_path) == FAILURE) { + RETURN_FALSE; + } data = arg1; data_len = arg1_len; }