From:             
Operating system: Linux
PHP version:      5.3.5
Package:          Filesystem function related
Bug Type:         Bug
Bug description:Bogus behavior of Zend in relation to stream wrappers

Description:
------------
See test script: when returning a undefined key from stream_stat(), the
behavior 

of the Zend interpretor changes.



I confirmed this on PHP 5.3.5, pjoye reproduced it separately.

Test script:
---------------
--TEST--

Test that user space streams do not break the fabric of the universe.

--FILE--

<?php



class UserSpaceStream {

  public function stream_open($uri, $mode, $options, &$opened_path) {

    return TRUE;

  }



  public function stream_read($count) {

    return '';

  }



  public function stream_write($data) {

    return TRUE;

  }



  public function stream_eof() {

    return FALSE;

  }



  public function stream_stat() {

    $stat = array();



    // This triggers (correctly) a "Notice: Undefined index: size in %s on
line %d".

    $array = array();

    $stat['size'] = $array['size'];



    return $stat;

  }



}



stream_wrapper_register("test", "UserSpaceStream");



// Alone, the assignment of a key to an undefined variable is legal.

$undefined_variable['key'] = 'value';



// This fstat() call triggers something weird...

$h = fopen('test://anyfile', 'r');

fstat($h);



// ... from this point, PHP triggers a "Warning: Cannot use a scalar value
as

// an array" for each assignement of array keys to undefined variables.

$undefined_variable2['key'] = 'value';



?>

--EXPECTF--

Notice: Undefined index: size in %s on line %d




-- 
Edit bug report at http://bugs.php.net/bug.php?id=54119&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54119&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54119&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54119&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54119&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54119&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54119&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54119&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54119&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54119&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54119&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54119&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54119&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54119&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54119&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54119&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54119&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54119&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54119&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54119&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54119&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54119&r=mysqlcfg

Reply via email to