ZF-6680: Warning: Invalid argument supplied for foreach(), getopt.php line 609


This is extremely minor, but Zend_Console_Getopt throws a warning if you pass a null as the first argument of the constructor (indicating your command line script doesn't take any flags), and then call parse():

Code Sample:

$opts = new Zend_Console_Getopt(null); $opts->parse();

If you call it without arguments (e.g. 'myscript.php') it works fine, but with an invalid argument (e.g. 'myscript.php -x') it will print a warning:

Warning: Invalid argument supplied for foreach() in Zend/Console/Getopt.php on line 609


Fixed with the issue ZF-9756.