Edit report at https://bugs.php.net/bug.php?id=55542&edit=1

 ID:                 55542
 Updated by:         lytbo...@php.net
 Reported by:        c...@php.net
 Summary:            SNMP class should use Exceptions instead of PHP
                     Errors
 Status:             Assigned
 Type:               Feature/Change Request
 Package:            SNMP related
 PHP Version:        5.4.0alpha3
 Assigned To:        lytboris
 Block user comment: N
 Private report:     N

 New Comment:

enable SNMP::ERRNO_ANY by default is not a good idea I think. PDO has the same 
default behavior for throwing exceptions.


Previous Comments:
------------------------------------------------------------------------
[2011-09-02 10:41:20] c...@php.net

Thanks for implementing this so quickly. But the constructor still says: 
"snmp_object->exceptions_enabled = 0;", as this is a class one would rather 
expect OOP style exceptions as default, or?

------------------------------------------------------------------------
[2011-09-02 10:13:21] lytbo...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

A new SNMP object property is introduced: exceptions_enabled.
Setting this property to ORed combination of SNMP::ERRNO_* errors will enable 
exception throwing on these errors. SNMP::ERRNO_ANY may be used to enable all 
posslible SNMP::ERRNO_* errors at once.

------------------------------------------------------------------------
[2011-09-02 10:13:19] lytbo...@php.net

Automatic comment from SVN on behalf of lytboris
Revision: http://svn.php.net/viewvc/?view=revision&revision=316032
Log: merge from trunk
added SNMPException class, enabling ability to throw exceptions
when a known SNMP error has occured
FR #55542

------------------------------------------------------------------------
[2011-09-02 10:04:08] lytbo...@php.net

Automatic comment from SVN on behalf of lytboris
Revision: http://svn.php.net/viewvc/?view=revision&revision=316029
Log: added SNMPException class, enabling ability to throw exceptions
when a known SNMP error has occured
FR #55542

------------------------------------------------------------------------
[2011-08-30 22:15:06] c...@php.net

Description:
------------
Hello

Subject says all, IMHO it does not make sense to start writing a new class that 
does not use 100% exceptions.

This bug is a follow up on #40816 which ended with:

 [2011-08-30 15:18 UTC] lytbo...@php.net

> I have read a bunch of threads on php-dev about extensions throwing 
> exceptions and the last thing I remember that extension should not throw any 
> exception except object creation if there is no way to disable them.

> Anyway, if to throw exceptions, library will throw an exception for each 
> error, not only parsing error.


Please, please, convinced yourself that Exceptions are cool and worth 
refactoring the code. I'd be willing to help with writing tests :)

I'd be curious about the threads you mentioned (a quick google found nothing 
but then the keywords are very common) but there are already some extensions 
(spl/php_spl.c, mysql/php_mysql.c, reflection/php_reflection.c) that do throw 
Exceptions.




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55542&edit=1

Reply via email to