Commit Graph

272 Commits

Author SHA1 Message Date
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
Christoph M. Becker
bcbf8aa0c9
Fix #76450: SIGSEGV in firebird_stmt_execute
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:37 -07:00
Christoph M. Becker
286162e9b0
Fix #76452: Crash while parsing blob data in firebird_fetch_blob
We need to prevent integer overflow when calling `erealloc()` with
`len+1`.
2021-06-20 21:56:07 -07:00
Christoph M. Becker
b300c6b87f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Disable LSan for all PDO_Firebird tests
2021-05-13 23:34:37 +02:00
Christoph M. Becker
f6c15e2caf
Disable LSan for all PDO_Firebird tests
The tests leak memory, likely due to a slightly unclean shutdown of
libfbclient.  To avoid failing CI, we disable LSan for all the tests.

Closes GH-6966.
2021-05-13 23:30:17 +02:00
Christoph M. Becker
fb2bf8bd58
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Add simple Firebird payload fake server to test suite
2021-05-06 14:50:22 +02:00
Christoph M. Becker
f95f8a3c1e
Add simple Firebird payload fake server to test suite
This is meant to test against certain fixed responses of Firebird
servers.  For now we add just a most basic test which verifies a
connection attempt.

Closes GH-6940.
2021-05-06 14:47:57 +02:00
Christoph M. Becker
9e51b487f3
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Add CONFLICTS file for PDO firebird tests
2021-05-05 15:24:58 +02:00
Nikita Popov
896e4d3428
Add CONFLICTS file for PDO firebird tests
Just in case anybody executes these test in parallel on PHP 7.4.

(cherry picked from commit b4ffe54174)

Closes GH-6943.
2021-05-05 15:24:30 +02: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
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
Máté Kocsis
ec22e5aa38
Get rid of empty function entries
Closes GH-5917
2020-08-01 10:07:05 +02:00
Christoph M. Becker
c9639cffdb Fix PDO_Firebird numeric to string conversion on Windows
Commit aaa1f90[1] dropped support for the `snprinf()` `I` modifier, so
we use the standard `ll` modifier which is suitable for 32bit and 64bit
Windows.  We also replace the deprecated `I64` suffix[2] with the `LL`
suffix.

This fixes ext/pdo_firebird/tests/bug_64037.phpt.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=aaa1f90e3f90c24098fa55a7b868fdca0b89ee25>
[2] <https://docs.microsoft.com/en-us/cpp/cpp/numeric-boolean-and-pointer-literals-cpp?view=vs-2019#integer-literals>
2020-07-12 23:52:22 +02:00
Christoph M. Becker
b6e70e14bd Fix PDO_Firebird tests which assume ERRMODE_SILENT
These have apparently been missed when PR 5388[1] had been merged.

[1] <https://github.com/php/php-src/pull/5388>
2020-07-12 18:15:56 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
George Peter Banyard
db7dc2fa2f Fix [-Wundef] warning in PDO Firebird extension 2020-05-20 16:29:52 +02:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Nikita Popov
169805777c Merge branch 'PHP-7.4'
* PHP-7.4:
  Apply tidy formatting
2020-02-03 13:42:08 +01:00
Nikita Popov
58b17906f5 Apply tidy formatting
Mostly reindent PHP scripts to spaces.
2020-02-03 13:41:31 +01:00
Christoph M. Becker
21eddde3fd Merge branch 'PHP-7.4'
* PHP-7.4:
  Print Client Library Version in phpinfo
2019-11-02 10:19:56 +01:00
Simonov Denis
e84042cc72 Print Client Library Version in phpinfo 2019-11-02 10:19:15 +01: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
Simonov Denis
481f89551e Request #77863: PDO firebird support type Boolean in input parameters 2019-09-10 09:22:26 +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
Christoph M. Becker
e4757ecc80 Re-add common PDO tests to Firebird test suite
These have been inadvertently dropped when changing the test suite to
not require ext/interbase anymore, so we add them back.

We also change the required environment variable names to match the
usual PDO names.  Particularly, we replace `PDO_FIREBIRD_TEST_HOSTNAME`
and `_DATABASE` with the more flexible `PDO_FIREBIRD_TEST_DSN`.
2019-05-04 14:24:15 +02:00
Christoph M. Becker
ae21dc46da Fix memory leak exhibited by bug_aaa.phpt
Since a statement may be executed multiple times, we need to free
already allocated storage for output data before allocating new
storage.
2019-05-04 14:20:11 +02:00
Kalle Sommer Nielsen
1c893b89bd PDO_Firebird test update, round 2
- This renames the environment variables to: PDO_FIREBIRD_TEST_XXX to be in line with other PDO test suites
- Adds an skipif.inc file that skips the tests if no database is set
- The test suite can now be run without PDO_FIREBIRD_TEST_HOSTNAME

$ set PDO_FIREBIRD_TEST_HOSTNAME=localhost
$ set PDO_FIREBIRD_TEST_DATABASE=C:\dev\php.fdb
$ nmake test TESTS=ext/pdo_firebird/tests
2019-05-02 23:19:27 +03:00
Kalle Sommer Nielsen
c9599c1c72 Rewrite PDO_Firebird tests to not depend on ext/interbase
I have no idea how I managed to get this to work, but there is 4 new environment variables that
can be specified for the connection:

- PDO_FIREBIRD_USERNAME
- PDO_FIREBIRD_PASSWORD
- PDO_FIREBIRD_HOSTNAME
- PDO_FIREBIRD_DATABASE

(See testdb.inc for more info)

The only way I could get this to work on my local machine was with a DSN like:

- firebird:dbname=localhost:C:\php.fdb

Hence why the 'hostname' can be specified.

There is also a bit mess in regards to cleanup of this extension tests, but I really do not want to dwell down there, if someone dares to do so, then please be my guest.
2019-05-02 21:48:24 +03:00
Peter Kokot
9df6a1e4dd Add AS_HELP_STRING to *nix build configure options
The Autoconf's default AS_HELP_STRING macro can properly format help
strings [1] so watching out if columns are aligned manually is not
anymore.

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
2019-03-07 20:36:59 +01: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
Peter Kokot
d679f02295 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:33:09 +02:00
Peter Kokot
b746e69887 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:32:30 +02:00
Peter Kokot
782352c54a Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
Gabriel Caruso
9c144e0d82
Trim trailing whitespace in tests 2018-10-14 12:07:20 -03:00
Peter Kokot
37c329d715 Trim trailing whitespace in source code files 2018-10-13 14:17:28 +02:00
Peter Kokot
3362620b5f Trim trailing whitespace in source code files 2018-10-13 14:16:33 +02:00
Peter Kokot
cf3b852109 Trim trailing whitespaces in build files
Some editors utilizing .editorconfig automatically trim whitespaces. For
convenience this patch removes whitespaces in certain build files:
- ext/*/config*.m4
- configure.ac
- acinclude.m4
2018-07-29 03:43:45 +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
Gabriel Caruso
c93aba042f
Give a reason why the test was skipped
This will help us debug why a test was skipped in GCOV
(http://gcov.php.net/viewer.php?version=PHP_HEAD&func=skip), and maybe
put them to run again
2018-07-22 16:41:41 -03:00
Anatol Belski
ed23cea9de Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix event log handling in startup phase
  Fix bug #76488 Memory leak when fetching a BLOB field
2018-07-06 16:08:57 +02:00
Anatol Belski
d85651d58d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix event log handling in startup phase
  Fix bug #76488 Memory leak when fetching a BLOB field
  Fix year
  Bump version
2018-07-06 16:08:17 +02:00