Free alloc'd memory fix for invoke_if()

Free allocated memory for invoke_if(). Convert first parameter from object to zval, and return NULL value for invoke_if if first parameter is not an object (to satisfy UTs)