File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -3,32 +3,17 @@ Bug #70417 (PharData::compress() doesn't close temp file)
33--EXTENSIONS--
44phar
55zlib
6- --SKIPIF--
7- <?php 
8- 
9- exec ('lsof -p  '  . getmypid (), $ out , $ status );
10- if  ($ status  !== 0 ) {
11-     die ("skip lsof(8) not available " );
12- }
13- if  (!str_starts_with ($ out [0 ], 'COMMAND ' )) {
14-     die ("skip Might be a different lsof " );
15- }
16- ?> 
176--FILE--
187<?php 
19- function  countOpenFiles () {
20-     exec ('lsof -p  '  . escapeshellarg (getmypid ()) . ' 2> /dev/null ' , $ out );  // Note: valgrind can produce false positives for /usr/bin/lsof 
21-     return  count ($ out );
22- }
238$ filename  = __DIR__  . '/bug70417.tar ' ;
249@unlink ("$ filename.gz " );
25- $ openFiles1   = countOpenFiles ( );
10+ $ resBefore   = count ( get_resources () );
2611$ arch  = new  PharData ($ filename );
2712$ arch ->addFromString ('foo ' , 'bar ' );
2813$ arch ->compress (Phar::GZ );
2914unset($ arch );
30- $ openFiles2   = countOpenFiles ( );
31- var_dump ($ openFiles1   === $ openFiles2  );
15+ $ resAfter   = count ( get_resources () );
16+ var_dump ($ resBefore   === $ resAfter  );
3217?> 
3318--CLEAN--
3419<?php 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments