[PHP-DEV] PHP 4.0 Bug #4674: limitations of array_walk() calling methods or single-parameter functions From: waldschrott <email protected>
Date: 05/29/00

From: waldschrott <email protected>
Operating system: All
PHP version: 4.0.0 Release
PHP Bug Type: Feature/Change Request
Bug description: limitations of array_walk() calling methods or single-parameter functions

array_walk() is limited in the way
a) it cannot call methods in classes and
b) itīs not possible to call functions which expect one parameter like htmlspecialchars();

the prior fixing of (a) would enable the user to write a wrapper functions in classes to be able to use single-parameter functions though

Test script:
<?php
$obj=new RX_mail(1);

class RX_mail {
var $examples=array(1=>array('foo <email protected>','"foo" <email protected>', '* <email protected>'),
2=>array('"foobiee" <foo <email protected>>','<subfoo <email protected>>'));
function RX_mail($type) {
$this->array=$this->examples[$type];
// Before returning $this->examples[$type] I wanted to array_walk
// all items to be able to display them

// 1) does not work
array_walk($this->array,'htmlspecialchars');
// 2 does not work, as said
array_walk($this->array,'this->wrapper'); }

function wrapper(&$param1,$param2='') {
return htmlspecialchars($param1); }}
?>

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>