Commit graph

1439 commits

Author SHA1 Message Date
Gina Peter Banyard
b4e272c56a
ext/pdo: Fix various PDORow bugs
- Add tests
- NULL derefencing in read_dimension handler
- Fix isset()
- Fix empty() with column numbers as offsets
- Refactoring to use common functions
2024-02-27 15:30:23 +00:00
Peter Kokot
218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00
SakiTakamachi
b333164423 Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
Partial backport of GH-12793.

Closes GH-12970.
2023-12-22 15:06:01 +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
Ilija Tovilo
ef4f08832c
Revert "Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs"
This reverts commit d7ab0ff0c8.
2023-07-04 09:11:14 +02:00
Máté Kocsis
d7ab0ff0c8
Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs 2023-07-03 08:32:58 +02:00
Stanislav Malyshev
32b6eacbc6 Merge branch 'PHP-8.1' into PHP-8.2 2022-12-18 23:21:25 -07:00
Stanislav Malyshev
a6a80eefe0 Improve fix for bug #81740 2022-12-18 23:20:29 -07:00
Florian Sowade
56c121cea2 Initialize run time cache in PDO methods (#9818)
Without the memset the memory was uninitialized and the new test segfaulted when accessing the memory in _zend_observe_fcall_begin().
2022-10-26 12:21:41 +02:00
Bob Weinand
9be00e3935 Ensure driver specific PDO methods have a proper run_time_cache 2022-10-11 00:53:19 +02:00
Máté Kocsis
e4f2376919
Improve string class constant code generation (#9577)
Using strlen() will make sure that non-constant values can also be used.
2022-09-26 23:12:34 +02:00
Bob Weinand
a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand
94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis
10a27bc47b
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix pdo_oci tests for PHP 8.1
2022-08-24 14:40:01 +02:00
Michael Voříšek
2db2cab6ad
Fix pdo_oci tests for PHP 8.1
Closes GH-9051
2022-08-24 14:39:45 +02:00
Máté Kocsis
ae95644f36
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix pdo_oci tests for PHP 8.0
2022-08-22 09:29:32 +02:00
Máté Kocsis
3e0f144b2c
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix pdo_oci tests for PHP 8.0
2022-08-22 09:28:29 +02:00
Michael Voříšek
305892580e
Fix pdo_oci tests for PHP 8.0 2022-08-22 09:25:43 +02:00
Bob Weinand
dc5475c191 Save previous observer on the VM stack
This avoids a possible significant performance penalty, when some leaf function was observed, deep in the stack.
As a side effect, we are not iterating over prev_execute_data anymore and thus, non-observed fake frames, possibly on stack, cannot have any impact on the observer anymore (especially within zend_observer_fcall_end_all).

Saving the previous observer happens now directly on the VM stack. If there is any observer, function frames are allocated an extra zval (the last temporary), which will, on observed frames, contain the previous observed frame address.
2022-08-04 17:16:27 +02:00
Bob Weinand
625f164963 Include internal functions in the observer API
There are two main motivations to this:
a) The logic for handling internal and userland observation can be unified.
b) Unwinding of observed functions on a bailout does notably not include observers. Even if users of observers were to ensure such handling themselves, it would be impossible to retain the relative ordering - either the user has to unwind all internal observed frames before the automatic unwinding (zend_observer_fcall_end_all) or afterwards, but not properly interleaved.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-07-30 19:20:55 +02:00
Máté Kocsis
dd00296722
Declare ext/pdo constants in stubs (#9078) 2022-07-22 09:46:47 +02:00
Remi Collet
55a88f36b6
add SensitiveParameter as known string and use it in arginfo 2022-07-18 11:43:33 +02:00
Tim Düsterhus
342e18f105
Support the actual #[\SensitiveParameter] attribute in stubs (#8836) 2022-07-12 12:43:44 +02:00
Pierrick Charron
1bcd8d394a
Update gen_stub to support #if around classes 2022-06-13 16:34:12 -04:00
Pierrick Charron
6fd2b39397
Indent with TAB in .h files generated by gen_stub 2022-06-13 08:55:54 -04:00
Tim Düsterhus
6906d1fc8d Mark parameter in ext/pdo as sensitive 2022-06-13 11:09:12 +02:00
Christoph M. Becker
e86acb1861
Run POD_Firebird tests on AppVeyor CI
We also fix gh8626.phpt for the firebird driver by allowing negative
status codes as well.  We mark the other two test cases as xfail for
the firebird driver for now.

Closes GH-8666.
2022-06-10 12:22:44 +02:00
Christoph M. Becker
c451a9bddc
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix recently broken test case
2022-06-08 18:34:25 +02:00
Christoph M. Becker
f768f3d60b
Fix recently broken test case
This test was written to always use the sqlite PDO driver; however,
that driver may no longer be available[1], and actually the test is
supposed to work for all drivers – otherwise it should be placed in
ext/pdo_sqlite/tests.

[1] <938049b927>

Closes GH-8732.
2022-06-08 18:33:55 +02:00
George Peter Banyard
306f8d282d Merge branch 'PHP-8.1' 2022-06-08 11:38:16 +01:00
George Peter Banyard
938049b927 PDO Common tests should not require a driver 2022-06-08 11:37:07 +01:00
David Carlier
271b723915 Merge branch 'PHP-8.1' 2022-06-03 15:15:46 +01:00
David Carlier
4a1c50b9be Merge branch 'PHP-8.0' into PHP-8.1 2022-06-03 15:15:30 +01:00
Yurun
bfe63f565f Fix dblib ghtest8626 test.
Follow-up of GH-8628.
Closes GH-9694.
2022-06-03 15:12:09 +01:00
David Carlier
59503c0518 Merge branch 'PHP-8.1' 2022-06-02 17:36:02 +01:00
David Carlier
0f428ae240 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-02 17:35:45 +01:00
Yurun
df52903ee0 Closes GH-8626: Fix PDOStatement->execute() failed.
Then execute successfully, errorInfo() information is incorrect
2022-06-02 17:32:43 +01:00
Máté Kocsis
84cd2a9047
Add some stub related todo comments 2022-05-25 13:24:11 +02:00
Levi Morrison
282655083e
Fix some minor warnings (#8568)
* Fix php_apache_get_version prototype

Avoids an error with -Werror=strict-prototypes when building the
Apache SAPI.

* Fix -Werror=stringop-truncation in pdo_raise_impl_error

* Note pdo_error_type BC break
2022-05-18 08:30:59 -06:00
Máté Kocsis
e127f3ff8f
Merge branch 'PHP-8.1'
* PHP-8.1:
  Redefine PDOException::$code with correct type
2022-01-01 17:55:33 +01:00
Máté Kocsis
96a5026bfd
Redefine PDOException::$code with correct type
Closes GH-7839
2022-01-01 17:54:59 +01:00
Christoph M. Becker
9c6b843ff0
Merge branch 'PHP-8.1'
* PHP-8.1:
  Skip bug_36798.phpt for PDO_DBLIB
2021-12-07 20:26:19 +01:00
Christoph M. Becker
7d4fdf1510
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Skip bug_36798.phpt for PDO_DBLIB
2021-12-07 20:25:35 +01:00
Christoph M. Becker
efb901ebed
Skip bug_36798.phpt for PDO_DBLIB
For some reason, this test fails now with "Incorrect syntax near ''.
[SELECT '�' as test FROM test WHERE id = '1']", so we skip it.
2021-12-07 20:24:15 +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
hassan
888bec1be3
Merge duplicate identical conditions in PDO (#7638) 2021-11-10 12:21:04 +00: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