PHP 4.4.5 segfault fix

Quick tip for those of us unfortunate enough to have to deal with “legacy” php code (Ruby is Sooo much easier!).

One of my ISPs recently upgraded the PHP installation to 4.4.5 and suddenly my php application stopped. Nothing in the error log, no output to the browser.

I discovered that an attempt to @session_register@ an unitialised variable causes that build of PHP to segfault.

For example…

Will cause a segfault

<?php
session_start();
session_register("logon");
?>

No segfault

<?php
session_start();
$logon = "fred";
session_register("logon");
?>

I do not know if this is a generic issue or a consequence of the particular ISP’s build. But, I hope that this will help anyone else whose PHP application mysteriously stops!

Leave a Reply

Your email address will not be published. Required fields are marked *