Which Fires First? Error Handler or Shutdown Function

April 24th, 2008 by Aaron

I was working on writing a shutdown function for a PHP 4 script and noticed some odd behavior when I was getting errors (no way! I program and get errors? Who knew!?) At any rate, when I would handle my error with my custom function, I noticed the shutdown function was still executing after the error function. (Or when it was a Fatal error, the error was shown to the screen but the shutdown function was still ran…)

This got me to thinking about handling error redirection pages and sending messages on fatal errors in PHP4 (you’ll remember that a fatal error won’t execute the error handler, and therefore most of our custom code to make a nice ‘message’ won’t execute). But anyway, I digress.

I’m using PHP5.2 - this is the code I used to test:

1
2
3
4
5
6
7
8
9
10
11
<?php
function error_function() {
  print 'error function';
}
function shutdown_function() {
  print 'shutdown function';
}
set_error_handler('error_function');
register_shutdown_function('shutdown_function');
print 1/0;
?>

So, as you can tell, the error handler happens FIRST and then the shutdown function


SimplePHPMailer

April 24th, 2008 by Aaron

There are a very small amount of really easy to implement PHP mailer scripts in the wild. They usually try to pump so many features into them that it becomes difficult to implement or too large of a file. For those looking for just a quick drop-in solution - that you DON’T need to know PHP to use - SimplePHPMailer was developed. All that is needed is to drop the php file into the same area as your form, open it up, and read the instructions. There are some straight forward configuration options with very easy to understand comments. Download it for your next quick project.

SimplePHPMailer 0.1a


JS Tool - Security Auditing in Javascript

April 24th, 2008 by Aaron

JSTool was a trial run of combining many different scripts from the open source community into a security and auditing script. Features would include history viewing, website status reporting and port scanning. Very little original code - just combinations of existing code. Check the comments for proper author attribution. This script really isn’t in working condition for production distribution. Download it and learn from it.

JS Tool


Meta Tag Generator

April 24th, 2008 by Aaron

Meta Tag Generator uses javascript to generate the proper format for some common meta tags. This was originally just a proof of concept script that I decided to release.

Meta Tag Generator


PHP Shared Host - Session File Browser Script

April 24th, 2008 by Aaron

PHP stores its session information into flat files unencrypted by default. In shared hosting situations, this can be a big security issue. This script allows easy access to the attributes of these files as well as decoding of the values stored in them. This script can also be used to audit the security of your current configuration. If other users’ session information is available, your information is not secure either!

Session Browser 0.1a


Which Conference Should I go to - Help me in 2008

April 1st, 2008 by Aaron

So, luckily, my current employer will pay and make arrangements for me to attend one major conference each year. Last year I attended Mysqlconf, the year before, Zend Con.

Which should I goto this year? Here are the things to consider:

  • I don’t have a US passport - so it has to be in the US - Unless there is enough lead time to get a passport (how much time does that take anymore these days? Do I need to wear the mark of the beast now? *squints at Real-ID*)
  • It has to be something web related (yah very clear Aaron - thanks. Microsoft makes front page and windows Live search - does that make them web related? *sigh* This means web programming language, analysis or tool based. I don’t know how more broad ones like ‘future of web apps’ types would work…)
  • I’d like it to be focused on open source (oracle fans, be damned!)

So - it’s pretty simple. Any suggestions?


|
©2008 102 Degrees LLC - All Rights Reserved Home Services Products Network Blog Open Source Learning Contact