summaryrefslogtreecommitdiff
path: root/ext/tidy
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-08-30 22:34:48 +0000
committerAntony Dovgal <tony2001@php.net>2006-08-30 22:34:48 +0000
commit434d5e9be40c8147137070f6d1eeb5a3fee73517 (patch)
treedbfba0ed86986de97005029a0172749d14072d0d /ext/tidy
parent235e3939d5a9607456aacb3bde3c06b425dca0a9 (diff)
downloadphp-git-434d5e9be40c8147137070f6d1eeb5a3fee73517.tar.gz
MFH: fix leak, add test
Diffstat (limited to 'ext/tidy')
-rw-r--r--ext/tidy/tests/019.phpt38
-rw-r--r--ext/tidy/tidy.c2
2 files changed, 39 insertions, 1 deletions
diff --git a/ext/tidy/tests/019.phpt b/ext/tidy/tests/019.phpt
new file mode 100644
index 0000000000..9d2c693cdb
--- /dev/null
+++ b/ext/tidy/tests/019.phpt
@@ -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
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 7057a56899..ba357c3c4b 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_SAFE_MODE_CHECK(Z_STRVAL_P(_val)); \
switch (tidyLoadConfig(_doc, Z_STRVAL_P(_val))) { \
case -1: \