Bug in recent upgrade to core module?

Running freepbx 2.6. I have a bandwidth.com trunk with 2 DIDs using the freepbx service. I have the sipstation module installed and it was working fine. A core update came in this morning, and after applying it, for whatever reason, I happened to click on the sipstation link. Blank page. Uninstall and reinstall the module. No change. At that point, I happened to look at /var/log/httpd/error.log and saw a bunch of errors like this:

[Fri Jan 15 08:22:42 2010] [error] [client] PHP Notice: Undefined var
iable: db in /var/www/html/admin/modules/core/functions.inc.php on line 2477, re
ferer: http://pbx.druber.com/admin/config.php?type=setup&display=did
[Fri Jan 15 08:22:42 2010] [error] [client] PHP Fatal error: Call to
a member function escapeSimple() on a non-object in /var/www/html/admin/modules/
core/functions.inc.php on line 2477, referer: http://pbx.druber.com/admin/config

The messages come in pairs always. Looking at the functions.inc.php, I assume the second message is because the $db var it is trying to deref does not exist. I see this in that file:

function core_did_get($extension="",$cidnum=""){

    $cidnum = $db->escapeSimple($cidnum);
    $sql = "SELECT * FROM incoming WHERE cidnum = \"$cidnum\" AND extension\

= “$extension”";
return sql($sql,“getRow”,DB_FETCHMODE_ASSOC);

Looking at several other related functions in functions.inc.php, I see some of them doing similar juju with $db, but they add this at the beginning of the function:

function core_did_edit($old_extension,$old_cidnum, $incoming){
global $db; <=== this guy here!

On a hunch, I added this line to core_did_get() and the module now works again. What I am not understanding is why some of the functions in this module that deref $db declare it with the global directive and others don’t :frowning: