#49331 [Opn]: extract(array('this' => 'abc')) in obj method

2009-08-22 Thread shenk...@php.net
 ID:   49331
 User updated by:  [email protected]
 Reported By:  [email protected]
 Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: win7
 PHP Version:  5.3.0
 New Comment:

class B {
public function test1() {
echo 'b';
}
}
class A {
public function test($arr) {
extract($arr);
var_dump($this);
$this->test1();
}
public function test1() {
echo 'a';
}
}
$a = new A;
$b = new B;
$arr['this'] = $b;
$a->test($arr);

-
object(B)#2 (0) {
}
a


Previous Comments:
----

[2009-08-22 16:23:11] [email protected]

Description:

class A {
public function test() {
var_dump($this);
$this = 'oh, mygod';
var_dump($this);
}
}
$a = new A;
$a->test();

Fatal error: Cannot re-assign $this in D:\www\testthis.php on line 13


Reproduce code:
---
class A {
public function test($arr) {
var_dump($this);
extract($arr);
var_dump($this);
}
}
$a = new A;
$arr['this'] = 'abc';
$a->test($arr);



Expected result:

Fatal error: Cannot re-assign $this in D:\www\testthis.php on line 13


Actual result:
--
it's ok!





-- 
Edit this bug report at http://bugs.php.net/?id=49331&edit=1



#49331 [NEW]: extract(array('this' => 'abc')) in obj method

2009-08-22 Thread shenk...@php.net
From: [email protected]
Operating system: win7
PHP version:  5.3.0
PHP Bug Type: Feature/Change Request
Bug description:  extract(array('this' => 'abc')) in obj method

Description:

class A {
public function test() {
var_dump($this);
$this = 'oh, mygod';
var_dump($this);
}
}
$a = new A;
$a->test();

Fatal error: Cannot re-assign $this in D:\www\testthis.php on line 13


Reproduce code:
---
class A {
public function test($arr) {
var_dump($this);
extract($arr);
var_dump($this);
}
}
$a = new A;
$arr['this'] = 'abc';
$a->test($arr);



Expected result:

Fatal error: Cannot re-assign $this in D:\www\testthis.php on line 13


Actual result:
--
it's ok!

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