[EventCalendar] PHP issues

Steve Wamsley swamsley at gmail.com
Mon Aug 3 16:24:13 UTC 2009


OK. I applied the following patch to EventCalendar version 3.1.4 to the 
WP 2.8.2 (and now 2.8.3) sites and the plugin works correctly now. It 
appears to be a conflict with PHP 5.3.0 as opposed to a specific version 
of WP. My development environment is using PHP 5.3.0. My production 
environment is using PHP 5.2.6. I never had the problem. Only the most 
recent release of PHP.

Thanks, Chris, for pointing out where to fix it.

Here is the patch for version 3.1.4 of the EventCalendar plugin:

Index: eventcalendar3.php
===================================================================
--- eventcalendar3.php  (revision 4739)
+++ eventcalendar3.php  (revision 6160)
@@ -132,7 +132,7 @@


 /** Rewrite date restrictions if the query is day- or category- 
specific. */
-function ec3_filter_posts_where(&$where)
+function ec3_filter_posts_where($where)
 {
   global $ec3,$wp_query,$wpdb;

@@ -225,7 +225,7 @@
 }

 /** */
-function ec3_filter_posts_join(&$join)
+function ec3_filter_posts_join($join)
 {
   global $ec3,$wpdb;
   // The necessary joins are decided upon in ec3_filter_posts_where().
@@ -239,7 +239,7 @@
 }

 /** Change the order of event listings (only advanced mode). */
-function ec3_filter_posts_orderby(&$orderby)
+function ec3_filter_posts_orderby($orderby)
 {
   global $ec3, $wpdb;
   if($ec3->order_by_start)
@@ -263,7 +263,7 @@


 /** Eliminate double-listings for posts with >1 scheduled event. */
-function ec3_filter_posts_groupby(&$groupby)
+function ec3_filter_posts_groupby($groupby)
 {
   global $ec3,$wpdb;
   if($ec3->join_ec3_sch || $ec3->order_by_start)
@@ -278,7 +278,7 @@


 /** Add a sched_id field, if we want a listing. */
-function ec3_filter_posts_fields(&$fields)
+function ec3_filter_posts_fields($fields)
 {
   global $ec3;
   if($ec3->is_listing && ($ec3->join_ec3_sch || $ec3->order_by_start))
@@ -536,7 +536,7 @@
 }


-function ec3_filter_the_content(&$post_content)
+function ec3_filter_the_content($post_content)
 {
   return ec3_get_schedule() . $post_content;
 }

Chris Janton wrote:
> 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
>
>
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
>



More information about the EventCalendar mailing list