[wp-testers] PHP4 compatibility bug?

Eric Mann eric at eam.me
Wed Jan 26 16:30:15 UTC 2011


That sounds like an issue ... particularly since we've pledged to support
PHP4 until WP 3.2 drops.

I recommend adding the following somewhere (as written in the PHP
documentation on
http://www.php.net/manual/en/function.array-intersect-key.php#54429):

if ( ! function_exists( 'array_intersect_key' ) ) :
function array_intersect_key($arr1, $arr2) {
  $res = array();
  foreach($arr1 as $key=>$value) {
    if(array_key_exists($key, $arr2)) $res[$key] = $arr1[$key];
  }
  return $res;
}
endif;

This should allow PHP4 users (who don't have the function natively) to avoid
the issue ... I hope ... just pitching the idea because I haven't had time
to test it (and I don't have any systems running PHP4 to adequately test on
anyway).

On Wed, Jan 26, 2011 at 8:24 AM, Adrian Walmsley <adrian at walmsley.org.uk>wrote:

> Because I was having problems with my PHP4 hosted 3.1 test site after
> upgrading to 3.1 RC2, I discarded it and reinstalled using the latest
> nightly build.
>
> Now I get the error message
> *Fatal error*: Call to undefined function: array_intersect_key() in *
> /home/compton/public_html/web/wp-admin/includes/class-wp-list-table.php* on
> line *274*
>
>
> and I believe array_intersect_key()is new in PHP5.
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>


More information about the wp-testers mailing list