Commit graph

403 commits

Author SHA1 Message Date
Máté Kocsis
debd38f851 Add support for sensitive parameters in stubs 2022-06-04 18:15:05 +02:00
Kamil Tekiela
01cbe390ca Remove mysqli_driver::$reconnect property 2022-05-30 15:28:08 +01:00
Kamil Tekiela
21ca8c43a8 The INI mysqli.reconnect directive has been removed. 2022-05-30 15:28:08 +01:00
Kamil Tekiela
d84dfa3292 Remove MYSQLI_USE_MYSQLND constant and all the code with it 2022-05-30 15:28:08 +01:00
Christoph M. Becker
dad214c370
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8068: mysqli_fetch_object creates inaccessible properties
2022-03-14 14:30:06 +01:00
Christoph M. Becker
aef65393be
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8068: mysqli_fetch_object creates inaccessible properties
2022-03-14 14:29:30 +01:00
Christoph M. Becker
ef29ddcc27
Fix GH-8068: mysqli_fetch_object creates inaccessible properties
When fetching into objects, we need to create object style hash tables,
i.e. where numeric column names are stored as string keys instead of
integer keys.  Instead of the slightly more efficient alternative to
create the desired hash table in the first place, we go for the more
readable implementation and convert the array style hash table using
`zend_symtable_to_proptable()`.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>

Closes GH-8189.
2022-03-14 14:27:04 +01:00
Kamil Tekiela
50c7512f52
mysqli_result::__construct should throw exceptions (#7855) 2021-12-30 14:08:12 +00: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
Dmitry Stogov
90b7bde615 Use more compact representation for packed arrays.
- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
  instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
  familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
  (ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
  (packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
  ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
    - sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
    - zend_hash_sort_ex() may require converting packed arrays to hash.
2021-11-03 15:18:26 +03:00
Kamil Tekiela
c9d509b668
Revert "Fix bug GH-1 (mysqli_sql_exception->sqlstate is inaccessible)"
This reverts commit 64fca5c5f0.
2021-10-21 19:01:01 +01:00
Kamil Tekiela
64fca5c5f0
Fix bug GH-1 (mysqli_sql_exception->sqlstate is inaccessible) 2021-10-21 18:51:16 +01:00
Nikita Popov
a01d7390b8 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed bug #81494
2021-10-08 15:02:41 +02:00
Nikita Popov
d001682ac4 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed bug #81494
2021-10-08 15:02:29 +02:00
Nikita Popov
df940a6dc3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81494
2021-10-08 15:00:51 +02:00
Nikita Popov
fcabe693ba Fixed bug #81494
Use the proper error reporting mechanism rather than throwing a
warning. This requires something of a hack because we don't have
direct access to the connection object at this point.
2021-10-08 15:00:10 +02:00
Kamil Tekiela
5c13587aad
Remove php_mysqli_persistent_helper_once (#7507) 2021-09-22 18:58:51 +01:00
Kamil Tekiela
cd0cd3d31e
Fix typos (#7327) 2021-08-01 18:03:30 +01: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
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
Nikita Popov
d905e77483 Enforce types when writing to mysqli dynamic properties
Previously this just assumed that the value was of a certain type.

I'm doing this in a generic way that checks against the declared
property type -- the handler function can then assume the value
to be of the correct type.
2021-04-13 15:30:56 +02:00
Kamil Tekiela
b7a298b20c
Deprecate unused mysqli constants (#6850)
Deprecated:
MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED
MYSQLI_SERVER_QUERY_NO_INDEX_USED
MYSQLI_SERVER_QUERY_WAS_SLOW
MYSQLI_SERVER_PS_OUT_PARAMS
MYSQLI_DATA_TRUNCATED
MYSQLI_NO_DATA
2021-04-13 00:11:54 +01:00
Dharman
5e1056edb6 Change the default error mode of mysqli
Make MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT the new mysqli
error reporting default. Explicitly call
mysqli_report(MYSQLI_REPORT_OFF) to preserve previous behavior.

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

Closes GH-6629.
2021-03-15 14:55:31 +01:00
Dharman
475ea62dd7 Remove unused mysqli global
And fix formatting issues.
2021-03-15 10:33:03 +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
Máté Kocsis
cad66533f0
Generate class entries from stubs for ldap, libxml, mbstring and mysqli
Closes GH-6684
2021-02-16 14:46:19 +01:00
Darek Slusarczyk
ed24f0f201 Fix #80330: Replace language in APIs and source code/docs
Rename MYSQLI_REFRESH_SLAVE to MYSQLI_REFRESH_REPLICA in line with
upstream change in MySQL. The old name is retained for
backwards-compatibility reasons, and may be deprecated/removed in
the future.

Closes GH-6632.
2021-01-25 10:10:47 +01: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
Nikita Popov
362c29241d Remove mysqlnd_extension enum
ext/mysql is no longer supported, drop handling for it from
mysqlnd.
2020-12-15 10:55:53 +01:00
Nikita Popov
141eb346b0 Remove MYSQLND_STRING_TO_INT_CONVERSION define
This has been unconditionally enabled for a long time already
(the actual conversion is behind an additional runtime flag).
2020-12-14 12:03:43 +01:00
Nikita Popov
518eb0ca2b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed error reporting in mysqli_stmt::__construct
2020-11-25 16:29:00 +01:00
Dharman
233f507fe6 Fixed error reporting in mysqli_stmt::__construct
For the sake of simplicity, I've synchronized the implementation
with PHP 8, which means null values are also accepted.

Closes GH-6454.
2020-11-25 16:27:41 +01:00
Dharman
114613dc5f Remove embedded property from mysqli_driver
All other leftovers of this feature have been dropped in PHP 8,
so we should remove the property as well.

Closes GH-6407.
2020-11-09 11:00:16 +01:00
Máté Kocsis
d5f92baad0 Fix default value handling of mysqli_fetch_object()
Make [] acceptable both for classes without constructors and
classes with a constructor that takes no arguments.

Closes GH-6336.
2020-10-20 16:48:12 +02:00
Máté Kocsis
41b096b392
Promote a few forgotten warnings to exceptions
Closes GH-6211
2020-09-25 12:08:15 +02:00
Nikita Popov
64547664cb Assert that all switch cases are covered 2020-09-18 14:53:02 +02:00
Nikita Popov
a03c1ed7aa Remove vestiges of embedded mysql from tests 2020-09-17 19:02:20 +02:00
Nikita Popov
5cb8b04646 Drop support for libmysqlclient < 5.5
Given how little maintenance the libmysqlclient driver sees, be
more aggressive in dropping old version support here.
2020-09-17 12:05:30 +02:00
Nikita Popov
3ad57f9f31 Merge branch 'PHP-7.4'
* PHP-7.4:
  pdo_mysql/mysqli (native) libmysqlclient_r no-longer used
  mysql: native mysql-8.0 uses _Bool
  mysqli: use native api
2020-09-17 11:35:03 +02:00
Nikita Popov
d591e1c4f5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  pdo_mysql/mysqli (native) libmysqlclient_r no-longer used
  mysql: native mysql-8.0 uses _Bool
  mysqli: use native api
2020-09-17 11:32:01 +02:00
Daniel Black
c9abb0c0ac mysql: native mysql-8.0 uses _Bool
MySQL-8.0 removes option MYSQLI_OPT_SSL_VERIFY_SERVER_CERT
2020-09-17 11:27:31 +02:00
George Peter Banyard
7a95e943d6 Promote warnings to Error in MySQLi extension
Closes GH-5803
2020-09-15 19:12:02 +02:00
Nikita Popov
179bc21f5f Use normal zpp in mysqli_result::__construct()
This method doesn't need any special handling...
2020-08-14 11:15:36 +02:00
Nikita Popov
6570fc2cf8 Remove dummy aliases for mysqli constructors
These are only available as methods. Directly declare them as
such instead of aliasing to functions that don't actually exist.
2020-08-14 11:12:41 +02:00
Nikita Popov
f5e6f9bd27 Avoid fatal error on not found class in mysqli_fetch_object()
Instead use C zpp modifier and throw TypeError.
2020-08-13 16:13:02 +02:00
Nikita Popov
d92229d8c7 Implement named parameters
From an engine perspective, named parameters mainly add three
concepts:

 * The SEND_* opcodes now accept a CONST op2, which is the
   argument name. For now, it is looked up by linear scan and
   runtime cached.
 * This may leave UNDEF arguments on the stack. To avoid having
   to deal with them in other places, a CHECK_UNDEF_ARGS opcode
   is used to either replace them with defaults, or error.
 * For variadic functions, EX(extra_named_params) are collected
   and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS.

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

Closes GH-5357.
2020-07-31 15:53:36 +02:00
Máté Kocsis
d30cd7d7e7
Review the usage of apostrophes in error messages
Closes GH-5590
2020-07-10 21:05:28 +02:00
Nikita Popov
302933daea Remove no_separation flag 2020-07-07 09:30:24 +02:00
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00