Commit Graph

1062 Commits

Author SHA1 Message Date
Ilija Tovilo
39459467f6
Attempt to fix pdo_mysql conflict on CircleCI (#12563) 2023-10-30 16:19:27 +01:00
George Peter Banyard
c1fec9bbc3
PDO: Clean-up tests so it's easier to see if they use default test table (#12552) 2023-10-29 23:13:30 +00:00
Ilija Tovilo
f39b5c4c25
Close PHP tags in tests
Closes GH-12422
2023-10-18 17:34:10 +02:00
Ilija Tovilo
34e6e40447
Merge branch 'PHP-8.3'
* PHP-8.3:
  Move ARM build to CircleCI
2023-10-12 13:16:09 +02:00
Ilija Tovilo
b35e0c3069
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Move ARM build to CircleCI
2023-10-12 13:14:52 +02:00
Ilija Tovilo
9c3d3be8bd
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Move ARM build to CircleCI
2023-10-12 13:13:34 +02:00
Ilija Tovilo
4332546bbf
Move ARM build to CircleCI
Closes GH-12415
2023-10-12 13:11:38 +02:00
Peter Kokot
a8e1b1018d Remove unused --with-zlib-dir configure option
Commits that removed this option:
- 34dd032e4e
- a2c21e10b2
- e595f5cd8a

Closes GH-12209
2023-09-14 22:21:54 +02:00
Kamil Tekiela
82934746b7
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
2023-08-04 22:54:30 +01:00
Kamil Tekiela
4db701c049
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
2023-08-04 22:31:18 +01:00
Yurun
ca5d48213a
Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
Closes GH-11551.
2023-08-04 22:25:01 +01:00
Máté Kocsis
c322da0606
Fix misleading pass by reference error message (#10639) 2023-07-18 15:02:38 +02:00
George Peter Banyard
ca8dab3b8a
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
2023-07-17 07:10:16 +01:00
George Peter Banyard
5f716bf2df
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
2023-07-17 07:09:34 +01:00
SakiTakamachi
e0aadc1c0d
Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
This also includes a fix for the MySQL ND driver to actually respect the user decided behaviour.

Closes GH-11622

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-07-17 07:08:45 +01:00
David Carlier
86f6c5637f Merge branch 'PHP-8.2' 2023-03-25 17:41:56 +00:00
David Carlier
3e05059e00 Merge branch 'PHP-8.1' into PHP-8.2 2023-03-25 17:41:45 +00:00
David CARLIER
f6989df8cc ext/pdo_mysql: mysql_handle_closer nullify some freed data.
Close GH-10926
2023-03-25 17:41:21 +00:00
Ilija Tovilo
9d5f2f1343
Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Ilija Tovilo
1e434fbcd8
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Move ARM64 build to Cirrus
2023-03-15 01:37:31 +01:00
Ilija Tovilo
ccca59728e
Move ARM64 build to Cirrus
Travis is very unreliable lately

Closes GH-10795
2023-03-15 01:35:01 +01:00
Ilija Tovilo
3fbdb132c8
[skip ci] Fix misleading xfail message 2023-03-15 00:08:11 +01:00
Ilija Tovilo
ff1e07c10c
Fix mysql tests on Cirrus ASAN
We used localhost instead of 127.0.0.1, so the tests were never actually run.

Closes GH-10802
2023-03-15 00:03:09 +01:00
Máté Kocsis
7936c8085e
Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385) 2023-01-23 10:52:14 +01:00
Marcos Marcolin
cfa23114d3
Remove php_pdo_mysql_sqlstate.h
This file is unused (at least as of PHP 8.0.0); we also remove the
script that could generate it, and the respective info from
CONTRIBUTING.md.

Closes GH-10363.
2023-01-18 19:26:03 +01:00
Kamil Tekiela
da550e7762
MYSQL_ATTR_USE_BUFFERED_QUERY is a bool attribute (#10320) 2023-01-16 13:11:38 +00:00
Tim Düsterhus
03fd405423
Use php_info_print_table_header for actual column headers only (#9485)
Using php_info_print_table_header() for "Foo: bar" looks odd and out of place,
because the whole line is colored. It is also questionable from a HTML
semantics point of view, because it does not described the columns that follow.

The use of this across extensions is inconsistent. It was part of the skeleton,
but ext/date or ext/json already use a regular row.
2022-09-06 08:48:22 +02:00
Christoph M. Becker
12a3066b2c
Fix debug output 2022-06-09 13:42:45 +02:00
Christoph M. Becker
e7a79719cc
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix PDO URI test
2022-05-03 12:44:32 +02:00
Christoph M. Becker
7612ea8121
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix PDO URI test
2022-05-03 12:43:14 +02:00
Michael Voříšek
136ef6f129
Fix PDO URI test
Especially for remote servers, the respective part of the test may fail
for a lot of different reasons; instead of trying to catch all, we
rewrite to not fail, still testing for the contained NUL byte.

Closes GH-8451.
2022-05-03 12:12:41 +02:00
Christoph M. Becker
15233a47b2
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix bug where large bigints may be truncated
2021-12-30 19:11:22 +01:00
Christoph M. Becker
ae9e98640a
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix bug where large bigints may be truncated
2021-12-30 19:10:36 +01:00
Christoph M. Becker
dea548be60
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix #81658: MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in MariaDB
2021-12-05 19:11:32 +01:00
David Carlier
15e7e570a5
Fix #81658: MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in MariaDB
This also introduces the boolean userland constant `MYSQLI_IS_MARIADB`.
2021-12-05 19:11:04 +01:00
Nikita Popov
902d64390e Deprecate implicit dynamic properties
Writing to a proprety that hasn't been declared is deprecated,
unless the class uses the #[AllowDynamicProperties] attribute or
defines __get()/__set().

RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
2021-11-26 14:10:11 +01:00
Nikita Popov
a4da60f4b5 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix leak when persistent PDO connection fails
2021-11-16 16:16:34 +01:00
Nikita Popov
c02aa46126 Fix leak when persistent PDO connection fails
As we don't register the resource, the resource dtor is not called
and will not decrement the refcount.
2021-11-16 16:14:29 +01:00
Nikita Popov
ee510eed68 Deprecate partially supported callables
This deprecates all callables that are accepted by
call_user_func($callable) but not by $callable(). In particular:

    "self::method"
    "parent::method"
    "static::method"
    ["self", "method"]
    ["parent", "method"]
    ["static", "method"]
    ["Foo", "Bar::method"]
    [new Foo, "Bar::method"]

RFC: https://wiki.php.net/rfc/deprecate_partially_supported_callables

Closes GH-7446.
2021-10-22 10:15:24 +02:00
Jeremy Mikola
858d0c0916 Include class name in Serializable deprecation message
The deprecation message was originally introduced in 3e6b447 (#6494).

I first encountered this notice when testing the MongoDB extension
with PHP 8.1, which produced many duplicate messages that provided
no detail about the particular class that needed to be fixed.

Closes GH-7346.
2021-08-11 10:35:47 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Nikita Popov
3acdab864d Fix printf formats in mysql debug logging
Enable printf format verification and fix the reported errors.
2021-06-16 16:09:06 +02:00
Nikita Popov
72f47c0c9d Remove duplicate entries in EXTENSIONS
These would cause failures if the extensions is loaded dynamically.
2021-06-14 14:34:31 +02:00
Nikita Popov
b5a14e6c04 Port skipif.inc files to EXTENSIONS 2021-06-11 16:27:50 +02:00
Nikita Popov
39131219e8
Migrate more SKIPIF -> EXTENSIONS (#7139)
This is a mix of more automated and manual migration. It should remove all applicable extension_loaded() checks outside of skipif.inc files.
2021-06-11 12:58:44 +02:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
Christoph M. Becker
8a8e307cd5
Mark slow tests
Each of these tests took more than ten seconds on a recent AppVeyor CI
run; that appears to qualify them to be marked as slow tests.

Closes GH-7077.
2021-06-03 15:14:08 +02:00
Nikita Popov
ea256a218b Add %0 format to run-tests.php
This format matches against null bytes, and prevents the test
expectation from being interpreted as binary data.

bless_tests.php will automatically replace \0 with %0 as well.
2021-05-29 11:33:13 +02:00
Nikita Popov
b0961f2d04 Remove uses of TRUE/FALSE in mysqli/pdo_mysql
Replace with standard uses of true/false.
2021-05-26 15:07:23 +02:00
Máté Kocsis
4ed66ff2a9
Declare tentative return types for ext/pdo
Closes GH-6996
2021-05-25 19:17:40 +02:00
Nikita Popov
671fd3f25d Fix test expectation for libmysql-only test
This test now correctly displays an error message, yay.
2021-05-17 14:36:40 +02:00
Nikita Popov
ec56650801 PDO MySQL: Check number of bounds params even if none are bound
The check for the number of bound parameters was only executed if
at least one was bound. We should also error if nothing was bound.
With mysqlnd, mysqlnd itself ended up emitting an error, but with
libmysqlclient this error condition would not be detected.
2021-05-17 14:29:47 +02:00
Nikita Popov
7ba0c74312 Fix line endings in test 2021-05-17 14:24:05 +02:00
Nikita Popov
a39edab96e Skip float truncation test under libmysql
We don't return native types for libmysql, so this test doesn't
make sense.
2021-05-17 10:25:52 +02:00
Kamil Tekiela
dbfc9f99d1
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81037 PDO discards error message text from prepared statement

Closes GH-6978.
2021-05-14 12:04:22 +01:00
Kamil Tekiela
574b551567
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81037 PDO discards error message text from prepared statement
2021-05-14 11:59:36 +01:00
Kamil Tekiela
6afbb74194
Fixed bug #81037 PDO discards error message text from prepared statement 2021-05-14 11:54:49 +01: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
Máté Kocsis
7df7867624
Merge branch 'PHP-8.0'
* Fix the signature of PDOStatement::fetchObject()
2021-05-05 16:51:23 +02:00
Máté Kocsis
068c8db276
Fix the signature of PDOStatement::fetchObject()
The ?array $ctorArgs = null parameter is changed to array $constructorArgs = [], and an additional memory leak revealed by the new test case is fixed.

Closes GH-6937

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
2021-05-05 16:48:22 +02:00
Nikita Popov
3e6b447979 Partially deprecate Serializable
If Serializable is implemented, require that __serialize() and
__unserialize() are implemented as well, else issue a deprecation
warning.

Also deprecate use of PDO::FETCH_SERIALIZE.

RFC: https://wiki.php.net/rfc/phase_out_serializable

Closes GH-6494.
2021-04-28 16:55:14 +02:00
matt
25dc931d83 Fixed bug #80908
The last insert ID should be an unsigned integer.

Closes GH-6810.
2021-04-26 11:50:12 +02:00
Nikita Popov
65a5c184d7 Add functions to convert i64/u64 to string
PDO implement half of this, but this functionality is generally
useful. Provide these as zend_u64_to_str and zend_i64_to_str to
complement zend_long_to_str.
2021-04-13 15:43:23 +02:00
Nikita Popov
69018da09b Fix PDO test under libmysqlclient 2021-03-17 11:26:41 +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
32fb9b6fd1 Validate string is numeric for integer PDO attribute value 2021-03-17 00:58:00 +00:00
Dharman
8573eb9e5c Add CLEAN sections to mysqli and PDO mysql tests
Closes GH-6756.
2021-03-15 11:01:12 +01:00
Nikita Popov
3a867b9827 Fixed bug #80808
If the ZEROFILL flag is set for a field, do not convert it into
an integer (text protocol) or convert it explicitly into a padded
string (binary protocol).
2021-03-02 10:59:34 +01:00
Darek Slusarczyk
da011a312a Fix #80329: Add option to specify LOAD DATA LOCAL white list folder
* allow the user to specify a folder where files that can be sent
   via LOAD DATA LOCAL can exist
 * add mysqli.local_infile_directory for mysqli
   (ignored if mysqli.allow_local_infile is enabled)
 * add PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY for pdo_mysql
   (ignored if PDO::MYSQL_ATTR_LOCAL_INFILE is enabled)
 * add related tests
 * fixes for building with libmysql 8.x
 * small improvement in existing tests
 * update php.ini-[development|production] files

Closes GH-6448.

Co-authored-by: Nikita Popov <nikic@php.net>
2021-02-23 09:30:46 +01:00
George Peter Banyard
a78aea8948 Refactor PDO's last inserted ID handler to use and return zend_string
Closes GH-6617
2021-01-19 11:54:25 +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
George Peter Banyard
6728c1bd72 Formalize pdo_dbh_check_liveness_func() return type to zend_result 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
Nikita Popov
7a5cc7aa67 Add basic libmysqlclient CI job
This tests that mysqli and pdo_mysql build against libmysqlclient,
and that tests pass for pdo_mysql. mysqli has too many test failures.

This is not an officially supported configuration.
2020-12-18 12:52:54 +01:00
Nikita Popov
b88a493aaa PDO MySQL: Make test libmysql compatible 2020-12-18 11:28:15 +01:00
Nikita Popov
9718e5987f Merge branch 'PHP-8.0'
* PHP-8.0:
  PDO MySQL: Handle boolean parameter binding with libmysql
2020-12-18 11:02:36 +01:00
Nikita Popov
51f57e7b81 PDO MySQL: Handle boolean parameter binding with libmysql
Previously boolean parameters were simply silently ignored...
2020-12-18 11:01:26 +01:00
Nikita Popov
73533c7dc9 PDO MySQL: Use correct type when setting INT_AND_FLOAT_NATIVE
mysqlnd expects this to be an unsigned int, not a bool.
2020-12-17 18:50:24 +01:00
Nikita Popov
c18b1aea28 PDO MySQL: Use native types for results
Previously, PDO MySQL only fetched data as native int/float if
native prepared statements were used. This patch updates PDO to
have the same behavior for emulated prepared statements, and thus
removes the largest remaining discrepancy between these two modes.

Note that PDO already has a ATTR_STRINGIFY_FETCHES option to control
whether native types are desired or not. The previous output can
be restored by enabling this option.

Most of the tests make use of that option, because this allows the
tests to work under libmysqlclient as well, which currently always
returns string results (independently of whether native or emulated
PS are used).
2020-12-17 10:54:34 +01:00
Nikita Popov
52435f94a3 Merge branch 'PHP-8.0'
* PHP-8.0:
  PDO MySQL: Use mysqlnd column names
2020-12-16 15:18:43 +01:00
Nikita Popov
205d209de9 PDO MySQL: Use mysqlnd column names
mysqlnd already creates interned zend_strings for us, so let's
make use of them.

This also required updating the PDO case changing code to work
with potentially shared strings. For the lowercasing, use the
optimized zend_string_tolower() implementation.
2020-12-16 15:17:13 +01:00
Nikita Popov
cfe2b36a6d Fix ATTR_ORACLE_NULLS with PARAM_ZVAL
PARAM_ZVAL with a STR result should be treated the same way as
PARAM_STR in this regard.
2020-12-15 17:12:46 +01:00
Christoph M. Becker
5263fffdbf Merge branch 'PHP-8.0'
* PHP-8.0:
  Drop pdo_mysql_prepare_load_data.phpt
2020-12-14 18:28:29 +01:00
Christoph M. Becker
15d9c42070 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Drop pdo_mysql_prepare_load_data.phpt
2020-12-14 18:27:53 +01:00
Christoph M. Becker
10c9d615de Drop pdo_mysql_prepare_load_data.phpt
Like the test title and some comments in this test describe, this test
was supposed to have `::prepare()` failing because `LOAD DATA INFILE`
would not be supported as prepared statement, and then the test checks
whether follow-up queries would succeed.  However, `LOAD DATA INFILE`
is supported for prepared statements at least on Windows with mysqlnd,
so the test does no longer test what it is supposed to do.  Therefore,
we drop it.

Closes GH-6509.
2020-12-14 18:26:12 +01:00
Nikita Popov
3c63b26b6d Use zmm for row_c data
This API already doesn't match libmysqlclient, so we may as well
use the zmm.
2020-12-14 13:43:30 +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
154f27a998 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #79132
2020-12-11 16:36:07 +01:00
Nikita Popov
ccb7f1c7d8 Fixed bug #79132
Following cmb's suggestion and replacing the counter with a check
against the bound_params HT, which ensures that both cannot go
out of sync.
2020-12-11 16:35:03 +01:00
Nikita Popov
d5f692296c Merge branch 'PHP-8.0'
* PHP-8.0:
  PDO MySQL: Fix nextRowset() on libmysqlclient with native PS
  PDO MySQL: Don't skip two LOCAL_INFILE tests with libmysqlclient
2020-12-11 14:49:58 +01:00