Peter Knight Posted February 7, 2018 Posted February 7, 2018 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}'" ; }?> 1
Zeka Posted February 7, 2018 Posted February 7, 2018 Hi @Peter Knight $thumb = $image->size($width, $height, $options); $width and $height are not optional arguments. https://processwire.com/api/ref/pageimage/size/ 4
adrian Posted February 8, 2018 Posted February 8, 2018 As @Zeka said - it expects a minimum of two arguments, but just to clarify, this is not a PHP 7 issue. 1
kongondo Posted February 8, 2018 Posted February 8, 2018 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?
Peter Knight Posted February 8, 2018 Author Posted February 8, 2018 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. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now