summaryrefslogtreecommitdiff
path: root/ext/tidy/tests
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-10-22 16:04:22 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-10-22 16:04:22 +0200
commitd4bf0799b80d8bbd128e9e41624779d844033a42 (patch)
tree1bd5d382c32558ef9d5e2cb8158033fcb67b21da /ext/tidy/tests
parentd4200ba6cfd6909265643516e658560502caec70 (diff)
downloadphp-git-d4bf0799b80d8bbd128e9e41624779d844033a42.tar.gz
Don't crash on uninitialized tidy object
"Uninitialized" here means that the object was created ordinarily -- no constructor skipping involved. Most tidy methods seem to handle this fine, but these three need to be guarded.
Diffstat (limited to 'ext/tidy/tests')
-rw-r--r--ext/tidy/tests/uninitialized.phpt29
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/tidy/tests/uninitialized.phpt b/ext/tidy/tests/uninitialized.phpt
new file mode 100644
index 0000000000..3533f0d345
--- /dev/null
+++ b/ext/tidy/tests/uninitialized.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Operations on uninitialized tidy object
+--SKIPIF--
+<?php if (!extension_loaded("tidy")) print "skip"; ?>
+--FILE--
+<?php
+
+$tidy = new tidy;
+try {
+ var_dump($tidy->getHtmlVer());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($tidy->isXhtml());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump($tidy->isXml());
+} catch (Error $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+tidy object is not initialized
+tidy object is not initialized
+tidy object is not initialized