Mantis - Quercus
Viewing Issue Advanced Details
1965 minor always 08-22-07 15:41 10-17-07 17:01
rjc  
ferg  
normal  
closed 3.1.2  
fixed  
none    
none 3.1.4  
0001965: __get() and infinite loop
MediaWiki contains the following code in includes/filerepo/File.php


 function __get( $name ) {
                $function = array( $this, 'get' . ucfirst( $name ) );
                if ( !is_callable( $function ) ) {
                        return null;
                } else {
                        $this->$name = call_user_func( $function );
                        return $this->$name;
                }
        }

It also includes a function called getName()

 public function getName() {
                if ( !isset( $this->name ) ) {
                        $this->name = $this->repo->getNameFromTitle( $this->title );
                }
                return $this->name;
        }

Calling getName() produces an infinite loop with a stack overflow. This code works in PHP5. Apparently, in PHP5 references to property fields via $this do not invoke __get().

Notes
(0002226)
rjc   
08-23-07 12:25   
I filed this as minor, but on retrospect, it seems like a major bug.
(0002359)
ferg   
10-17-07 17:01   
php/09k{c,d,e} php/39k{c,d,e}