Hey, Bug 24441 (http://bugs.php.net/bug.php?id=24441), displays the following problem:
<?php
class test {
var $filter = 'hello';
var $array = array('hello', 'hello world', 'hey there');
function test() {
array_filter($this->array, array($this, 'filter'));
}
function filter ($value) {
return preg_match("/{$this->filter}/i", $value);
}
}
$t = new test;
var_dump($t->filter('hello world'));
?>
That script (also attached), will give an error:
Fatal error: Using $this when not in object context in
/data/home/sterling/work/os/php/php-src/arraybug.php on line 11
If you comment out the test() function declaration, everything will work
as expected.
-Sterling
--
"First they ignore you, then they laugh at you,
then they fight you, then you win."
- Gandhi
arraybug.php
Description: application/php
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
