mt_rand error
Home›Forums›AdRotate for WordPress›General Support›mt_rand error
- This topic has 8 replies, 2 voices, and was last updated 1 day, 8 hours ago by
cnxsoft.
- February 7, 2021 at 7:43 am#123530
cnxsoftBadges: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.
February 7, 2021 at 10:29 am#123541
Arnan de GansBadges: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.February 7, 2021 at 10:30 am#123544
Arnan de GansBadges:Moved to General Support, not a bug.
February 7, 2021 at 9:21 pm#123570
cnxsoftBadges: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.February 7, 2021 at 11:05 pm#123571
Arnan de GansBadges:You can see the version in the plugins page.
Which version do you have?February 7, 2021 at 11:10 pm#123573
cnxsoftBadges: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);February 8, 2021 at 10:23 am#123631
Arnan de GansBadges: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.February 24, 2021 at 2:24 am#124351
cnxsoftBadges: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
February 24, 2021 at 2:49 am#124352
cnxsoftBadges:OK. Found out one mobile banner had a weight of zero… as weight was not selected. Not sure how this could have happened.
You must be logged in to reply to this topic.