mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Merge branch 'PHP-5.6' into PHP-7.0
# Resolved conflicts: # ext/sqlite3/sqlite3.c
This commit is contained in:
commit
23c359c276
2
NEWS
2
NEWS
@ -78,6 +78,8 @@ PHP NEWS
|
||||
. Fixed bug #72668 (Spurious warning when exception is thrown in user defined
|
||||
function). (Laruence)
|
||||
. Fixed bug #72571 (SQLite3::bindValue, SQLite3::bindParam crash). (Laruence)
|
||||
. Implemented FR #72653 (SQLite should allow opening with empty filename).
|
||||
(cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #72622 (array_walk + array_replace_recursive create references
|
||||
|
@ -112,13 +112,11 @@ PHP_METHOD(sqlite3, open)
|
||||
|
||||
if (db_obj->initialised) {
|
||||
zend_throw_exception(zend_ce_exception, "Already initialised DB Object", 0);
|
||||
}
|
||||
|
||||
if (strlen(filename) != filename_len) {
|
||||
return;
|
||||
}
|
||||
if (filename_len != sizeof(":memory:")-1 ||
|
||||
memcmp(filename, ":memory:", sizeof(":memory:")-1) != 0) {
|
||||
|
||||
if (filename_len != 0 && (filename_len != sizeof(":memory:")-1 ||
|
||||
memcmp(filename, ":memory:", sizeof(":memory:")-1) != 0)) {
|
||||
if (!(fullpath = expand_filepath(filename, NULL))) {
|
||||
zend_throw_exception(zend_ce_exception, "Unable to expand filepath", 0);
|
||||
return;
|
||||
@ -138,7 +136,8 @@ PHP_METHOD(sqlite3, open)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
fullpath = estrdup(filename);
|
||||
/* filename equals "" or ":memory:" */
|
||||
fullpath = filename;
|
||||
}
|
||||
|
||||
#if SQLITE_VERSION_NUMBER >= 3005000
|
||||
@ -147,7 +146,7 @@ PHP_METHOD(sqlite3, open)
|
||||
if (sqlite3_open(fullpath, &(db_obj->db)) != SQLITE_OK) {
|
||||
#endif
|
||||
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db));
|
||||
if (fullpath) {
|
||||
if (fullpath != filename) {
|
||||
efree(fullpath);
|
||||
}
|
||||
return;
|
||||
@ -172,7 +171,7 @@ PHP_METHOD(sqlite3, open)
|
||||
sqlite3_set_authorizer(db_obj->db, php_sqlite3_authorizer, NULL);
|
||||
}
|
||||
|
||||
if (fullpath) {
|
||||
if (fullpath != filename) {
|
||||
efree(fullpath);
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,8 @@ Thijs Feryn <thijs@feryn.eu>
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try{
|
||||
$db = new SQLite3('');
|
||||
} catch(Exception $e) {
|
||||
echo $e->getMessage().PHP_EOL;
|
||||
}
|
||||
$db = new SQLite3('');
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Unable to expand filepath
|
||||
--EXPECT--
|
||||
Done
|
||||
|
Loading…
Reference in New Issue
Block a user