lat9 / dbio

Database Input/Output for Zen Cart
GNU General Public License v3.0
3 stars 1 forks source link

IDE inspection DbIoHandler.php, protected access queries #188

Closed torvista closed 3 years ago

torvista commented 3 years ago

phpStorm is flagging this as a bug on queries

ADMIN\includes\classes\dbio\DbIoHandler.php Clipboard01

I'm not sure if it is.

lat9 commented 3 years ago

I'm thinking that it's a false positive. The includes/classes/query_class.php has only public methods and no declarations of protected status on the queries array.

In addition, the DbIoHandler's queryCache and queryCacheOlder variables are created in the public __construct method, thus making them also public.

torvista commented 3 years ago

Ah, a minor but significant bit of information would be that this in is ZC158!!. Sorry!

class QueryCache
{
    protected $queries = [];

    /**
     * Cache SELECT statement query resources in application memory
     * returns TRUE if and only if query has been stored in cache
     * @param string $query query string, used as a key
     * @param mysqli_result $valueToStore result from mysqli_query
     * @return bool
     */
lat9 commented 3 years ago

Still a phantom. The queries element of the QueryCache class is directly accessed only for the older (ca. zc151) version of the query_class.php class.

torvista commented 3 years ago

After forcing myself to understand this, you are of course, right.

torvista commented 3 years ago

From what I see, this "offending" bit of code is for an older query_class object that did not have the "reset" method: this was introduced in ZC153.