We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14412
    • 74 Posts
    On one of my sites I get the following warning everytime I clean the site cache:
    [tt]
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /media/sda4/www/serhumano/manager/processors/cache_sync.class.processor.php on line 144

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /media/sda4/www/serhumano/manager/processors/cache_sync.class.processor.php on line 160[/tt]

    I checked that file and these are the relevant code blocks:

    		// WRITE snippets to cache file
    		$sql = "SELECT ss.*,sm.properties as 'sharedproperties' ".
    				"FROM $dbase.".$table_prefix."site_snippets ss ". 
    				"LEFT JOIN $dbase.".$table_prefix."site_modules sm on sm.guid=ss.moduleguid "; 
    		$rs = mysql_query($sql);
    		$limit_tmp = mysql_num_rows($rs);
    		$tmpPHP .= '$s = &$this->snippetCache;' . "\n";
    		for ($i_tmp=0; $i_tmp<$limit_tmp; $i_tmp++) { 
    		   $tmp1 = mysql_fetch_assoc($rs); 
    		   $tmpPHP .= '$s[\''.mysql_escape_string($tmp1['name']).'\']'." = '".$this->escapeSingleQuotes($tmp1['snippet'])."';\n";
    		   // Raymond: save snippet properties to cache
    		   if ($tmp1['properties']!=""||$tmp1['sharedproperties']!="") $tmpPHP .= '$s[\''.$tmp1['name'].'Props\']'." = '".$this->escapeSingleQuotes($tmp1['properties']." ".$tmp1['sharedproperties'])."';\n";
    		   // End mod
    		}
    		
    		// WRITE plugins to cache file
    		$sql = "SELECT sp.*,sm.properties as 'sharedproperties' ".
    				"FROM $dbase.".$table_prefix."site_plugins sp " .
    				"LEFT JOIN $dbase.".$table_prefix."site_modules sm on sm.guid=sp.moduleguid " .
    				"WHERE sp.disabled=0"; 
    		$rs = mysql_query($sql);
    		$limit_tmp = mysql_num_rows($rs);
    		$tmpPHP .= '$p = &$this->pluginCache;' . "\n";
    		for ($i_tmp=0; $i_tmp<$limit_tmp; $i_tmp++) { 
    		   $tmp1 = mysql_fetch_assoc($rs); 
    		   $tmpPHP .= '$p[\''.mysql_escape_string($tmp1['name']).'\']'." = '".$this->escapeSingleQuotes($tmp1['plugincode'])."';\n";
    		   if ($tmp1['properties']!=""||$tmp1['sharedproperties']!="") $tmpPHP .= '$p[\''.$tmp1['name'].'Props\']'." = '".$this->escapeSingleQuotes($tmp1['properties']." ".$tmp1['sharedproperties'])."';\n";
    		}


    Apparently this has something to do with shared properties with modules, but I don’t know where to look for answers as I don’t use shared module parameters.

    Did anyone get these same warnings?

    I’m afraid this can be the start of many other problems so I’d like to sort this out before going live with the site.

    I guess it’s not related, but this is the same site as mentioned in this post. This happens both on local and production installs though.

    Thank you for any clues you may have,

    JP
      Got Music? Try XSPFjukebox - Skinnable MODx Media Player
      • 25307
      • 114 Posts
      I actually hit some stuff like this recently.. Have you restarted MySQL? Also might help to restore a backed up copy of the database if you have one. My latest theory is that (at least my similar problem) may have involved too many unclosed database connections or some sort of session weirdness.. Please post if you are able to pinpoint your issue. Thanx and good luck..
        • 14412
        • 74 Posts
        Thanks for your reply robot, but I’m afraid this has nothing to do with the MySQL server:


        • I’ve been getting this behaviour both on local installs with xampp linux/win and on the linux (production) server
        • the problem persists between DB import/export, wheter it’s made via the MODx manager or phpmyadmin/other tools
        • the problem doesn’t go away with MODx upgrades. Already tried 0.9.5 -> 0.9.6 to to avail

        Apart from the warning, the site seems to be OK, but I’d like to understand what’s happening. Apparently it’s something related to module/snippets being linked in the cache, but I don’t have the slightest clue about this:

        These query strings:

        [tt]
        $sql = "SELECT ss.*,sm.properties as ’sharedproperties’ "."FROM $dbase.".$table_prefix."site_snippets ss ". "LEFT JOIN $dbase.".$table_prefix."site_modules sm on sm.guid=ss.moduleguid ";

        $sql = "SELECT sp.*,sm.properties as ’sharedproperties’ "."FROM $dbase.".$table_prefix."site_plugins sp " ."LEFT JOIN $dbase.".$table_prefix."site_modules sm on sm.guid=sp.moduleguid " ."WHERE sp.disabled=0";
        [/tt]

        ...are obviously returning an invalid mysql resource after being processes, but I don’t have the slightest clue of what they are and why they’re triggering these warnings. As I said, I’m not using any shared module parameteres in my snippets/plugins.

        It would be great if someone more into the core code could take a look at this.

        Regards, JP
          Got Music? Try XSPFjukebox - Skinnable MODx Media Player
          • 25307
          • 114 Posts
          Yeah that is definitely (unfortunately) not me.. sad good luck..