1--TEST-- 2GH-13833 (Applying zero offset to null pointer in zend_hash.c) 3--INI-- 4phar.require_hash=0 5phar.readonly=0 6--SKIPIF-- 7<?php if (defined("PHP_WINDOWS_VERSION_MAJOR")) die("skip Windows results in a different error"); ?> 8--FILE-- 9<?php 10$fname = __DIR__ . '/gh13833.phar'; 11$pname = 'phar://' . $fname; 12$file = "<?php 13Phar::mapPhar('hio'); 14__HALT_COMPILER(); ?>"; 15$files = array(); 16$files['a'] = 'a'; 17include 'files/phar_test.inc'; 18include $fname; 19 20$file = "<?php __HALT_COMPILER(); ?>"; 21$files['a'] = array('cont' => 'a'); 22include 'files/phar_test.inc'; 23 24$phar = new Phar($fname); 25$phar->setMetadata((object) ['my' => 'friend']); 26// NOTE: Phar will use the cached value of metadata if setMetaData was called on that Phar path before. 27// Save the writes to the phar and use a different file path. 28$fname_new = "$fname.copy.phar"; 29copy($fname, $fname_new); 30try { 31 new Phar($fname_new); 32} catch (UnexpectedValueException $e) { 33 echo $e->getMessage(), "\n"; 34} 35?> 36--EXTENSIONS-- 37phar 38--CLEAN-- 39<?php 40unlink(__DIR__ . '/gh13833.phar'); 41unlink(__DIR__ . '/gh13833.phar.copy.phar'); 42?> 43--CREDITS-- 44Yuancheng Jiang <yuancheng@comp.nus.edu.sg> 45Felix De Vliegher <felix.devliegher@gmail.com> 46--EXPECTF-- 47internal corruption of phar "%sgh13833.phar.copy.phar" (trying to read past buffer end) 48