That's not exactly how the options work. How it works is if the "id" parameter is passed in then an integer value is required. It won't fail if no "id" parameter is passed in.
You may want to add this code after the catch block to make the "id" argument required: if (null === $opts->id) { echo $opts->getUsageMessage(); exit; } -- *Hector Virgen* http://www.virgentech.com Follow me on Twitter: @djvirgen <http://twitter.com/djvirgen> On Thu, Jul 7, 2011 at 7:13 AM, whisher <whis...@maktoob.com> wrote: > Hi, > try { > $opts = new Zend_Console_Getopt(array( > 'id=i' => 'id option,required an integer parameter' > )); > $opts->parse(); > echo $opts->id; > } catch (Zend_Console_Getopt_Exception $e) { > echo $e->getMessage(); > echo $e->getUsageMessage(); > exit(); > } > If I run this snippet above without parameter > like ./myscript.php I'm waiting an exception instead the script fails > without error. > Is it the a feature or I miss something ? > Thanks in advance > Bye > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Zend-Console-Getopt-manage-if-there-no-options-tp3651587p3651587.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- > List: fw-general@lists.zend.com > Info: http://framework.zend.com/archives > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > >