Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7065025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:54:22+00:00 2026-05-28T04:54:22+00:00

I have a custom WordPress plugin that works fine on my local dev machine,

  • 0

I have a custom WordPress plugin that works fine on my local dev machine, but triggers an error on the production server.

The function:

function _iniloader_get_dirs($dir) {
        $dirs = array_filter(scandir($dir), function ($item) use ($dir) {
            return (is_dir($dir.'/'.$item) && $item != "." && $item != "..");
        });
        // Use array_values to reset the array keys:
        return array_values($dirs);
}

The error:

Parse error: syntax error, unexpected T_FUNCTION in (in plugin) on
line 30

Line 30 is the second line of the function.

My local MAMP server = PHP Version 5.3.6
Linux production server = PHP Version 5.3.5

Does anyone have an idea what the issue could be, and why it would show up in one environment but not the other?


UPDATE:

I just noticed that, if I put this function in a regular PHP file on the production box, it executes fine- so it’s only triggering the error when it’s part of the WordPress plugin, which makes even less sense to me…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:54:22+00:00Added an answer on May 28, 2026 at 4:54 am

    Likely it’s your usage of Closures.

    These became available in PHP > 5.3. Your Production server is either not running 5.3 or a minor version that might be buggy.

    Refactor the use clause and I imagine it will run on both environments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom developed WordPress plugin that is using jQuery 1.4 and for
I have create a custom url for my plugin in WordPress that I don't
I'm currently working on a wordpress 2.9.2 plugin (my first) that creates additional custom
I'm writing a plugin for Wordpress developers that allows a dev to include my
I currently have a custom page in Wordpress (with the PHP Execution plugin). On
I'm writing a plugin but I have a problem. When Wordpress is displaying posts
I'm using the anytime.js datepicker library of a WordPress plugin that was custom-developed for
I have 2 custom fields in my WordPress system when creating new posts. One
I wanted to use the custom field for wordpress to have a different header
I have custom errors configured in my web.config, but IIS 6.0 is returning the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.