1--TEST-- 2Phar - bug #69720 - Null pointer dereference in phar_get_fp_offset() 3--SKIPIF-- 4<?php if (!extension_loaded("phar")) die("skip"); ?> 5--FILE-- 6<?php 7try { 8 // open an existing phar 9 $p = new Phar(__DIR__."/bug69720.phar",0); 10 // Phar extends SPL's DirectoryIterator class 11 echo $p->getMetadata(); 12 foreach (new RecursiveIteratorIterator($p) as $file) { 13 // $file is a PharFileInfo class, and inherits from SplFileInfo 14 $temp=""; 15 $temp= $file->getFileName() . "\n"; 16 $temp.=file_get_contents($file->getPathName()) . "\n"; // display contents 17 var_dump($file->getMetadata()); 18 } 19} 20 catch (Exception $e) { 21 echo 'Could not open Phar: ', $e; 22} 23?> 24--EXPECTF-- 25 26MY_METADATA_NULL 27 28Warning: file_get_contents(phar://%s): failed to open stream: phar error: "test.php" is not a file in phar "%s.phar" in %s.php on line %d 29array(1) { 30 ["whatever"]=> 31 int(123) 32} 33object(DateTime)#2 (3) { 34 ["date"]=> 35 string(26) "2000-01-01 00:00:00.000000" 36 ["timezone_type"]=> 37 int(3) 38 ["timezone"]=> 39 string(3) "UTC" 40} 41