Search

Codeangel 0.4

Saturday, August 25. 2007

Codeangel is now running on version 0.4!

Codeangel 0.5 the user will finally notice some feature updates, including linkback support, comment subscription, and a better searching experience.

Read More(1 page)...


Posted by Chad Emrys Minick in CodeAngel at 7:07 PM | Comments (2)

Custom Zend Log Format: Security Logging

Saturday, August 25. 2007

The default file logging format for Zend_Log File Writer is as folows:

%timestamp% %priorityName% (%priority%): %message%

Which is fine for error logging. For other sorts of logging like security auditing, We need more, like an IP of the visitor and a hostname. Other sorts of logging you might want to log things like the request where the error occurred. This is very easy to do with Zend_Log, however this really isn't documented and I've found people doing weird things like extending Zend_Log to achieve this. Let's look how to do this right.

Read More(1 page)...


Misconceptions about Exceptions

Thursday, August 2. 2007

I was surprised the other day when someone came into ##php on freenode wanted a strange feature when he hit a wall designing his app with exceptions. He wanted something like the following:

//NOTE THIS IS NOT POSSIBLE, IT'S BULLCRAP!!
try {
  throw new Exception("throw an exception");
} catch (Exception $e) {
  //do something with a thrown exception.
} else {
  //do something if there wasn't an exception thrown.
}

That's right, he wanted an 'else' for a try/catch block. My mind was blown, surely he was using exceptions wrongly. After I did some inquiring on why he wanted such a ridiculous feature, I found out he was indeed misusing exceptions. He was using exceptions to control his code execution flow. Using them to drive his application by recoverable errors. He was quite defensive about it too! I decided if there weren't enough blog articles about correct exception usage, there needed to be one more...

Read More(1 page)...


Posted by Chad Emrys Minick in PHP, Programming at 11:09 PM | Comments (2)