4

I have a website running Joomla 3.9.1, which uses the Shape5 - Vertex template (one of Shape5's free templates, although the company is now owned by JoomlArt). I am trying to upgrade to PHP 7.2, but every time I try to do so, the entire site breaks. Specifically, we get the following screen:

enter image description here

Error:

0 - Too few arguments to function s5_module_call(), 1 passed in /www/library/templates/s5_vertex/index.php on line 318 and exactly 2 expected

The problem disappears when we switch to a new template, which makes me conclude the problem is related to the template. Unfortunately there are no useful errors in neither the Apache logs nor Joomla's own internal logs. Upgrading to the latest version of the theme did not help. We also disabled a few plugins which were throwing errors and turned Joomla's error reporting up to "Development", but were unable to fix the problem or even determine its cause.

Some more facts which may help:

  • Current PHP version (where the site works): 5.6.31
  • Database version: 5.5.5-10.2.9-MariaDB
  • Apache version: 2.4.6
  • Server OS: RHEL 7.6

Short of getting a new theme I am not sure what the solution may be. Does anyone have any further insights?

UPDATE: Here is the block of problem code:

<?php if ($s5_pos_top_row1_1 == "published") { ?>
    <div id="s5_pos_top_row1_1" class="s5_float_left" style="max-height:240px;width:<?php echo $s5_pos_top_row1_1_width ?>%">
        <?php s5_module_call('top_row1_1'); ?>
    </div>
<?php } ?>

As a comparison, here is the block immediately below it. There is definitely a second argument passed:

<?php if ($s5_pos_top_row1_2 == "published") { ?>
    <div id="s5_pos_top_row1_2" class="s5_float_left" style="width:<?php echo $s5_pos_top_row1_2_width ?>%">
        <?php s5_module_call('top_row1_2','round_box'); ?>
    </div>
<?php } ?>
  • Do you use the latest Vertex framework patch? joomlart.com/member/downloads/shape5/vertex-framework/… – Zollie Jan 8 at 17:45
  • Yes. I had initially not installed it, but when I did so the error persisted. – Mike P Jan 8 at 18:50
  • 1
    From the call stack it is obvious that a function call fails in vertex cms_core_functions.php, which function tries to load the modules on your page in positions, but instead of 2 arguments, it gets only 1. It expects the modules' $name and $style and it gets only one of them. From PHP 7.1 this is handled as an error. Until PHP 7.1 it was only a warning and the site was running despite of this problem. That is why your site is down if you change the PHP version up above 7.1. This is just the theory behind the problem, not a solution yet, that is why I am just giving it as a comment... – Zollie Jan 8 at 19:26
  • That would seem to point to a problem the theme developer needs to fix. I would prefer to not attempt to do so myself. – Mike P Jan 8 at 19:41
  • 1
    @Zollie is right. That is the issue. It is probably helpful to point out that the style argument value is usually supplied from the module object params->style. If you are changing it you may want to go ahead and include that with 'round_box' as a default if params->style is empty. – D. Morell Jan 8 at 20:10
3

From the call stack it is obvious that a function call fails in vertex cms_core_functions.php, which function tries to load the modules on your page in positions, but instead of 2 arguments, it gets only 1. It expects the modules' $name and $style and it gets only one of them. From PHP 7.1 this is handled as an error. Until PHP 7.1 it was only a warning and the site was running despite of this problem. That is why your site is down if you change the PHP version up above 7.1. This is just the theory behind the problem, not a solution yet.

After you updated your question with the problematic code snippet we can see the problem clearly:

<?php if ($s5_pos_top_row1_1 == "published") { ?>
    <div id="s5_pos_top_row1_1" class="s5_float_left" style="max-height:240px;width:<?php echo $s5_pos_top_row1_1_width ?>%">
    <?php s5_module_call('top_row1_1'); ?>
    </div>
<?php } ?>

Yes, exactly, that is causing the problem.

The s5_module_call has only one argument and the function expects two.

This way the modules cannot be loaded on the site. If it is not a production site, you can edit the index.php file and where it is missing, you can define the second argument at every call of that particular function with giving 'round_box' everywhere as default where the second argument is missing, with completing the code like this where it is missing:

<?php s5_module_call('top_row1_1', 'round_box'); ?> and so on for every module position...

And if this is the only problem with the template then the site will run... I just do not understand why the developer has not handled this simple problem yet with an update...

Alternative solution could be: If you are not really a PHP programmer (as I understood that from your replies), then alternatively you could check your published modules with opening them one by one and make sure that in Extensions->module->Advanced tab the Module Style is defined at every of your modules for example 'inherited' or 'rounded' or 'outline' or with any other settings which gives a $style to the modules published on your site. I can also imagine that it can handle the missing argument problem when your template function wants to load the modules running under PHP 7.1. You can check this and set these values even in the production site admin area (without programming).

The default module positions' styles could be set somewhere else too in the templates' basic settings (Since I am not using Vertex I do not know where exactly but you should find that somewhere if that option exists in that template). I hope this can also help you in solving this problem.

  • Thanks for your input. It is a production site so I'm hoping to clone it and experiment with a little so as not to disrupt the live site. – Mike P Jan 8 at 21:03
  • You're welcome, however this is a bit more than just an input on this particular problem. :) I updated my answer with an alternative option which you can also try without trying to edit the code if you are not that familiar with PHP programming. – Zollie Jan 8 at 21:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.