Req #55542 [Asn->Csd]: SNMP class should use Exceptions instead of PHP Errors
Edit report at https://bugs.php.net/bug.php?id=55542&edit=1
ID: 55542
Updated by: lytboris@php.net
Reported by: ch@php.net
Summary: SNMP class should use Exceptions instead of PHP
Errors
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: SNMP related
PHP Version: 5.4.0alpha3
Assigned To: lytboris
Block user comment: N
Private report: N
New Comment:
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/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-09-02 19:56:30] lytboris@php.net
Automatic comment from SVN on behalf of lytboris
Revision: http://svn.php.net/viewvc/?view=revision&revision=316054
Log: documentation for SNMPException class (FR #55542)
------------------------------------------------------------------------
[2011-09-02 18:52:37] lytboris@php.net
Here it is thread in PHP-DEV I mentioned:
http://marc.info/?l=php-internals&m=129853991816725
Unless something changes I would prefer to techniques described there.
------------------------------------------------------------------------
[2011-09-02 12:05:43] ch@php.net
But PDO has a history back to PHP4 or the days where people where used to check every single return
value for PEAR_Error. The SNMP class is new and could lead as good example for proper OOP style!
(Or do you prefer C style $errno checking after every method call over try/catch statements? The
chances that an error goes unnoticed is much lower with exceptions.)
------------------------------------------------------------------------
[2011-09-02 11:48:34] lytboris@php.net
enable SNMP::ERRNO_ANY by default is not a good idea I think. PDO has the same default behavior for
throwing exceptions.
------------------------------------------------------------------------
[2011-09-02 10:41:20] ch@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?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=55542
--
Edit this bug report at https://bugs.php.net/bug.php?id=55542&edit=1
Thread (7 messages)