#42610 [Opn->WFx]: $this can be reassigned using references

From: Date: Tue, 11 Sep 2007 15:54:16 +0000
Subject: #42610 [Opn->WFx]: $this can be reassigned using references
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117398@lists.php.net to get a copy of this message
ID: 42610 Updated by: iliaa@php.net Reported By: php dot 20 dot zsh at spamgourmet dot com -Status: Open +Status: Wont fix Bug Type: Scripting Engine problem Operating System: * PHP Version: 5.2.4 New Comment: It is nearly impossible to track back references to this within the code to detect attempts to circumvent normal overwrite limits. Previous Comments: ------------------------------------------------------------------------ [2007-09-10 12:00:49] php dot 20 dot zsh at spamgourmet dot com Description: ------------ $this can be changed when you use an automagic function. Reproduce code: --------------- <?php function change(&$var, $value) { $var = $value; return true; } class foo { function __construct() { change($this, false); var_dump($this); } } $foo = new foo; ?> Expected result: ---------------- HTTP/1.1 500 Internal Server Error Fatal error: Cannot re-assign $this in %s on line %d Actual result: -------------- HTTP/1.1 200 OK bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42610&edit=1

« previous php.bugs (#117398) next »