summaryrefslogtreecommitdiff
path: root/ext/phar/tests/bug46032.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/phar/tests/bug46032.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/phar/tests/bug46032.phpt')
-rw-r--r--ext/phar/tests/bug46032.phpt34
1 files changed, 34 insertions, 0 deletions
diff --git a/ext/phar/tests/bug46032.phpt b/ext/phar/tests/bug46032.phpt
new file mode 100644
index 0000000..7700e9b
--- /dev/null
+++ b/ext/phar/tests/bug46032.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Phar: bug #46032: PharData::__construct wrong memory read
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (getenv('SKIP_SLOW_TESTS')) die('skip'); ?>
+--FILE--
+<?php
+
+$a = dirname(__FILE__) .'/mytest';
+
+try {
+ new phar($a);
+} catch (exception $e) { }
+
+var_dump($a);
+
+try {
+ new phar($a);
+} catch (exception $e) { }
+
+var_dump($a);
+
+new phardata('0000000000000000000');
+?>
+===DONE===
+--EXPECTF--
+%string|unicode%(%d) "%smytest"
+%string|unicode%(%d) "%smytest"
+
+Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar '0000000000000000000', file extension (or combination) not recognised or the directory does not exist' in %sbug46032.php:%d
+Stack trace:
+#0 %sbug46032.php(%d): PharData->__construct('000000000000000...')
+#1 {main}
+ thrown in %sbug46032.php on line %d