[TYPO3-ect] still a PHP5 syntax problem

Fabien Udriot fudriot at omic.ch
Fri Jul 13 19:11:16 CEST 2007


Hi Elmar and all lib/diver's

With the actual trunk version, this syntax makes PHP crash :
$this->parameters['controller']

PHP is "angry" and display this message :

Warning: Invalid argument supplied for foreach() in 
/Users/fudriot/Sites/reseau-solidarite.ch/typo3conf/ext/lib/class.tx_lib_validator.php 
on line 90

As I understand, we have this problem because, var $_iterator of type 
tx_lib_spl_arrayIterator is an object that "simulate" the SPL interface. 
(that makes the "backport" to PHP4 possible). In PHP5, $_iterator would 
be a simple array.

Now, how can we make this syntax possible for PHP5 ?

Do we have to have 2 versions :

- one for PHP4 :

class tx_lib_object extends tx_lib_objectBase{
	*var $_iterator = new tx_lib_spl_arrayIterator()*
}	


- a second for PHP5 :

class tx_lib_object extends tx_lib_objectBase implements ArrayAccess, 
SeekableIterator{
	*private $array = array()*
}


Mmm. I hope there is an other solution than maintaining 2 classes.

bye, Fabien


More information about the TYPO3-team-extension-coordination mailing list