logo

Member
Member
Offline Offline
Posts: 46
SVN 651: After new install, empty tables file creates errors w/FIX

Alrighty, I figured out what was causing my little error, and I'm pretty sure I have the right fix as well. With my clear cache modification, it creates a cache that is identical to post-install, so it really made finding this easy. Grin

The error..
Code:
Warning: array_key_exists() expects parameter 2 to be array, boolean given in htdocsfunctionssql_query.php on line 23

..only pops up post-install, or if the tables file is cleared.

So, the line causing the error is:
Code:
         if(!array_key_exists($data, $tables))


After poking at it a while, it seems that the $cache is set after a query is cached, but before anything may have been written to $tables. Thus, this line can be hit, with $tables still being null, which PHP is interpreting as false rather than a null array.

As per my fix...

Find
Code:

         if(!array_key_exists($data, $tables))
            call('addcache', $data);



Replace With:
Code:

         if (!($tables)) {
            call('addcache', $data);
         } elseif (!array_key_exists($data, $tables)) {
            call('addcache', $data);
         }


This makes the error go away, and seems to work correctly both if tables.php has no cached data, and in all instances of tables.php cache data existing.
eoCMS Developer
eoCMS Developer
Offline Offline
avatar
Posts: 1528
Re: SVN 651: After new install, empty tables file creates errors w/FIX

Patch Applied

Please do not PM me requesting support or anything, use the forums, thats what they are here for
eoCMS Developer
eoCMS Developer
Offline Offline
avatar
Posts: 1528
Re: [Fixed] SVN 651: After new install, empty tables file creates errors w/FIX

This bug has been deemed [Fixed] by an eoCMS developer. If you dispute the Fix, please PM a developer, giving details of why. This topic can then be unlocked allowing for further discussion.

Please do not PM me requesting support or anything, use the forums, thats what they are here for

Jump to:


0.07 seconds Queries: 13