News Scroll

php error with phpBB 3.2.2 under php 7.2 - News Scroll

php error with phpBB 3.2.2 under php 7.2

by HaioPaio » Thu Apr 05, 2018 3:42 pm

I have used this extension a lot with phpBB 3.2.1 under php 7.1 without any problems and I love it.

However I have problems since I have updated the board to 3.2.2 and set the php version at the server to 7.2.

Every now and then users experience a php error after sumitting a post.
The post however is properly submitted.

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_messenger.php on line 506: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 1836: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3268)
I was unable to find a way to duplicate the problem. I personally see it every second day at one post submission. All other post work fine.

Then I discovered the a similar error happens every time I use ACP > Extensions > Newsscroll.
The error can be duplicated everytime the NewsScroll Settings screen is accessed.
The Newsscroll Setting screen properly displays and all settings work.
However, on top of the page the following error is visible:

Code: Select all

[phpBB Debug] PHP Warning: in file [ROOT]/ext/hifikabin/newsscroll/acp/newsscroll_module.php on line 141: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 137: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3268)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 137: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3268)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 137: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3268)
This makes me believe that the problem might be related to the News Scroll Extension.
The Board runs 3.2.2 with Style Orange BBEs and German Language.
It is hosted on Strato.

It would be great if you could have a look at this issue.
HaioPaio
Registered User
Posts: 11
Joined: Mon Jan 08, 2018 7:39 pm
Contact:

Re: php error with phpBB 3.2.2 under php 7.2

by HiFiKabin » Thu Jun 14, 2018 10:35 am

Good Morning

I am sorry that I missed your post on the CDB topic but for some reason I didn't get a notification.

I have installed a php 7.2 test forum and its definitely a compatibility problem with php 7.2

Replace ext>hifikabin>newsscroll>acp>newsscroll_module.php with the one attached (after un zipping it of course) Purge the forum and browser cache and that should fix the issue.
Attachments
newsscroll_module.zip
(1.85 KiB) Downloaded 114 times
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4019
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: php error with phpBB 3.2.2 under php 7.2

by HaioPaio » Fri Jun 15, 2018 6:43 pm

James
Thank you so much. I can confirm that the problem has disappeared.

By the way, I love your extensions.
Gerd
HaioPaio
Registered User
Posts: 11
Joined: Mon Jan 08, 2018 7:39 pm
Contact:

Re: php error with phpBB 3.2.2 under php 7.2

by HiFiKabin » Fri Jun 15, 2018 6:53 pm

This fix is by way of a bit of a hack (I have just removed the line of code thats causing the error in php 7.2) I have tested it myself and its removal doesn't appear to cause any error so I am glad you have found the same.

... and thanks. Your appreciation makes it all worth while.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4019
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: php error with phpBB 3.2.2 under php 7.2

by 3Di » Fri Jun 15, 2018 10:04 pm

You removed this line

'S_ERROR' => (sizeof($error)) ? true : false,

Alternatively you can do this way
'S_ERROR' => ($error) ? true : false,

or

'S_ERROR' => (count($error)) ? true : false,

But since in your HTML you are not using the errors reporting, and in your module you are not checking for errors...
It's good to remove that line as you did, moreover you should also remove this line:

Code: Select all

        // Set an empty error string
        $error = '';
Which btw should have been
$error = array();
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity ΒΊ PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
πŸ‘¨β€πŸ« | Take a tour to | The Studio | πŸ‘¨β€πŸ«
User avatar
3Di
Former Team Member
Posts: 14245
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: php error with phpBB 3.2.2 under php 7.2

by HiFiKabin » Sat Jun 16, 2018 9:16 am

Thanks Marco, That was missed in Validation and thanks for pointing out that it can safely be removed without causing a problem.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 4019
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: php error with phpBB 3.2.2 under php 7.2

by 3Di » Sat Jun 16, 2018 11:00 pm

Anytime. :)
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity ΒΊ PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
πŸ‘¨β€πŸ« | Take a tour to | The Studio | πŸ‘¨β€πŸ«
User avatar
3Di
Former Team Member
Posts: 14245
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact: