Commit graph

377 commits

Author SHA1 Message Date
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
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
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
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
Nikita Popov
ff19ec2df3 Introduce InternalIterator
Userland classes that implement Traversable must do so either
through Iterator or IteratorAggregate. The same requirement does
not exist for internal classes: They can implement the internal
get_iterator mechanism, without exposing either the Iterator or
IteratorAggregate APIs. This makes them usable in get_iterator(),
but incompatible with any Iterator based APIs.

A lot of internal classes do this, because exposing the userland
APIs is simply a lot of work. This patch alleviates this issue by
providing a generic InternalIterator class, which acts as an
adapater between get_iterator and Iterator, and can be easily
used by many internal classes. At the same time, we extend the
requirement that Traversable implies Iterator or IteratorAggregate
to internal classes as well.

Closes GH-5216.
2020-06-24 15:31:41 +02:00
George Peter Banyard
7c33644fed Fix [-Wextra-tokens] warning in MySQLi extension which breaks build
Didn't double check and this slipped through with my big search and replace
2020-05-18 01:00:47 +02:00
George Peter Banyard
82afcf4401 Fix [-Wundef] warning in MySQLi extension 2020-05-18 00:37:19 +02:00
Máté Kocsis
3ebce8e9fc
Fix UNKNOWN default values in various extensions
Closes GH-5514
2020-05-05 19:08:20 +02:00
Nikita Popov
8597ec00d4 Remove support for libmysqlclient 5.0
Closes GH-5391.
2020-04-23 10:38:20 +02:00
Máté Kocsis
928b25cd6e
Generate function entries from stubs for mysqli
Closes GH-5420
2020-04-19 21:56:47 +02:00
Máté Kocsis
01b266aac4
Improve error messages of various extensions
Closes GH-5278
2020-03-23 18:59:04 +01:00
Máté Kocsis
5bf6aedae4
Promote mysqli warnings to exceptions
Closes GH-5058
2020-01-30 17:05:07 +01:00
Máté Kocsis
cffff1fb03
Merge branch 'PHP-7.4'
* Fix #78666 mysqli_options generates Warning on var_dump()
2020-01-28 18:51:00 +01:00
Máté Kocsis
d39edebbce
Fix #78666 mysqli_options generates Warning on var_dump()
Closes GH-5121
2020-01-28 18:44:02 +01:00
Máté Kocsis
1b93cfee0c
Use RETURN_THROWS() after zend_parse_method_parameters() 2020-01-02 23:01:37 +01:00
Máté Kocsis
01a50778d1
Use RETURN_THROWS() after zend_throw_exception() in most of the extensions 2020-01-02 10:56:18 +01:00
Máté Kocsis
349a286461
Use RETURN_THROWS() after zend_throw_error() 2020-01-01 16:42:30 +01:00
Máté Kocsis
345703724c
Use RETURN_THROWS() during ZPP in most of the extensions
Except for some bigger ones: reflection, sodium, spl
2019-12-31 11:46:11 +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
Derick Rethans
5bc7e4e6f4 Merge branch 'PHP-7.4' 2019-06-21 16:52:29 +01:00
Derick Rethans
579562176b Fixed bug #67348: Reading $dbc->stat modifies $dbc->affected_rows 2019-06-21 16:51:52 +01:00
Nikita Popov
4c401914f8 ctor_params of mysqli_fetch_object should use "a" 2019-06-17 11:46:23 +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
Nikita Popov
ca8e2abb8e Merge branch 'PHP-7.4' 2019-02-28 12:56:00 +01:00
Nikita Popov
7be0e06b48 Remove mysqli embedded server support
This code is not compatible with PHP 7.0. The fact that nobody
complained that the mysqli embedded server functionality doesn't
build anymore seems like a strong signal that we can drop it...
2019-02-28 12:55:16 +01:00
Darek Slusarczyk
5c23370648 Merge branch 'PHP-7.4' 2019-02-11 18:50:45 +01:00
Darek Slusarczyk
9eacd9174c Merge branch 'PHP-7.3' into PHP-7.4 2019-02-11 18:47:58 +01:00
Darek Slusarczyk
6f7a47db5d Merge branch 'PHP-7.2' into PHP-7.3 2019-02-11 18:18:57 +01:00
Darek Slusarczyk
83d2bc9b6d Merge branch 'PHP-7.1' into PHP-7.2 2019-02-11 18:08:21 +01:00