-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Description
Description
The following code:
#!/usr/bin/env php
<?php
print "open_basedir: ";
var_dump(ini_get("open_basedir"));
print "\n";
$db = new \PDO("sqlite::memory:?cache=shared", null, null, [
\PDO::ATTR_PERSISTENT => true,
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
\PDO::ATTR_EMULATE_PREPARES => false,
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
]);
Resulted in this output:
$ ./sqlite-nomemory.php
open_basedir: string(0) ""
PHP Fatal error: Uncaught PDOException: open_basedir prohibits opening :memory:?cache=shared in …\sqlite-nomemory.php:8
Stack trace:
#0 …\sqlite-nomemory.php(8): PDO->__construct('sqlite::memo
ry:...', NULL, Object(SensitiveParameterValue), Array)
#1 {main}
thrown in …\sqlite-nomemory.php on line 8
But I expected this output instead:
I expected no error. Frankly, the code should just work.
PHP Version
PHP 8.4.13 (cli) (built: Sep 23 2025 15:17:09) (ZTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Zend Engine v4.4.13, Copyright (c) Zend Technologies
with Zend OPcache v8.4.13, Copyright (c), by Zend Technologies
Operating System
Windows 10