From: John Coggeshall Date: Fri, 16 Apr 2004 21:51:59 +0000 (+0000) Subject: Fixed construct bug and Windows build. X-Git-Tag: php-5.0.0RC2RC2~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba43e31e249f0d4de3d4e3f732a21cc457b1f853;p=php Fixed construct bug and Windows build. --- diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index b425b51eb7..ee140f7c71 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -330,6 +330,7 @@ void php_tidy_free(void *buf) void php_tidy_panic(ctmbstr msg) { + TSRMLS_FETCH(); php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not allocate memory for tidy! (Reason: %s)", (char *)msg); } @@ -1360,17 +1361,20 @@ TIDY_DOC_METHOD(__construct) obj = (PHPTidyObj *)zend_object_store_get_object(object 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)" : ""); - return; - } - - TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options); + 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)" : ""); + return; + } + + TIDY_APPLY_CONFIG_ZVAL(obj->ptdoc->doc, options); - php_tidy_parse_string(obj, contents, enc TSRMLS_CC); + php_tidy_parse_string(obj, contents, enc TSRMLS_CC); + + efree(contents); + } - efree(contents); - } TIDY_DOC_METHOD(parseFile)