I obtain always this error and I can proceed only eliminating
ec_receipt
Fatal error: Call to undefined function: array_intersect_key() in /web/htdocs/extra.hopfrog.it/home/modules/ecommerce/ec_receipt/ec_receipt.module on line 917

Comments

gordon’s picture

Status: Active » Closed (works as designed)

e-Commerce requires PHP5.2 or the PHP_Compat package from PEAR

Leech’s picture

You can also add this function at the end:


if (!function_exists('array_intersect_key')) {
    function array_intersect_key()
    {
        $arrs = func_get_args();
        $result = array_shift($arrs);
        foreach ($arrs as $array) {
            foreach ($result as $key => $v) {
                if (!array_key_exists($key, $array)) {
                    unset($result[$key]);
                }
            }
        }
        return $result;
   }
}

tdave00’s picture

Could you expound a little on exactly where to add that function. I am having the same problem and I assume it is due to my servers version of php.

gordon’s picture

In your settings.php add the following.

require_once 'PHP/Compat.php';

PHP_Compat::loadFunction(array('array_intersect_key'));
craigwilcox’s picture

i'm getting the exact same error. i have php 4.47, but i just installed the Compat module, and it's still not working. if you can provide a solution, please give me the exact folder path to use. thanks!

craig

tonedoggydogg’s picture

I also found where PHP_Compat will fix this problem, so I understand what's going on. My server has both php 4.x and 5.x but the file must end in .php5 in order to implement the 5.x version. So using PHP_Compat would be cool, and I'd love to put this in settings.php...

But whereis settings.php located??? Sorry for such a stupid question.

bwv’s picture

tdave00: that function (without the <?php> goes at the end of the ec_receipt module. This emendation worked for me. I am using PHP 5.0.5. bwv

tdave00’s picture

Thanks for the clarifying that.

tdave00’s picture

This worked for me. I pasted it at the bottom of ec_receipt.module (without the php statements). Thanks