Hi, Finally today, the tidy team has corrected a bug in tidyLoadConfig. Attached is a patch that fixes PHP for the new behaviour (which is backward compatible with older libs) and I've also removed the repairString() and repairFile() methods (see why in my previous e-mail).
Regards, Nuno -------------------------------------------------- Tidy bug: http://sourceforge.net/tracker/?func=detail&atid=390963&aid=937271&group_id=27659 Tidy response: "I have changed your patch, so that the tidyLoadConfig() return value is consistent with the existing usage of tidyLoadConfig() - e.g. in "tidy.c": -1 if the file is not found 0 if the file was parsed correctly 1 if there were errors parsing the file (unknown option, etc...) i.e. no change to the last line of the function." --------------------------------------------------
Index: tidy.c =================================================================== RCS file: /repository/php-src/ext/tidy/tidy.c,v retrieving revision 1.55 diff -u -r1.55 tidy.c --- tidy.c 24 Jun 2004 14:20:59 -0000 1.55 +++ tidy.c 5 Jul 2004 09:41:31 -0000 @@ -86,9 +86,8 @@ } else { \ convert_to_string_ex(&_val); \ TIDY_SAFE_MODE_CHECK(Z_STRVAL_P(_val)); \ - if (tidyLoadConfig(_doc, Z_STRVAL_P(_val)) < 0) { \ + if (tidyLoadConfig(_doc, Z_STRVAL_P(_val)) != 0) { \ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not load configuration file '%s'", Z_STRVAL_P(_val)); \ - RETURN_FALSE; \ } \ } \ } @@ -250,8 +249,6 @@ TIDY_METHOD_MAP(cleanRepair, tidy_clean_repair, NULL) TIDY_DOC_ME(parseFile, NULL) TIDY_DOC_ME(parseString, NULL) - TIDY_METHOD_MAP(repairString, tidy_repair_string, NULL) - TIDY_METHOD_MAP(repairFile, tidy_repair_file, NULL) TIDY_METHOD_MAP(diagnose, tidy_diagnose, NULL) TIDY_METHOD_MAP(getRelease, tidy_get_release, NULL) TIDY_METHOD_MAP(getConfig, tidy_get_config, NULL) @@ -426,19 +423,7 @@ tidyOptSetBool(doc, TidyMark, no); TIDY_SET_DEFAULT_CONFIG(doc); - - /* We can't use TIDY_APPLY_CONFIG_ZVAL() here, it uses RETURN_FALSE */ - - if(Z_TYPE_P(config) == IS_ARRAY) { - _php_tidy_apply_config_array(doc, HASH_OF(config) TSRMLS_CC); - } else { - convert_to_string_ex(&config); - TIDY_SAFE_MODE_CHECK(Z_STRVAL_P(config)); - if (tidyLoadConfig(doc, Z_STRVAL_P(config)) < 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not load configuration file '%s'", Z_STRVAL_P(config)); - RETVAL_FALSE; - } - } + TIDY_APPLY_CONFIG_ZVAL(doc, config); if(enc_len) { if (tidySetCharEncoding(doc, enc) < 0) {
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php