Block Zoomer Error

Permalink 2 users found helpful
Declaration of Concrete\Package\Zoomer\Block\Zoomer\Controller::registerViewAssets() should be compatible with Concrete\Core\Block\BlockController::registerViewAssets($outputContent = '')

What should I do to solve the problem?

wells
 
FaganSystems replied on at Permalink Reply
FaganSystems
HI
You dont say why this has happened was it a failed install or an upgrade or something else?
FS
wells replied on at Permalink Reply
wells
I moved the site folder and the database to another pc.
FaganSystems replied on at Permalink Reply
FaganSystems
The error message implies that a version change also happened. I have been upgrading sites from 5.7.5.6 to Version 8.1. When getting to 5.7.5.13 as a stepping point I was getting a few of these. The error is caused by the prototype having changed for that function.

To fix this specific issue you need to edit the code and change the file \Package\Zoomer\Block\Zoomer\Controller.php and change the function from
registerViewAssets() to this registerViewAssets($outputContent = '')

This might be the only issue or others may arise, Fix all of them in the same way. The cause of this is the Package you have installed is not compatible with the version of Concrete5 that you are now running. The worst case scenario is that that package might not perform function correctly. It may be worth while checking to see if there is an update for the package or contacting the developer that built the package for an update.

Regards
FS
dantheman replied on at Permalink Reply
This worked perfectly for me. Thank you.
I'd just like to clarify that the file you need to update is located at
packages/zoomer/blocks/zoomer/controller.php
FaganSystems replied on at Permalink Reply
FaganSystems
OK I now know what has caused this...

The new server is running php7.0
I know this because I have just switched a C5-8.1 from from php 5.6.25 to php 7.0 and got the same error

What you didnt say before was what version of C5 you are running?

Good luck
mlocati replied on at Permalink Reply
mlocati
registerViewAssets has been introduced in concrete5 5.7.0.3.
Until version 5.7.5.1, it had the following signature:
public function registerViewAssets()

(seehttps://github.com/concrete5/concrete5/blob/5.7.0.3/web/concrete/src... andhttps://github.com/concrete5/concrete5/blob/5.7.5.1/web/concrete/src... )

Starting from concrete5 5.7.5.2 (up to the most recent development version), its signature is:
public function registerViewAssets($outputContent = '')

(seehttps://github.com/concrete5/concrete5/blob/5.7.5.2/web/concrete/src... andhttps://github.com/concrete5/concrete5/blob/6f19565231fabaf8c0ffdbd4... )

If a class extends BlockController (like the block controllers), and if its registerViewAssets signature is different to the one of the BlockController class, in PHP 5.x we have an E_STRICT warning, and in PHP 7.x we have an E_WARNING warning (seehttp://3v4l.org/Ntjsd )

concrete5 silently hides E_STRICT warnings, but breaks the execution for E_WARNING warnings.

So, if a block controller uses concrete5 5.7.5.2 or later, and PHP 7.0 or later, the website will be broken, with this error message:

Declaration of
My\Block\Controller::registerViewAssets()
should be compatible with
Concrete\Core\Block\BlockController::registerViewAssets($outputContent = '')


What I would to is to simply change the registerViewAssets method signature from:

public function registerViewAssets()


to

public function registerViewAssets($outputContent = '')


(and maybe set 5.7.5.2 as the minimum supported concrete5 version).
losttheplot replied on at Permalink Reply
Thanks for posting this solution mlocati :)

Note to c5 dev team: the next time you update the forum, if it's not too much trouble, please can we have a 'like' or thumbs-up trigger like git-hub so that we can show our appreciation or acceptance of a post without having to clutter the forum with a post? Thanks :)
mlocati replied on at Permalink Reply
mlocati
The dev team is collecting suggestions here:https://www.concrete5.org/community/forums/chat/marketplace-ideas...