#24441 [NEW]: array_filter dosen't allow this

From: Date: Tue, 01 Jul 2003 18:08:24 +0000
Subject: #24441 [NEW]: array_filter dosen't allow this
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-43010@lists.php.net to get a copy of this message
From: raptor at quox dot net Operating system: win2k adv server PHP version: 5.0.0b1 (beta1) PHP Bug Type: Arrays related Bug description: array_filter dosen't allow this 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 bug report at http://bugs.php.net/?id=24441&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24441&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24441&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24441&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24441&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24441&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24441&r=support Expected behavior: http://bugs.php.net/fix.php?id=24441&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24441&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24441&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24441&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24441&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24441&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24441&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24441&r=gnused

« previous php.bugs (#43010) next »