Commit Graph

117 Commits

Author SHA1 Message Date
Dmitry Stogov
067df26344 Use memrchr() when available
On x86_64 glibc memrchr() uses SSE/AVX CPU extensions and works much
faster then naive loop. On x86 32-bit we still use inlined version.

memrchr() is a GNU extension. Its prototype  becomes available when
<string.h> is included with defined _GNU_SOURCE macro. Previously, we
defined it in "php_config.h", but some sources may include <string.h>
befire it. To avod mess we also pass -D_GNU_SOURCE to C compiler.
2021-11-24 16:13:34 +03:00
Stanislav Malyshev
d72e82bfc0
Merge branch 'PHP-8.0'
* PHP-8.0:
  Update NEWS
  Fix #76448: Stack buffer overflow in firebird_info_cb
  Fix #76449: SIGSEGV in firebird_handle_doer
  Fix #76450: SIGSEGV in firebird_stmt_execute
  Fix #76452: Crash while parsing blob data in firebird_fetch_blob
  Fix #81122: SSRF bypass in FILTER_VALIDATE_URL
2021-06-27 21:40:02 -07:00
Stanislav Malyshev
892674ef70
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update NEWS
  Fix #76448: Stack buffer overflow in firebird_info_cb
  Fix #76449: SIGSEGV in firebird_handle_doer
  Fix #76450: SIGSEGV in firebird_stmt_execute
  Fix #76452: Crash while parsing blob data in firebird_fetch_blob
  Fix #81122: SSRF bypass in FILTER_VALIDATE_URL
2021-06-27 21:39:23 -07:00
Stanislav Malyshev
2327e3d36a
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Fix #76448: Stack buffer overflow in firebird_info_cb
  Fix #76449: SIGSEGV in firebird_handle_doer
  Fix #76450: SIGSEGV in firebird_stmt_execute
  Fix #76452: Crash while parsing blob data in firebird_fetch_blob
  Fix #81122: SSRF bypass in FILTER_VALIDATE_URL
2021-06-27 21:36:55 -07:00
Christoph M. Becker
67afa32541
Fix #76448: Stack buffer overflow in firebird_info_cb
We ensure not to overflow the stack allocated buffer by using `strlcat`.
2021-06-20 22:01:06 -07:00
Christoph M. Becker
08da7c7372
Fix #76449: SIGSEGV in firebird_handle_doer
We need to verify that the `result_size` is not larger than our buffer,
and also should make sure that the `len` which is passed to
`isc_vax_integer()` has a permissible value; otherwise we bail out.
2021-06-20 21:59:51 -07:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
George Peter Banyard
5caaf40b43
Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
George Peter Banyard
ebaeb93c3f Add API to fetch bool value for PDO attribute values
Closes GH-6766
2021-03-17 00:58:01 +00:00
George Peter Banyard
c465462e91 Use standard PDO way for fetching integer attribute values 2021-03-17 00:58:01 +00:00
George Peter Banyard
94ea8e247b Refactor PDO doer handler to use zend_string 2021-01-19 11:42:39 +00:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
George Peter Banyard
63cda0fea8 Refactor PDO's quoter handler to return a zend_string
Closes GH-6547
2021-01-07 15:53:48 +00:00
George Peter Banyard
1a58611ae5 Voidify PDO's fetch_error handler 2021-01-06 10:20:57 +00:00
George Peter Banyard
60a61afd3c Boolify PDO's preparer handler 2021-01-06 10:20:57 +00:00
George Peter Banyard
53ba72ec03 Voidify PDO's closer handler 2021-01-06 10:20:57 +00:00
George Peter Banyard
954d3743cc Boolify PDO's quoter handler 2021-01-06 10:21:06 +00:00
George Peter Banyard
43f69160cf Boolify PDO's set_attribute driver function 2021-01-06 10:20:59 +00:00
George Peter Banyard
d04adf60be Boolify PDO's transaction handlers
This includes begin(), commit(), rollBack(), and inTransaction()
2021-01-06 10:20:57 +00:00
Nikita Popov
caa710037e Rewrite PDO result binding
Instead of requiring the type to be determined in advance by the
describer function and then requiring get_col to return a buffer
of appropriate type, allow get_col to return an arbitrary zval.
See UPGRADING.INTERNALS for a more detailed description of the
change.

This makes the result fetching simpler, more efficient and more
flexible. The general possibility already existed via the special
PDO_PARAM_ZVAL type, but the usage was very inconvenient and/or
inefficient. Now it's possible to easily implement behavior like
"return int if it fits, otherwise string" and to avoid any kind
of complex management of temporary buffers.

This also fixes bug #40913 (our second highest voted bug of all
time, for some reason). PARAM_LOB result bindings will now
consistently return a stream resource, independently of the used
database driver.

I've tried my best to update all PDO drivers for this change, but
some of the changes may be broken, as I cannot test or even build
some of these drivers (in particular PDO dblib and PDO oci).
Fixes are appreciated -- a working CI setup would be even more
appreciated ;)
2020-12-22 15:56:34 +01:00
Christoph M. Becker
58d459f1ef Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #80521: Parameters with underscores no longer recognized
2020-12-16 20:06:01 +01:00
Christoph M. Becker
1860ef22eb Fix #80521: Parameters with underscores no longer recognized
We have to use the proper value for the bitmask.
2020-12-16 20:04:52 +01:00
Nikita Popov
2d51c203f0 PDO: Store/pass query_string as zend_string
Rather than storing char* + size_t, use a zend_string*. Also
avoid various copies of the query string.
2020-12-14 10:43:28 +01:00
Nikita Popov
c288b5294b Fix compile warnings in PDO Firebird 2020-12-14 10:36:36 +01:00
Nikita Popov
e735de6eae Add GC support for PDO driver data
Add a get_gc method that can be implemented by drivers, which can
be used to add additional zvals to the GC buffer.

Implement GC support for PDO SQLite callbacks in particular.

Closes GH-6262.
2020-10-12 13:00:41 +02:00
Simonov Denis
17a789e27c Fix #64937: Firebird PDO preprocessing sql
This patch fixes some problems with preprocessing SQL queries.

* The new algorithm takes into account single-line and multi-line
  comments and ignores the ":" and "?" Parameter markers in them.

* The algorithm allows the EXECUTE BLOCK statement to be processed
  correctly. For this statement, it is necessary to search for
  parameter markers between EXECUTE BLOCK and AS, the rest should be
  left as is.

The SQL preprocessing code has been ported from Firebird to handle
EXECUTE STATEMENT.

Closes GH-4920.
2020-09-25 00:07:57 +02:00
George Peter Banyard
db7dc2fa2f Fix [-Wundef] warning in PDO Firebird extension 2020-05-20 16:29:52 +02:00
Christoph M. Becker
c2f56d0546 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add support for Interbase 1 dialect
2019-10-28 16:41:16 +01:00
Simonov Denis
3fb42a382c Add support for Interbase 1 dialect 2019-10-28 16:40:51 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
645b0372e3 Fix double free of DSN credentials 2019-09-09 10:10:41 +02:00
Sjon Hortensius
a7881df281 PDO: support username & password specified in DSN 2019-07-02 12:09:38 +02:00
Dmitry Stogov
457392fa64 Cheaper checks for exceptions thrown from __toString() 2019-06-06 01:47:22 +03:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Anatol Belski
b2a200188f Remove inappropriate FreeLibrary calls 2018-06-11 13:53:17 +02: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
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Dmitry Stogov
9e709e2fa0 Move constants into read-only data segment 2017-12-14 18:43:44 +03:00
Kalle Sommer Nielsen
d86a333a43 Free the HMODULE handle after use 2017-07-21 22:22:41 +02:00
Adam Baratz
2f09973968 Remove dead code related to error constants 2017-03-01 16:28:47 -05:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Dorin Marcoci
e926bf6507 Fixes #65689. PDO_Firebrid / exec() does not free allocated statement. 2016-12-25 22:06:20 -08:00
Anatol Belski
3e6c02b91a fix ibase handle initialization, mostly compiler warnings 2016-06-06 13:30:17 +02:00
Xinchen Hui
36b4311edd Do not edit the value in place (might be relates to #71261) 2016-01-04 05:38:15 -08:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Stanislav Malyshev
dfe6aea9ca size_t cleanup for PDO 2015-01-26 16:16:02 -08:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00