tony2001                Wed Aug 30 22:32:35 2006 UTC

  Added files:                 
    /php-src/ext/tidy/tests     022.phpt 

  Modified files:              
    /php-src/ext/tidy   tidy.c 
  Log:
  fix a couple of leaks, add new test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.93&r2=1.94&diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.93 php-src/ext/tidy/tidy.c:1.94
--- php-src/ext/tidy/tidy.c:1.93        Mon Aug 14 15:17:03 2006
+++ php-src/ext/tidy/tidy.c     Wed Aug 30 22:32:35 2006
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: tidy.c,v 1.93 2006/08/14 15:17:03 nlopess Exp $ */
+/* $Id: tidy.c,v 1.94 2006/08/30 22:32:35 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -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: \
@@ -987,7 +987,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Tidy support", "enabled");
        php_info_print_table_row(2, "libTidy Release", (char 
*)tidyReleaseDate());
-       php_info_print_table_row(2, "Extension Version", 
PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.93 2006/08/14 15:17:03 nlopess Exp 
$)");
+       php_info_print_table_row(2, "Extension Version", 
PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.94 2006/08/30 22:32:35 tony2001 Exp 
$)");
        php_info_print_table_end();
 
        DISPLAY_INI_ENTRIES();
@@ -1398,7 +1398,7 @@
        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:

http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/022.phpt?view=markup&rev=1.1
Index: php-src/ext/tidy/tests/022.phpt
+++ php-src/ext/tidy/tests/022.phpt
--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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to