My host finally set up the ability to upgrade PHP. I’ve been running on 5.2 for roughly forever. I host for clients, and most upgrades went without a hitch. A couple, however, barfed a bit thanks to undeclared variables, generated errors the likes of:
Warning: Creating default object from empty value in \wp-content\themes\hybrid\library\functions\core.php on line 27
Thankfully, it’s a pretty easy fix: just declare the variable! for example,
1 2
| if ( post_type_supports( $post->post_type, 'entry-views' ) ) {
$entry_views->post_id = get_queried_object_id(); |
In a library/extensions file generated a warning. To fix, I simply declared the variable $entry_views:
1 2 3
| if ( post_type_supports ( $post-> ;post_type , 'entry-views' ) ) {
if (!is_object($entry_views)) {$entry_views = new stdClass ; }
$entry_views-> ;post_id = get_queried_object_id (); |
I had to do the same in a few other files as well.