summaryrefslogtreecommitdiff
path: root/ext/phar/tests/bug46032.phpt
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-09-11 03:29:42 +0000
committerGreg Beaver <cellog@php.net>2008-09-11 03:29:42 +0000
commit6391270b8560b0336e1adc3c03789a67e4ee2b5b (patch)
tree5fe96e13c94e98c4575524bd99716cc080bd1948 /ext/phar/tests/bug46032.phpt
parent5ecafdc83b2d6647e49163eede1de53afdf47e17 (diff)
downloadphp-git-6391270b8560b0336e1adc3c03789a67e4ee2b5b.tar.gz
MFPHP5: fix Bug #46032: PharData::__construct wrong memory read
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 0000000000..be42b04b5c
--- /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 = __DIR__ .'/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(%d) "%smytest"
+string(%d) "%smytest"
+
+Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar '0000000000000000000', file extension (or combination) not recognised' in %sbug46032.php:%d
+Stack trace:
+#0 /home/cellog/workspace/php5/ext/phar/tests/bug46032.php(%d): PharData->__construct('000000000000000...')
+#1 {main}
+ thrown in %sbug46032.php on line %d