Jump to content
Outcydaz

Call to undefined method DirectoryIterator::getExtension()

Recommended Posts

Hello All,

I have an issue editing certain pages with specific templates. I noticed this issue after migrating from MAMP to a production server. Not sure if there's a relation there but just had to mention it.

'Error: Call to undefined method DirectoryIterator::getExtension() (line 104 of /var/www/vhosts/.../httpdocs/wire/core/Pageimages.php) 
This error message was shown because you are logged in as a Superuser. Error has been logged.'
 
When line 104 in Pageimages.php is commented out i'm able to edit the pages successfully.
 
Any help or information will be appreciated.
 
PW Version 2.5.25 DEV
 

Share this post


Link to post
Share on other sites

:() You're right! Once that was upgraded problem went away. Thank you.

Out of curiosity why would every other aspect of the site work just fine on 5.3.5.

Share this post


Link to post
Share on other sites

:() You're right! Once that was upgraded problem went away. Thank you.

Out of curiosity why would every other aspect of the site work just fine on 5.3.5.

There aren't any intentional restrictions on a PW site working on an older version of PHP, but if a required method etc is not available, then there will be a failure. I am surprised you didn't get a warning about it when you initially installed PW though.

  • Like 1

Share this post


Link to post
Share on other sites

Have the same problem here - would there be a possibility for a workaround without having to upgrade PHP?

Share this post


Link to post
Share on other sites

Hi there,

we got the same issue (Processwire 2.7.2 / PHP 5.3.3) and made a workaround by commenting out the whole block "foreach(new DirectoryIterator($this->path()) as $file…" in PageImages.php.   (line 100 - line 130)

Now the backend works, can you tell us what this section does?

or if it will break something crucial…

Are the some other features in Processwire which are not ok with our Versions?

since we cannot upgrade php on our live-server for the time being we really need this workaround.

should this be too fragile, we will probably try to downgrade processwire on our production-server

best,

phi.l & tom

Share this post


Link to post
Share on other sites

Hi @Tom Walcher and welcome to the forums.

It is for getting variations of an image - cropped, resized, etc. So based on a quick look, you probably won't see these variations listed in your images field. Not ideal, but maybe not critical for you needs - hard to say.

The getExtension method for DirectoryIterator was added in PHP 5.3.6 so that is your key issue. There are other places it is used in the PW core though too: https://github.com/ryancramerdesign/ProcessWire/search?utf8=%E2%9C%93&q=%22-%3EgetExtension%22

So you might have other issues when viewing log files through Setup > Logs or dealing with multi-language stuff. It actually wouldn't be hard at all to replace this method with another approach to getting the file extension, but given that PHP 5.3.3 is 6 years old I think you might be better off hassling your hosting provider to update their system :)

  • Like 2

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Brian Peat
      Hello! I've got a single client on Processwire and it's completely foreign to me. I've been able to find most things, but they've asked for a custom designed page with a full width header image/section, and then a body block and a right side bar below the header. They're using a landing page template, so I duplicated that, figured out how to add it in the admin, and assigned it to the page. Nothing. It doesn't change a thing.
      I feel like I'm missing something obvious. I've made sure all the fields are the same, I tried to set up the parent/child stuff though this page doesn't have a parent that I can tell (though it's under Landing Pages). If I can get the template to actually kick in, I think I can use a bit of code to check for the hero section and load it at the top. I also made a copy of the widget template and set that to load instead of the original. But again, since my main page template isn't kicking in, neither is the new widget template.
      I'd just love some tips on what to check or change to get a landing page to actually render what's in the assigned page template.
      Hopefully I've used the correct terminology here to make sense.
      Thanks!
    • By rookie
      hi there,
      Is there a module or other solution to select a template with a preview image? Sometimes it is not that easy to describe a template.
      e.g. Template with 3 columns (image, title, content, button) or template for a slider with max. 4 pictures.
      Even if it is nice to have a description field for a template, a picture says more than thousand words could describe.
      And no, I don't think I could develop something like that. I don't even know where to start.🙄
    • By muzzer
      I have just upgraded a site from 2.7 to latest v3.
      I have run into a weird issue where a page template setting for slashUrls changes from No to Yes immediately after an ajax call, causing the second ajax call on the page to use the wrong setting.
      There is no reference to the $template->slashUrls() in any of my code.
      This happens every time I load the page, it's 100% consistent.
      I have this running on a second machine under v2.7 and no such weirdness.
      I'm lost as to why this is happening, what would cause a PW setting change for slashUrls? Anyone have any ideas?
       
       
       
    • By FireWire
      Hey all. I'm having an issue with the new custom page classes feature which is a fantastic tool.
      I am running into a recursion issue when attempting to call a custom page class. I have a class called BlogPostPage.php (for blog-post.php) which contains a method called getSummary(). That method gets a summary field or truncates the body in it's absence. I've attached photos of the template code, custom page class code (which I've simplified for testing), and the PW output error.
      There is no recursion in the getSummary() method. This error occurs whether I output multiple blog posts in a loop or if I output one blog post with no looping in my template code.

      In use:
      ProcessWire 3.0.164 dev
      PHP 7.3.13

      I am also using the Template Engine Twig module which has not caused any errors or issues thus far.
      Many thanks!



    • By Pip
      Hi everyone, 
      Is there a way for us to replicate the "http://mydomain.com/processwire/page/edit/?id=xxx" and change the template to match my site template? 
      I'm terribly happy with the admin / backend page edit. It covers literaly everything I want to empower my non super admin user in updating pages such as validation, repeater management, file upload. 
      I wish not to allow the users to see the backend for both security and aesthetic reasons. 
      Thanks and hope to hear from you soon. 
       
×
×
  • Create New...