Closed jthorpe-marco closed 5 years ago
Can you test it with PHP 7.2/7.3?
I don't have an environment running 7.2 or 7.3 right now, but I'll try to get one setup today or tomorrow to try the same tests.
I can confirm it has the same error in 7.2.10. I haven't had a chance to test in a 7.3 environment yet.
What's the minimal code that triggers the error? What's your version of the pdo_sqlsrv
driver?
It looks like anything that adds a foreign key. So this for example will trigger it:
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions']);
I don't believe I'm using the pdo_sqlsrv driver. I don't have any reference to it in my php.ini file and I've been using freeTDS and php7.x-sybase ever since my first Laravel install a couple years ago. This SO thread is where I discovered that method: https://stackoverflow.com/questions/39860273/laravel-to-sql-server-sqlsrv-pdoexception-could-not-find-driver
Is that incorrect and I should be using the pdo_sqlsrv driver?
Is that driver up-to-date? Can you test it with pdo_sqlsrv
?
"Segmentation fault" errors typically don't come from PHP code (e.g. Laravel), but from "deeper" code like drivers.
That makes sense. I believe the driver is up to date (although not sure how well maintained it is), but based on what you're saying I'm guessing most people are probably using the pdo_sqlsrv driver and thus not having the issue. I won't be able to test it with pdo_sqlsrv for a few days at least, but if the issue is still open I'll definitely test it when I can.
@jthorpe-marco I'd indeed advised to use the pdo driver. Let us know what you can find out when trying to test with it.
Hi, I have the same issue when I have on one table two different foreign keys referencing the same table. I am running on php7.2 using laravel 5.7, with the default config for sqlsrv
I am also having this issue but not all the time.
This does not work.
$table->foreign('reason_id')->references('id')->on('reasons');
$table->foreign('user_id_recieved')->references('id')->on('users');
$table->foreign('user_id_returned')->references('id')->on('users');
$table->foreign('ipad_hardware_id')->references('ipad_hardware_id')->on('ipad_hardware');
This does work.
$table->foreign('reason_id')->references('id')->on('reasons');
$table->foreign('user_id_recieved')->references('id')->on('users');
$table->foreign('user_id_returned')->references('id')->on('users');
// $table->foreign('ipad_hardware_id')->references('ipad_hardware_id')->on('ipad_hardware');
Confused.
Edit: My model has the proper protected properties. php 7.2 installed from brew.
Edit2: Tested with PostgreSQL and everything worked fine.
I'm going to say my issues are not related to this issue. I got it working after rethinking the schema. Still not pleasant to work with SQL Server (not my choice in the first place).
I can confirm that my original issue is no longer present when using the Microsoft pdo_sqlsrv driver.
Okay, closing this off then.
Description:
I was migrating some roles and permissions tables to an existing project and received the following error during migration:
Segmentation fault (core dumped)
I was having a hard time tracking down the issue so I commented out pieces of the migration to find the problem. It ended up happening only when running the foreign key creation statements like this one:
To verify it wasn't my application (in Laravel 5.5.44), I created a new application using 5.7.21 and pointed it at a MySQL database. The migrations ran properly. I pointed the same application at a brand new SQL Server 2014 database and was able to run the auth migrations, but not the migrations with a foreign key creation statement.
Steps To Reproduce:
1) Create a new application (Laravel 5.5 or 5.7, both gave me the same results) 2) Create a new SQL Server database (give your user full permissions to rule that out) 2) php artisan make: auth 3) php artisan migrate 4) composer require spatie/laravel-permission 5) php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations" 6) php artisan migrate You should receive the
Segmentation fault (core dumped)
error.I don't believe it's the laravel-permission package as their syntax is exactly the same as the documentation listed here: https://laravel.com/docs/5.7/migrations#foreign-key-constraints
Let me know if there's any further info I can provide.