Bug: Activating Recent Custom Post Types Widget triggers fatal error

Fatal error: Call-time pass-by-reference has been removed in /var/www/html/wp-content/plugins/recent-custom-post-type/recent-custom-post-type.php on line 392

That line appears in the section labeled “PHP<5.3 compatibility layer.”

Removing the ampersand from $count in preg_replace() on that line seems to solve the problem and the plugin can then be activated without any errors. (Tested on PHP 5.4.10)

Also, “Recent Custom Post Types Widget” doesn’t appear in your “Select an Installed Product” dropdown menu in the support form. I selected “Recent Custom Posts” because that appears related.

  • Kimberly
    • Champion of Loops

    Hello there!

    I’ve done a quick test and can activate and use the widget on a live test install without any issues.

    Perhaps there is a compatibility issue with the php version? is this a local installation?

    Have you checked for another plugin conflict? will it work activated by itself, without the code edit?



  • morgan_ramsay
    • WPMU DEV Initiate

    Whethere there’s a compatibility issue with the PHP version is for you to determine. You should have PHP 5.4. PHP 5.4.11 is the latest production version. 5.4.10 is the latest version on the standard CentOS repos.

    I’m running a virtual server.

    If there’s a plugin conflict, it’s either a conflict with BuddyPress 1.6.4 or one of your plugins. In any case, the plugin won’t activate with the PHP<5.3 compatibility layer as written.

  • Kimberly
    • Champion of Loops

    If it’s a problem with the plugin then I would have gotten the error as well.

    So it must be something specific to the site.

    If you’ve tried with BuddyPress turned off then it’s not a BUddyPress conflict.

    Are your custom post types contained in your theme or generated by a plugin?

  • morgan_ramsay
    • WPMU DEV Initiate

    Your plugin is not compatible with PHP 5.4.

    There is no reference sign on a function call – only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that “call-time pass-by-reference” is deprecated when you use & in foo(&$a);. And as of PHP 5.4.0, call-time pass-by-reference was removed, so using it will raise a fatal error.

    This plugin needs to be updated.

    (You need to update PHP on your server, too.)


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.