Not Solved [Error Message] Error in ADS-file - but why?
#1
Not Solved
   

In my error log, this error (see the attachment) appears many times:
It looks like the problem is located in the script of the "Ads rotating app" . 
Perhaps some sees the problem in this script? Does it have something to do with this app in combination with PHP 8.2 ?

I hope that somebody can help me with this error warning. Many tanks in advance......
Reply
#2
Not Solved
It might help to provide a link to the plugin that you are using.
Reply
#3
Not Solved
(2026-10-28, 03:30 PM)Dave H Wrote: It might help to provide a link to the plugin that you are using.

Yes, ik know. But the problem is that de original website of the maker seems to does'nt exist anymore.
https://community.mybb.com/thread-32064....randomizer
Would it be helpfull  if I copy the text of the ads.php file into the code-section of this thread?
Reply
#4
Not Solved
Based on the site being gone, it's probably code that is generating warnings in PHP 8 because it was written for PHP 5-7 where you could get away with undefined variables.  Not a big problem in PHP 8 since its just a warning, but PHP 9 is supposed to make those into errors so it's good to fix them now because they will kill your site on PHP 9.

I've patched some of these myself in old extensions I use - it's worth looking at to see if there's a logic error, but a lot of times I shrug and think: well it was working before so... I just add a null coalescing operator ie: like $i -> ($i ?? 0) or ($i ?? null) or ($i ?? "") depending on what seems more reasonable in the context. 

But like I said, it's worth a look, because I've also seen cases where something really should be initialized. I've actually found a few bugs in old extensions because of this warning.

Disclaimer: I am slowly picking up PHP as a side-effect of managing a MyBB forum.  Someone with more PHP experience might have a better way.
Reply
#5
Not Solved
Maybe someone uses this ads-plugin and got it working in PHP 8 after some adjustments?
I was trying to put the code of the ads.php-file in the codeblock of this message but it seems that's not allowed, i've got blocked after this action:-(
Is there another way to show the script?
Reply
#6
Not Solved
I'm not sure what you mean by show the script?  I assume you have a copy on your PC that you uploaded to a server.  I would edit the PC copy and then re-upload.  (Make a backup before editing, of course.)

If you deleted your local copy, then download from server, backup, edit, upload. 

Of course you may have direct editing abilities too.  For example, I have shell access and will sometimes do a quick edit with vi (because I know vi) but I suspect most people know their own local editors better.
Reply
#7
Not Solved
I've been having pretty good luck with this Ad Plugin...

https://community.mybb.com/mods.php?action=view&pid=39

My Advertisements
by Diogo Parrinha
MyBB 1.8.41
alpharomeo15.org
All about guns, knives and gear!
Reply
#8
Not Solved
Always Always backup before editing stuff on a live server.

And you might paste it into something like this, to make sure you haven't made a basic syntax error before putting it on the server:

https://www.bairesdev.com/tools/phpcodechecker/
Reply
#9
Not Solved
(2026-10-28, 05:51 PM)Dave H Wrote: I'm not sure what you mean by show the script?  I assume you have a copy on your PC that you uploaded to a server.  I would edit the PC copy and then re-upload.  (Make a backup before editing, of course.)

@Dave H:
I meant to display the content of the ads.php-file here in this thread so maybe someone could take a look........

(2026-10-28, 05:53 PM)RocketFoot Wrote: I've been having pretty good luck with this Ad Plugin...

https://community.mybb.com/mods.php?action=view&pid=39

My Advertisements
by Diogo Parrinha

@RocketFoot:
Thanks for the suggestion, I give that one a try, maybe it works without the errors/warnings in PHP 8.4..........
Reply
#10
Not Solved
I found PHP 8.4.27 (which is the one you want in the 8.4.x series) generated fatal errors "duplicate declaration of static variable" with My Advertisements by Diogo Parrinha.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)