[EventCalendar] PHP issues

Chris Janton face at CentosPrime.COM
Fri Jul 31 20:19:55 UTC 2009


On 2009-07-31 , at 11:13 , Steve Wamsley wrote:

> The way I got it to work was to comment out the lines in  
> eventcalendar3.php that call add_filter(...) - lines 584 through 599  
> in version 3.1.4 of the plugin, the site starts working again -  
> including the plugin itself.
>
> I don't know if this is the correct way to fix the problem, but it  
> *looks* to be working correctly.

That doesn't "fix" the problem, it just avoids it.

The actual errors are coming from wp-plugin.php when it calls the  
filters the EC installs (they're what is used to make it work).

I have the option of running older PHP for a little bit, but that  
won't last.

Unfortunately I am not familiar enough with how Wordpress calls  
filters and why the EC filters look like this

  function ec3_filter_post_limits(&$limits)

what I know is that PHP thinks that wp-plugin.php should be calling  
the filters with the first parameter being a reference.

This is what WP is doing to invoke the filters

   $value = call_user_func_array($the_['function'], array_slice($args,  
1, (int) $the_['accepted_args']));

Looking around at other plugins I don't see filters expecting  
arguments by reference (which is what EC is doing).

Just to try, I changed all the filter definitions from

  function ec3_filter_post_limits(&$limits)

to

  function ec3_filter_post_limits($limits)

took out the ampersand. Now it works. No PHP errors from plugin.php,  
no failure to get posts.
I don't know why they expected things by reference.

The same type of change fixed the advanced-category-excluder plugin  
that I use.

8)
----------------------------------
Chris Janton  - face at CentosPrime dot COM
Netminder for Opus1.COM





More information about the EventCalendar mailing list