Permalink
Browse files

Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Improve check for :memory: pseudo-filename in SQlite

Conflicts:
	ext/sqlite3/sqlite3.c
  • Loading branch information...
2 parents 041dd77 + 055ecbc commit af516750ff32f69c1df10155fa8ec0c9cc5b70ff @johannes johannes committed Jun 22, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −1 ext/pdo_sqlite/sqlite_driver.c
  2. +5 −2 ext/sqlite3/sqlite3.c
@@ -760,7 +760,7 @@ static struct pdo_dbh_methods sqlite_methods = {
static char *make_filename_safe(const char *filename TSRMLS_DC)
{
- if (*filename && strncmp(filename, ":memory:", sizeof(":memory:")-1)) {
+ if (*filename && memcmp(filename, ":memory:", sizeof(":memory:"))) {
char *fullpath = expand_filepath(filename, NULL TSRMLS_CC);
if (!fullpath) {
@@ -114,7 +114,10 @@ PHP_METHOD(sqlite3, open)
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Already initialised DB Object", 0 TSRMLS_CC);
}
- if (strncmp(filename, ":memory:", 8) != 0) {
+ if (strlen(filename) != filename_len) {
+ return;
+ }
+ if (memcmp(filename, ":memory:", sizeof(":memory:")) != 0) {
if (!(fullpath = expand_filepath(filename, NULL TSRMLS_CC))) {
zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Unable to expand filepath", 0 TSRMLS_CC);
return;
@@ -1959,7 +1962,7 @@ static int php_sqlite3_authorizer(void *autharg, int access_type, const char *ar
switch (access_type) {
case SQLITE_ATTACH:
{
- if (strncmp(arg3, ":memory:", sizeof(":memory:")-1) && *arg3) {
+ if (memcmp(arg3, ":memory:", sizeof(":memory:")) && *arg3) {
TSRMLS_FETCH();
#if PHP_API_VERSION < 20100412

0 comments on commit af51675

Please sign in to comment.