Jump to content

Uncaught ArgumentCountError: Too few arguments to function


Peter Knight
 Share

Recommended Posts

Am i right in thinking this is a PHP 7 issue and not so much a Processwire issue? General google seems to suggest so.

Just moved a site to a new host and getting following on a simple call

Fatal error: Uncaught ArgumentCountError: Too few arguments to function ProcessWire\Pageimage::size(), 1 passed in /home/site.not/site/assets/cache/FileCompiler/site/templates/team-detail.php on line 43 and at least 2 expected in /home/site.not/wire/core/Pageimage.php:519 Stack trace: 
#0 /home/site.not/site/assets/cache/FileCompiler/site/templates/team-detail.php(43): ProcessWire\Pageimage->size(150) 
#1 /home/site.not/wire/core/TemplateFile.php(287): require('/home/...') 
#2 /home/site.not/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() 
#3 /home/site.not/wire/core/WireHooks.php(714): ProcessWire\Wire->_callMethod('___render', Array) 
#4 /home/site.not/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) 
#5 /home/site.not/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) 
#6 /home/site.not/wire/core/Wire. in /home/home/site.not/wire/core/Pageimage.php on line 519

 

<?php 
	foreach($page->images as $image){
	$thumb = $image->size(150);
	echo "<img src='{$thumb->url}' class='team-photo-detail' alt='{$thumb->description}'"
	; }?>

 

  • Like 1
Link to comment
Share on other sites

9 hours ago, adrian said:

but just to clarify, this is not a PHP 7 issue.

What Adrian said. It is not even a ProcessWire issue but a computer programming issue :) (are there languages that would ignore the error? I know JavaScript is pretty laissez faire, but even it would throw an error). I'm curious though, how come@Peter Knight didn't see the error at the old host? Did size() just fail silently?

Link to comment
Share on other sites

6 minutes ago, kongondo said:

I'm curious though, how come@Peter Knight didn't see the error at the old host? Did size() just fail silently?

Hi @kongondo

I have this site running on two other servers with the same version of PW, PHP. So 2 out of 3 work fine.

I'll have to do a little forensic investigating.

 

 

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...