summaryrefslogtreecommitdiff
path: root/ext/tidy/tidy.c
diff options
context:
space:
mode:
authorJohn Coggeshall <john@php.net>2004-04-16 21:51:59 +0000
committerJohn Coggeshall <john@php.net>2004-04-16 21:51:59 +0000
commitba43e31e249f0d4de3d4e3f732a21cc457b1f853 (patch)
tree97471a9efdb210b7db4507d71e2734ac72ae5050 /ext/tidy/tidy.c
parent2ed9c955b801bde1d2e77b1be6e05feeb28c6e0d (diff)
downloadphp-git-ba43e31e249f0d4de3d4e3f732a21cc457b1f853.tar.gz
Fixed construct bug and Windows build.
Diffstat (limited to 'ext/tidy/tidy.c')
-rw-r--r--ext/tidy/tidy.c22
1 files changed, 13 insertions, 9 deletions
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)