mt_rand error

  • #123530

    cnxsoft
    Badges:

    I got plenty of PHP errors from adrotate pro:

    
    2021/02/07 19:40:02 [error] 7193#7193: *41963 FastCGI sent in stderr: "PHP message: PHP Warning:  mt_rand(): max(-1) is smaller than min(0) in /srv/www/cnx-software.com/public_html/wp-content/plugins/adrotate-pro/adrotate-functions.php on line 607" while reading response header from upstream, 
    
    

    For reference, I’m running a 32-bit Linux OS (Ubuntu 18.04 32-bit) in case this matters.

    #123541

    Start with updating to a newer version. The latest version is 5.8.11.
    It’s likely that your problem goes away with the newer version.

    Upgrade instruction: https://ajdg.solutions/support/adrotate-manuals/upgrade-adrotate-pro-to-a-newer-version/

    Or, if you prefer, have me do the update, I can do so for a small fee – https://ajdg.solutions/product/adrotate-update/.
    Usually this can be done within a day or two. Please check the product page for details.

    #123544

    Moved to General Support, not a bug.

    #123570

    cnxsoft
    Badges:

    It looks like I already have the latest version.
    For reference, it shows “AdRotate version Current: 399 Database version Current: 66” in the mMintenance tab.

    #123571

    You can see the version in the plugins page.
    Which version do you have?

    #123573

    cnxsoft
    Badges:

    I’m unable to see AdRotate Pro version in the dashboard, but in the source code:

    /*— AdRotate values —————————————*/
    define(“ADROTATE_DISPLAY”, ‘5.8.11 Professional’);
    define(“ADROTATE_VERSION”, 399);
    define(“ADROTATE_DB_VERSION”, 66);

    #123631

    Hmm that’s the latest version, which you can also see in the Plugins page in your dashboard. Just like any other plugin.

    I took a look at the code – The only way the error can appear is if your advert weights are negative. Which is not an option in AdRotate. Please check all your adverts and make sure they have a weight of 2 or higher.

    If that is already the case, search your website/code/files for misuse of the adrotate_pick_weight() function and remove it. Some other file is possibly calling the function, which then results in the negative value, causing the issue.

    #124351

    cnxsoft
    Badges:

    I hadn’t had time to look into it, but now I’ve just noticed it does not happen in the desktop version of the website. It will only happen in the mobile version using WPTouch plugin, and there are plenty of adrotate-pro noticed and warnings…

    Warning	mt_rand(): max(-1) is smaller than min(0)	1	
    
        wp-content/plugins/adrotate-pro/adrotate-functions.php:607
    
    	Plugin: adrotate-pro
    Notice	Constant FORCE_SSL_ADMIN already defined	1	
    
        wp-config.php:84
    
    	Core
    Notice	Undefined index:	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:246
    
    	Plugin: adrotate-pro
    Notice	Trying to get property 'image' of non-object	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:246
    
    	Plugin: adrotate-pro
    Notice	Undefined index:	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:248
    
    	Plugin: adrotate-pro
    Notice	Trying to get property 'id' of non-object	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:248
    
    	Plugin: adrotate-pro
    Notice	Undefined index:	4	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:249
    
    	Plugin: adrotate-pro
    Notice	Trying to get property 'id' of non-object	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:249
    
    	Plugin: adrotate-pro
    Notice	Trying to get property 'title' of non-object	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:249
    
    	Plugin: adrotate-pro
    Notice	Trying to get property 'bannercode' of non-object	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:249
    
    	Plugin: adrotate-pro
    Notice	Trying to get property 'tracker' of non-object	1	
    
        wp-content/plugins/adrotate-pro/adrotate-output.php:249
    
    	Plugin: adrotate-pro
    
    #124352

    cnxsoft
    Badges:

    OK. Found out one mobile banner had a weight of zero… as weight was not selected. Not sure how this could have happened.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

You may be interested in