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

Issue Type: Bug Created: 2009-05-15T12:19:54.000+0000 Last Updated: 2010-12-05T04:53:48.000+0000 Status: Resolved Fix version(s): - 1.10.7 (28/Jul/10)

Reporter: David O. (dordal) Assignee: Ramon Henrique Ornelas (ramon) Tags: - Zend_Console_Getopt

Related issues: - ZF-9756



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


Posted by Ramon Henrique Ornelas (ramon) on 2010-12-05T04:53:42.000+0000

Fixed with the issue ZF-9756.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.