Commit graph

330 commits

Author SHA1 Message Date
Christoph M. Becker
a757ebb5b5 Require SQLite ≥ 3.7.4 for ext/sqlite3
`SQLite3::readOnly()` uses `sqlite3_stmt_readonly()` which is only
available as of libsqlite 3.7.4.  For older SQLite3 versions we return
always `false`, which can be confusing.  Instead of sticking with this
behavior, or even undefining the method for old SQLite3 versions, we
lift the requirements to SQLite 3.7.4 (released on 2010-12-08),
according to a respective discussion[1].

Since pdo_sqlite doesn't use `sqlite3_stmt_readonly()`, we stick with
the minimum requirement of SQLite 3.5.0.

[1] <https://github.com/php/php-src/pull/3614>
2018-11-29 15:10:39 +01:00
Christoph M. Becker
525d3ae858 Handle potential sqlite3_bind_*() call failures
Since bug 77051 has been fixed, it is unlikely that any of the
 `sqlite3_bind_*` calls will ever fail, but we add respective checks
nonetheless, and call `php_sqlite3_error()` in case of bind failures.
2018-11-29 13:19:26 +01:00
Christoph M. Becker
0d3799dedc Merge branch 'PHP-7.3'
* PHP-7.3:
  Fix #77051: Issue with re-binding on SQLite3
2018-11-29 02:20:20 +01:00
Christoph M. Becker
471eb0dd95 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77051: Issue with re-binding on SQLite3
2018-11-29 02:18:56 +01:00
BohwaZ
94ec262fca Fix #77051: Issue with re-binding on SQLite3
We have to call `sqlite3_reset()` before re-binding the parameters.
2018-11-29 02:16:57 +01:00
Christoph M. Becker
035de21d77 Deny (un)serialization of SQLite3, SQLite3Stmt and SQLite3Result
Serializing `SQLite3`, `SQLite3Stmt` and `SQLite3Result` instances is
possible but pointless, since unserializing results in uninitialized
instances, which will bail out of any method call.  Therefore, we deny
serialization and unserialization in the first place.
2018-11-29 01:08:03 +01:00
Dmitry Stogov
0f7f1498be Use ZEND_THIS macro to hide implementation details in extensions code. 2018-11-15 19:54:19 +03:00
Dmitry Stogov
c6ad0b92b7 Replace getThis() by EX(This), when additional check is not necessary. 2018-11-14 02:44:25 +03:00
Christoph M. Becker
86c6b3bdcd Support SQLite3 @name notation
Besides the common `:param` notation to designate named parameters in
prepared statements, SQLite3 also supports `@param` and `$param`.
While the latter is mostly to support the Tcl programming language, and
would be confusing for PHP's sqlite3 binding due to the similarity with
string interpolation, the former is common under .NET and raises no
such issue.  Therefore we add support for it.

This patch has been developed in cooperation with @BohwaZ.
2018-11-11 14:55:34 +01:00
Christoph M. Becker
b7b3a65e1d Avoid needless string duplication
Cf. <https://github.com/php/php-src/pull/3636#issuecomment-436638833>.
2018-11-07 17:10:35 +01:00
Christoph M. Becker
87392eff1a Require SQLite ≥ 3.5.0 for ext/sqlite3 and ext/pdo_sqlite
It is possible to pass flags when opening an SQLite database.  For
Sqlite < 3.5.0 these are ignored, since `sqlite3_open` doesn't support
flags.  Neither a warning or notice is raised in this case, nor is this
behavior documented in the PHP manual.  Instead of fixing it either
way, we lift the requirement to SQLite 3.5.0 (released on 2007-09-04)
instead of the former SQLite 3.3.9 (released on 2007-01-04).
2018-10-13 12:15:58 +02:00
Dmitry Stogov
8939c4d96b Get rid of ZEND_ACC_CTOR, ZEND_ACC_DTOR and ZEND_ACC_IMPLEMENTED_ABSTRACT 2018-09-05 13:16:10 +03:00
Christoph M. Becker
d035bc2bfe Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle
2018-07-26 14:23:40 +02:00
Christoph M. Becker
ce66492a13 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle
2018-07-26 13:26:58 +02:00
Christoph M. Becker
ed7e3bc70a Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle
We need to ensure that a zval IS_DOUBLE before we access it as such.
In this case we apply common type juggling to do so.
2018-07-26 13:15:19 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Dmitry Stogov
b6cc4d2009 Use zval_ptr_dtor() instead of zval_dtor() in internal functions that destroy new created object (This is safer and produces less code) 2018-07-05 11:54:26 +03:00
Peter Kokot
29000091b2 Remove sqlite and xmlrpc extension versions from phpinfo output
The rest of the core extensions don't display the extension versions in
the phpinfo output since they in most cases match the PHP release version.
2018-07-03 17:01:17 +02:00
Nikita Popov
f2c4f06f84 Remove unnecessary uses of z/ parameters 2018-06-25 22:27:42 +02:00
Dmitry Stogov
f2b4ec4bdc Export standard object handlers, to avoid indirect access 2018-05-31 11:57:22 +03:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Gabriel Caruso
701437a948
Remove return types from some magic method in protos
__construct, __destruct, __wakeup does not have return types defined.
2018-03-09 12:04:46 +01:00
Dmitry Stogov
d8f916124b Usee reference-counting instead of duplication 2018-01-19 13:19:49 +03:00
Xinchen Hui
88b8cd7385 Use stack allocated zvals 2018-01-07 20:03:49 +08:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Dmitry Stogov
83e495e0fd Move constants into read-only data segment 2017-12-14 22:14:36 +03:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Nikita Popov
b72b1a4e4d Add zend_object_alloc() API
Using ecalloc() to create objects is expensive, because the
dynamic-size memset() is unreasonably slow. Make sure we only
zero the main object structure with known size, as the properties
are intialized separately anyway.

Technically we do not need to zero the embedded zend_object
structure either, but as long as the memset argument is constant,
a couple more bytes don't really matter.
2017-11-25 17:12:37 +01:00
Dmitry Stogov
9cf87aa196 Avoid HashTable allocations for empty arrays (using zend_empty_array). 2017-10-24 17:27:31 +03:00
Remi Collet
5e5895a464 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  fix build with old system libsqlite (sqlite3_errstr may be missing)
2017-08-02 14:03:23 +02:00
Remi Collet
5f030924c1 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fix build with old system libsqlite (sqlite3_errstr may be missing)
2017-08-02 14:03:02 +02:00
Remi Collet
666cb6c802 fix build with old system libsqlite (sqlite3_errstr may be missing) 2017-08-02 14:01:56 +02:00
Anatol Belski
176b45fa3a Merge branch 'PHP-7.1'
* PHP-7.1:
  Fixed bug #74883 SQLite3::__construct() produces "out of memory" exception with invalid flags
2017-07-09 01:32:07 +02:00
Anatol Belski
02cc492015 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74883 SQLite3::__construct() produces "out of memory" exception with invalid flags
2017-07-09 01:31:25 +02:00
Anatol Belski
b5338c0b7d Fixed bug #74883 SQLite3::__construct() produces "out of memory" exception with invalid flags 2017-07-08 23:52:22 +02:00
Nikita Popov
035a27cbc6 Only compute callback name in error cases
Mostly the callback name is only used to report an error. Try to
avoid calculating it if no error occurred.
2017-06-25 18:45:59 +02:00
BohwaZ
626ee74ee8 Change flags to use SQLITE3_OPEN_READ* constants instead of a fake-boolean, add tests on errors 2017-06-08 11:25:00 +12:00
BohwaZ
208aea1e85 Implement writing to BLOBs in SQLite3 2017-05-18 11:54:55 +12:00
Anatol Belski
e282c403c5 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix misleading typo in identifiers
2017-04-11 13:50:56 +02:00
Anatol Belski
a334da8b17 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix misleading typo in identifiers
2017-04-11 13:49:19 +02:00
Anatol Belski
8bba2df2eb Fix misleading typo in identifiers 2017-04-11 13:48:04 +02:00
Joe Watkins
f0f8c9cf0a
Merge branch 'PHP-7.1'
* PHP-7.1:
  fixed bug #74413 wrong reflection on SQLite3::enableExceptions
2017-04-11 12:17:00 +01:00
Joe Watkins
8bbdbd063e
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  fixed bug #74413 wrong reflection on SQLite3::enableExceptions
2017-04-11 12:15:24 +01:00
Joe Watkins
b74b325aea
fixed bug #74413 wrong reflection on SQLite3::enableExceptions 2017-04-11 12:14:25 +01:00
Remi Collet
83b0708878 Merge branch 'PHP-7.1'
* PHP-7.1:
  Fix buid with system libsqlite, see bug #74217
2017-03-29 07:28:26 +02:00
Remi Collet
012dc336a6 Fix buid with system libsqlite, see bug #74217
SQLITE_DETERMINISTIC only exists in recent version
e.g. missing on 3.7 which is the default on RHEL/CentOS-7
and probably others (wheezy have 3.7, jessie 3.8...)
2017-03-29 07:25:01 +02:00
Nikita Popov
e31342ef84 Merge branch 'PHP-7.1' 2017-03-12 17:04:02 +01:00
andrewnester
fbf0e0587f Implement FR #74217: deterministic sqlite functions 2017-03-12 17:03:00 +01:00