From 9a3f6bfa40aed0b4d551ef273c362502b0f14501 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 30 Aug 2006 22:32:35 +0000 Subject: [PATCH] fix a couple of leaks, add new test --- ext/tidy/tests/022.phpt | 38 ++++++++++++++++++++++++++++++++++++++ ext/tidy/tidy.c | 4 ++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 ext/tidy/tests/022.phpt diff --git a/ext/tidy/tests/022.phpt b/ext/tidy/tests/022.phpt new file mode 100644 index 0000000000..9d2c693cdb --- /dev/null +++ b/ext/tidy/tests/022.phpt @@ -0,0 +1,38 @@ +--TEST-- +tidy_repair_*() and invalid parameters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d + +Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d + +Warning: tidy_repair_string(): Could not load configuration file '' in %s on line %d + +Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d + +Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d + +Warning: tidy_repair_string() expects parameter 1 to be string, array given in %s on line %d + +Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s on line %d +Done diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 7e14c64e76..1addb08b80 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -89,7 +89,7 @@ if(Z_TYPE_P(_val) == IS_ARRAY) { \ _php_tidy_apply_config_array(_doc, HASH_OF(_val) TSRMLS_CC); \ } else { \ - convert_to_string_ex(&_val); \ + convert_to_string(_val); \ TIDY_OPEN_BASEDIR_CHECK(Z_STRVAL_P(_val)); \ switch (tidyLoadConfig(_doc, Z_STRVAL_P(_val))) { \ case -1: \ @@ -1398,7 +1398,7 @@ static PHP_FUNCTION(tidy_getopt) optval = php_tidy_get_opt_val(obj->ptdoc, opt, &optt TSRMLS_CC); switch (optt) { case TidyString: - RETURN_ASCII_STRING((char *)optval, 0); + RETURN_ASCII_STRING((char *)optval, ZSTR_AUTOFREE); break; case TidyInteger: -- 2.40.0