Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illuminate/database undefined rescue function when using SQLite #49354

Closed
lcharette opened this issue Dec 13, 2023 · 0 comments · Fixed by #49355
Closed

Illuminate/database undefined rescue function when using SQLite #49354

lcharette opened this issue Dec 13, 2023 · 0 comments · Fixed by #49355
Labels

Comments

@lcharette
Copy link
Contributor

Laravel Version

10.37.1

PHP Version

8.3.0

Database Driver & Version

SQLite

Description

When using Illuminate/database as a standalone component, following the README instructions and SQLite, the following error is thrown when using hasTable: Call to undefined function Illuminate\Database\Schema\rescue().

This was not an issue with prior Laravel version (namely Laravel 8). There's either a missing dependency, missing installation step, or the hard requirement on rescue makes it impossible to use it as a standalone component.

Steps To Reproduce

  1. composer require "illuminate/database"
  2. Create index.php
<?php

use Illuminate\Database\Capsule\Manager as Capsule;

require_once __DIR__ . '/../vendor/autoload.php';

$capsule = new Capsule();
$capsule->addConnection([
    'driver' => 'sqlite',
    'database' => 'database.db',
]);
$capsule->setAsGlobal();

echo Capsule::schema()->hasTable('users');
  1. php index.php

Result :

PHP Fatal error:  Uncaught Error: Call to undefined function Illuminate\Database\Schema\rescue() in /Users/malou/Desktop/ldb/vendor/illuminate/database/Schema/SQLiteBuilder.php:40
Stack trace:
#0 /Users/malou/Desktop/ldb/vendor/illuminate/database/Schema/Builder.php(162): Illuminate\Database\Schema\SQLiteBuilder->getTables()
#1 /Users/malou/Desktop/ldb/src/index.php(17): Illuminate\Database\Schema\Builder->hasTable('users')
#2 {main}
  thrown in /Users/malou/Desktop/ldb/vendor/illuminate/database/Schema/SQLiteBuilder.php on line 40

Fatal error: Uncaught Error: Call to undefined function Illuminate\Database\Schema\rescue() in /Users/malou/Desktop/ldb/vendor/illuminate/database/Schema/SQLiteBuilder.php:40
Stack trace:
#0 /Users/malou/Desktop/ldb/vendor/illuminate/database/Schema/Builder.php(162): Illuminate\Database\Schema\SQLiteBuilder->getTables()
#1 /Users/malou/Desktop/ldb/src/index.php(17): Illuminate\Database\Schema\Builder->hasTable('users')
#2 {main}
  thrown in /Users/malou/Desktop/ldb/vendor/illuminate/database/Schema/SQLiteBuilder.php on line 40
@crynobone crynobone added the bug label Dec 13, 2023
crynobone added a commit that referenced this issue Dec 13, 2023
taylorotwell pushed a commit that referenced this issue Dec 13, 2023
taylorotwell pushed a commit to illuminate/database that referenced this issue Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants