#24441 [Opn->Csd]: array_filter dosen't allow this
| From: | sterling@php.net | Date: | Wed, 02 Jul 2003 14:58:48 +0000 |
| Subject: | #24441 [Opn->Csd]: array_filter dosen't allow this | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-43089@lists.php.net to get a copy of this message | ||
ID: 24441
Updated by: sterling@php.net
Reported By: raptor at quox dot net
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: win2k adv server
PHP Version: 5.0.0b1 (beta1)
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-07-01 13:08:24] raptor at quox dot net
Description:
------------
A callback function of array_filter in a class dosen't allow the use of
$this.
Reproduce code:
---------------
class test {
var $filter = '' //is a regex
var $array; //has many values
function test() {
array_filter($array, array($this, 'filter'));
}
function filter( $value ) {
return preg_match("/$this->filter/i", $value);
}
}
Expected result:
----------------
The array should be filtered after the regex of the $this->filter
value;
Actual result:
--------------
Fatal error: Using $this when not in object context
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24441&edit=1