#2 Error re-assigning $this in http.php

open
nobody
None
5
2005-12-21
2005-12-21
Brice Fisher
No

I got the metaphilter source using:

cvs -d :pserver:anonymous@cvs.sourceforge.net:/cvsroot/mephi-fork co metaphilter

After configuring, I tried to visit the URL for the philter, but just got a blank page. Consulting the logs, I saw:

PHP Fatal error: Cannot re-assign $this in /www/html/metaphilter/release/mp/http.php on line 33

Which refers to this bit of code:

if ($parameters['location']) {
fclose($request);
if ($response_code==201) $this=new httpRequest($parameters['location'],GET);
$this=new httpRequest($parameters['location'],$method,$data,$headers);
return;
}

Which does indeed look suspect ("$this = "), especially in PHP5.

$ php -v
PHP 5.0.4 (cli) (built: May 9 2005 11:21:11)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies

I tried just making the recursive call without re-assigning $this, but there's apparently more going on than appears at first glance.

Discussion