I get this all the time on old code and I'm always able to rewrite either.
It is usually solved by defining it somewhere at the start of the script:
$variable = '';
$x = new stdClass();
If you do this at the start of the script, it should quit giving annoying errors and let everyone get back to work.
> -----Original Message-----
> From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of
> Will Martin
> Sent: Thursday, August 25, 2016 12:52 PM
> To: [log in to unmask]
> Subject: [CODE4LIB] LibStats, PEAR, PHP 7
> A recent server upgrade seems to have broken our installation of LibStats. It
> appears that the database abstraction layer it uses, PEAR::DB, is not working
> correctly. Once instantiated, it's supposed to have methods like getOne()
> and getAll() that execute a SQL query and retrieve the results; but keeps
> complaining that these are undefined.
> I'm pretty sure this has something to do with the fact that the upgrade
> -- to Ubuntu 16.04.1 LTS -- installed PHP 7, up from 5.6. According to the
> PEAR web site, PEAR::DB is supposed to be compatible with PHP 7 despite
> being ancient and crufty, but it's not working.
> Anyone have any insight on how to get PEAR::DB to play nice in its new
> environment? Because the other option would be going in and rewriting all
> the database queries to use a more modern database abstraction layer.
> Probably PDO. That's certainly doable, but it'd be quite a pretty fair chunk of
> work, and in the meantime our reference and access services staff can't log
> their stats normally.
> Will Martin