john Sun Apr 18 03:58:19 2004 EDT Modified files: /php-src/ext/tidy tidy.c /php-src/ext/tidy/tests 007.phpt Log: Fixing a tidy_getopt() bug, and converting all exceptions to E_WARNING http://cvs.php.net/diff.php/php-src/ext/tidy/tidy.c?r1=1.46&r2=1.47&ty=u Index: php-src/ext/tidy/tidy.c diff -u php-src/ext/tidy/tidy.c:1.46 php-src/ext/tidy/tidy.c:1.47 --- php-src/ext/tidy/tidy.c:1.46 Fri Apr 16 17:51:59 2004 +++ php-src/ext/tidy/tidy.c Sun Apr 18 03:58:18 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tidy.c,v 1.46 2004/04/16 21:51:59 john Exp $ */ +/* $Id: tidy.c,v 1.47 2004/04/18 07:58:18 john Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -293,9 +293,7 @@ static zend_object_handlers tidy_object_handlers_exception; zend_module_entry tidy_module_entry = { -#if ZEND_MODULE_API_NO >= 20010901 STANDARD_MODULE_HEADER, -#endif "tidy", tidy_functions, PHP_MINIT(tidy), @@ -303,9 +301,7 @@ PHP_RINIT(tidy), PHP_RSHUTDOWN(tidy), PHP_MINFO(tidy), -#if ZEND_MODULE_API_NO >= 20010901 PHP_TIDY_MODULE_VERSION, -#endif STANDARD_MODULE_PROPERTIES }; @@ -395,7 +391,7 @@ break; default: - TIDY_THROW("Unable to determine type of configuration option"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to determine type of configuration option"); break; } @@ -446,14 +442,14 @@ convert_to_string_ex(&config); TIDY_SAFE_MODE_CHECK(Z_STRVAL_P(config)); if (tidyLoadConfig(doc, Z_STRVAL_P(config)) < 0) { - TIDY_THROW("Could not load configuration file '%s'", Z_STRVAL_P(config)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not load configuration file '%s'", Z_STRVAL_P(config)); RETVAL_FALSE; } } if(enc_len) { if (tidySetCharEncoding(doc, enc) < 0) { - TIDY_THROW("Could not set encoding '%s'", enc); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not set encoding '%s'", enc); RETVAL_FALSE; } } @@ -879,13 +875,13 @@ { if(enc) { if (tidySetCharEncoding(obj->ptdoc->doc, enc) < 0) { - TIDY_THROW("Could not set encoding '%s'", enc); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not set encoding '%s'", enc); return FAILURE; } } if (tidyParseString(obj->ptdoc->doc, string) < 0) { - TIDY_THROW("%s", obj->ptdoc->errbuf->bp); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", obj->ptdoc->errbuf->bp); return FAILURE; } else { @@ -956,7 +952,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.46 2004/04/16 21:51:59 john Exp $)"); + php_info_print_table_row(2, "Extension Version", PHP_TIDY_MODULE_VERSION " ($Id: tidy.c,v 1.47 2004/04/18 07:58:18 john Exp $)"); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -991,7 +987,7 @@ if (input_len > 1) { if (tidyParseString(doc, input) < 0 || tidyCleanAndRepair(doc) < 0) { - TIDY_THROW(errbuf.bp); + php_error_docref(NULL TSRMLS_CC, E_WARNING, errbuf.bp); RETVAL_NULL(); } else { TidyBuffer output = {0}; @@ -1087,7 +1083,7 @@ obj = (PHPTidyObj *) zend_object_store_get_object(return_value TSRMLS_CC); if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) { - TIDY_THROW("Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : ""); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : ""); return; } @@ -1312,7 +1308,7 @@ opt = tidyGetOptionByName(obj->ptdoc->doc, optname); if (!opt) { - TIDY_THROW("Unknown Tidy Configuration Option '%s'", optname); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown Tidy Configuration Option '%s'", optname); RETURN_FALSE; } @@ -1330,12 +1326,12 @@ if (optval) { RETURN_TRUE; } else { - RETURN_NULL(); + RETURN_FALSE; } break; default: - TIDY_THROW("Unable to determine type of configuration option"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to determine type of configuration option"); break; } @@ -1364,7 +1360,7 @@ if(inputfile) { if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) { - TIDY_THROW("Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : ""); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : ""); return; } @@ -1396,7 +1392,7 @@ } if (!(contents = php_tidy_file_to_mem(inputfile, use_include_path TSRMLS_CC))) { - TIDY_THROW("Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : ""); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot Load '%s' into memory %s", inputfile, (use_include_path) ? "(Using include path)" : ""); RETURN_FALSE; } http://cvs.php.net/diff.php/php-src/ext/tidy/tests/007.phpt?r1=1.7&r2=1.8&ty=u Index: php-src/ext/tidy/tests/007.phpt diff -u php-src/ext/tidy/tests/007.phpt:1.7 php-src/ext/tidy/tests/007.phpt:1.8 --- php-src/ext/tidy/tests/007.phpt:1.7 Wed Feb 4 20:38:59 2004 +++ php-src/ext/tidy/tests/007.phpt Sun Apr 18 03:58:19 2004 @@ -1,5 +1,5 @@ --TEST-- -Verbose tidy_setopt() / tidy_getopt() +Verbose tidy_getopt() --SKIPIF-- <?php if (!extension_loaded("tidy")) print "skip"; ?> --INI-- @@ -16,6 +16,6 @@ ?> --EXPECT-- -Current Value of 'tidy-mark': NULL +Current Value of 'tidy-mark': bool(false) Current Value of 'error-file': string(0) "" Current Value of 'tab-size': int(8)
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php