Add test for bug #69107: finfo no longer detects PHP files
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 8 Aug 2016 16:43:33 +0000 (18:43 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 8 Aug 2016 16:43:33 +0000 (18:43 +0200)
ext/fileinfo/tests/bug69107.phpt [new file with mode: 0644]

diff --git a/ext/fileinfo/tests/bug69107.phpt b/ext/fileinfo/tests/bug69107.phpt
new file mode 100644 (file)
index 0000000..9a7b26b
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+Bug #69107 (finfo no longer detects PHP files)
+--SKIPIF--
+<?php
+if (!extension_loaded('fileinfo')) die('skip fileinfo extension not available');
+?>
+--FILE--
+<?php
+$finfo = new finfo(FILEINFO_MIME_TYPE);
+
+var_dump($finfo->buffer("<?php\nclass A{}"));
+var_dump($finfo->buffer("<?php class A{}"));
+var_dump($finfo->buffer("<?php\tclass A{}"));
+var_dump($finfo->buffer("<?php\n\rclass A{}"));
+?>
+===DONE===
+--EXPECT--
+string(10) "text/x-php"
+string(10) "text/x-php"
+string(10) "text/x-php"
+string(10) "text/x-php"
+===DONE===