• Sidetracked

    Fatal error: Cannot re-assign $this

    In PHP 4.2 and below, a lot of people have been using the undocumented feature (or un-patched bug) where you could assign a value to the object itself:

    $this = $foo

    This non-feature has been patched in PHP5, thus you no longer can use it. In fact, running the same script on a PHP5 server will end up with a FATAL ERROR.

    To fix your script to be compatible with PHP5 (and backwards compatible with 4.2) you can replace that line of code with:

    foreach (get_object_vars($foo) as $key => $value)
    $this->$key = $value;
  • Home Improvement

    Milwaukee M12 Compact Hackzall

    Did you ever find yourself peeking through a hole in the drywall and thinking, “Only if I could reach in there and cut that pipe…”? But you’re looking at your reciprocating saw and thinking, “How the heck am I going to fit this tool in there AND hold it with one hand”? Well, you could invest some time in a small hand saw…

    OR you could invest some dough in Milwaukee’s M12 power tools. The original maker of the Hackzall has a compact version, small enough to fit through a 6 inch hole and short enough to fit between studs. You won’t want to use this thing one handed all-day-long, but it’s great when occasional single-handed use is called for.

    Note: Full kit comes with gigantic case.

  • Sidetracked

    User level PHP Session ID

    If you let students/employees run websites off your main domain, you may encounter problems when they try to run PHP scripts with session IDs.

    You have a PHP session conflict in cases like this:

    http://www.example.com/~abel/login.php?a0123456789bc…

    http://www.example.com/~cain/login.php?a0123456789bc…

    Because of the way sessions are stored as Cookies, if the browser encounters a new session with the same name under the same domain, it may not replace an older session with the new one. Browsers using the WebKit engine (Safari, Chrome) may encounter this problem more often than others (for reasons I cannot pinpoint).