]> granicus.if.org Git - php/commitdiff
MFH: fix leak, add test
authorAntony Dovgal <tony2001@php.net>
Wed, 30 Aug 2006 22:34:48 +0000 (22:34 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 30 Aug 2006 22:34:48 +0000 (22:34 +0000)
ext/tidy/tests/019.phpt [new file with mode: 0644]
ext/tidy/tidy.c

diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt
new file mode 100644 (file)
index 0000000..9d2c693
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+tidy_repair_*() and invalid parameters
+--SKIPIF--
+<?php if (!extension_loaded("tidy")) print "skip"; ?>
+--FILE--
+<?php
+
+$l = 1;
+$s = "";
+$a = array();
+
+tidy_repair_string($s, $l, $l, $l);
+tidy_repair_string($s, $s, $s, $s);
+tidy_repair_string($l, $l, $l ,$l);
+tidy_repair_string($a, $a, $a, $a);
+
+tidy_repair_file($s, $l, $l, $l);
+tidy_repair_file($s, $s, $s, $s);
+tidy_repair_file($l, $l, $l ,$l);
+tidy_repair_file($a, $a, $a, $a);
+
+echo "Done\n";
+?>
+--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
index 7057a568994b410c5ef1ddc2e1869728d0036ae3..ba357c3c4b7c57c1857c6912e4e8c7846a0fc259 100644 (file)
@@ -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_SAFE_MODE_CHECK(Z_STRVAL_P(_val)); \
             switch (tidyLoadConfig(_doc, Z_STRVAL_P(_val))) { \
               case -1: \