ccovey / odbc-driver

Laravel 4 ODBC Driver
28 stars 48 forks source link

Core Dump on Find #16

Closed wstaples closed 10 years ago

wstaples commented 10 years ago

When I try to query a table using the find method inside a phpunit test I see an error "Segmentation fault (core dumped)". If I try to run the code inside laravel I just get a white screen in the browser. I'm using ccovey odbc driver version v1.1.2 (reference: cc3b4ecfba83ef3e9febc0971f5ddc612e73c663) Laravel 4.1

My Model looks like this:

class Customer extends Eloquent {
    protected $connection = 'odbc';
    protected $primaryKey = "CUSTOMER_ID";
    protected $table = "CUSTOMERS";
    public $incrementing = false;
    public $timestamps = false;
}

When I try any of the following code:

$customer = Customer::find("ABC1");
$customer = Customer::findOrfail("ABC1");
$customer = Customer::where("CUSTOMER_ID", "=", "ABC1")->get();
$customer->save();

I get the message "Segmentation fault (core dumped)".

The following methods do work:

$customer = new Customer;
$customer = Customer::first();
$customer = Customer::whereRaw("customer_id = 'ABC1'");

If I switch my model to use a mysql connection everything works fine. What could be the issue here?

wstaples commented 10 years ago

Is anyone else able to use the find method on ODBC connections?

wstaples commented 10 years ago

I'm running on php version 5.4 is anyone using this with any other version?

wstaples commented 10 years ago

This turns out to be an issue with PHP's pdo_odbc.so and 64-bit drivers. Upgrading to php 5.5.16 has resolved the issue. you can read more about the issue here: http://onefinepub.com/2014/02/php-segfaults-pdo_odbc-64-bit-platforms/