> 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
Nice! Today I've reviewed all my test scripts about tidy and here are my conclusions: * You missed half of my patch and didn't changed the $tidy->error_buf (corrected in my patch) * ParseFile and tidy_parse_file echo two errors if they don't find the file to open (corrected in my patch) * I've removed also TIDY_THROW in my patch as it isn't needed anymore * if the config parameter is passed as string (the name of the file) and the file doesn't exist, tidy won't echo any error (tidylib itself error. I've sent a patch to the authors: http://sourceforge.net/tracker/index.php?func=detail&aid=937271&group_id=27659&atid=390963) After correcting these small errors, I think everything is OK in the tidy extension :) Nuno
Index: tidy.c =================================================================== RCS file: /repository/php-src/ext/tidy/tidy.c,v retrieving revision 1.47 diff -u -r1.47 tidy.c --- tidy.c 18 Apr 2004 07:58:18 -0000 1.47 +++ tidy.c 18 Apr 2004 11:54:13 -0000 @@ -93,8 +93,6 @@ } \ } -#define TIDY_THROW _php_tidy_throw_exception - #define REGISTER_TIDY_CLASS(classname, name, parent) \ { \ zend_class_entry ce; \ @@ -330,27 +328,6 @@ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not allocate memory for tidy! (Reason: %s)", (char *)msg); } -static void _php_tidy_throw_exception(char *message, ...) -{ - char *msg; - va_list ap; - - TSRMLS_FETCH(); - - va_start(ap, message); - vspprintf(&msg, 0, message, ap); - - if(TG(inst)) { - zend_throw_exception(tidy_ce_exception, msg, 0 TSRMLS_CC); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, msg); - } - - va_end(ap); - efree(msg); - -} - static int _php_tidy_set_tidy_opt(TidyDoc doc, char *optname, zval *value TSRMLS_DC) { TidyOption opt; @@ -486,7 +463,7 @@ int len; char *data = NULL; - if (!(stream = php_stream_open_wrapper(filename, "rb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) { + if (!(stream = php_stream_open_wrapper(filename, "rb", (use_include_path ? USE_PATH : 0) | ENFORCE_SAFE_MODE, NULL))) { return NULL; } if ((len = php_stream_copy_to_mem(stream, &data, PHP_STREAM_COPY_ALL, 0)) == 0) { @@ -693,7 +670,7 @@ if (obj->ptdoc->errbuf->size) { MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, obj->ptdoc->errbuf->bp, obj->ptdoc->errbuf->size, TRUE); - zend_hash_update(obj->std.properties, "error_buf", sizeof("error_buf"), (void *)&temp, sizeof(zval *), NULL); + zend_hash_update(obj->std.properties, "ErrorBuffer", sizeof("ErrorBuffer"), (void *)&temp, sizeof(zval *), NULL); } } @@ -777,7 +754,7 @@ break; case is_doc: - ADD_PROPERTY_NULL(obj->std.properties, error_buf); + ADD_PROPERTY_NULL(obj->std.properties, ErrorBuffer); ADD_PROPERTY_NULL(obj->std.properties, value); break;
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php