Skip to content

Illuminate/database undefined rescue function when using SQLite #49354

@lcharette

Description

@lcharette

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions