php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75455 Unable to extend SQLite3 class: out of sequence error
Submitted: 2017-10-29 21:10 UTC Modified: 2017-10-29 21:21 UTC
From: t dot oelgarte at asysgmbh dot de Assigned:
Status: Closed Package: SQLite related
PHP Version: 7.1.11 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2017-10-29 21:10 UTC] t dot oelgarte at asysgmbh dot de
Description:
------------
If i extend the SQLite3 class and overwrite it's constructor, then the call to the parent constructor (the constructor of SQLite3) will throw an Exception with the following error message: "Unable to open database: library routine called out of sequence".

Test script:
---------------
class MySqlite extends \SQLite3 {

  function __construct(string $filename, int $flags = null, string $encryption_key) {
    parent::__construct($filename, $flags, $encryption_key);
    $this->enableExceptions(true);
    $this->busyTimeout(60000);
  }

}

$con = new MySqlite('file.sqlite3');


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-29 21:21 UTC] t dot oelgarte at asysgmbh dot de
-Status: Open +Status: Closed
 [2017-10-29 21:21 UTC] t dot oelgarte at asysgmbh dot de
My bad. The constructor does not accept null as the second argument. Somehow my IDE made the assumption that null was an acceptable default value for the flags. Guess that isn't the case.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 26 10:01:23 2021 UTC