Commit graph

89 commits

Author SHA1 Message Date
Christoph M. Becker
72d9d9b88f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug79177.phpt wrt. JIT
2020-10-30 15:49:48 +01:00
Christoph M. Becker
0427dcb913 Fix bug79177.phpt wrt. JIT
JIT ignores that the `zend_write` callback is overwritten, so we define
our own callback and caller.

We also fix the "inconsistent DLL binding" warnings on Windows, by
introducing `PHP_ZEND_TEST_API`.

Closes GH-6391.
2020-10-30 15:47:18 +01:00
Christoph M. Becker
d07f6753a0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79177: FFI doesn't handle well PHP exceptions within callback
2020-10-28 13:49:23 +01:00
Christoph M. Becker
f547412cba Fix #79177: FFI doesn't handle well PHP exceptions within callback
We have to error on unhandled exceptions in FFI callbacks, to avoid
passing back undefined values.

This has been discussed and agreed upon in a previous PR[1].

[1] <https://github.com/php/php-src/pull/5120>

Closes GH-6366.
2020-10-28 13:34:56 +01:00
Nikita Popov
623bf39e9c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80186
2020-10-09 17:02:20 +02:00
Nikita Popov
15443f8af4 Fixed bug #80186
Early exit in FE_RESET if get_properties() returns empty array,
as we cannot add HT iterators to zend_empty_array.
2020-10-09 16:56:08 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03: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
Fabien Villepinte
0c6d06ecfa Replace EXPECTF when possible
Closes GH-5779
2020-06-29 21:31:44 +02:00
Christoph M. Becker
aca621cf92 Fix #79749: Converting FFI instances to bool fails
Casting objects to bool is supposed to yield `true`.  Since the
`cast_object` handler is required now, we have to implement the
`_IS_BOOL` conversion there.
2020-06-29 16:02:58 +02:00
Nikita Popov
0374cf08c7 Add --file-cache-prime/use options to run-tests
--file-cache-prime populates the file cache,
--file-cache-use uses the file cache.

And fix a number of tests to run under file cache or disabled
timestamp validation.
2020-05-20 15:29:32 +02:00
Rod Elias
682e2f6c20 Trim trailing whitespaces and fix code style
Closes GH-5554.
2020-05-12 17:00:11 +02:00
Christoph M. Becker
125682f13a Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip test on big-endian architectures
2020-05-12 13:33:06 +02:00
Christoph M. Becker
8623a85cb9 Skip test on big-endian architectures
Due to the memory layout on BE architectures, the address would be
`0x2a00000000` instead of `0x2a` on little-endian architectures.
2020-05-12 13:31:53 +02:00
Christoph M. Becker
43eca196e7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79571: FFI: var_dumping unions may segfault
2020-05-11 16:25:30 +02:00
Christoph M. Becker
d5300873c5 Fix #79571: FFI: var_dumping unions may segfault
We must not attempt to access arbitrary union members when retrieving
debug info, because that may not be valid.  Therefore we do no longer
dereference pointer types inside of unions, but report their address as
string in `%p` format instead.
2020-05-11 16:24:46 +02:00
Christoph M. Becker
38ecfe0245 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79532: sizeof off_t can be wrong
2020-04-29 10:43:35 +02:00
Christoph M. Becker
67f9b0b754 Fix #79532: sizeof off_t can be wrong
We have to actually determine the proper `SIZEOF_OFF_T`.
Interestingly, it is `4` on Windows x64.

We also have to prevent the redefinition in pg_config.h.  The clean
solution would likely be to not include pg_config.h at all, but that's
out of scope for BC reasons for now.
2020-04-29 10:40:59 +02:00
Nikita Popov
e15409b43c Adjust zend_write_func signature
Make it return size_t instead of int, to line up with actual
implementation.
2020-04-15 11:01:12 +02:00
Dmitry Stogov
ed1ad33ba4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79472: ext/ffi/tests/040.phpt TC fails on Big endian arch
2020-04-14 20:38:42 +03:00
Christoph M. Becker
8c5faf7ad1 Fix #79472: ext/ffi/tests/040.phpt TC fails on Big endian arch
For now we are choosing the simplest solution, namely to skip the test
on big-endian architectures.
2020-04-14 20:31:31 +03:00
Christoph M. Becker
ddf38fd764 Merge branch 'PHP-7.4'
* PHP-7.4:
  Improve FFI test suite for Windows
2020-03-18 17:01:30 +01:00
Christoph M. Becker
280485adc1 Improve FFI test suite for Windows
We add Windows support to four existing test cases, extract some useful
utility functions, and use them to simplify further test cases.

We also remove the Windows specific code from preload.inc, since
preloading isn't supported on Windows anyway.
2020-03-18 16:53:06 +01:00
Dmitry Stogov
10726588b1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Export FFI::__BIGGEST_ALIGNMENT__
2020-03-12 11:45:05 +03:00
Dmitry Stogov
fee614f66b Export FFI::__BIGGEST_ALIGNMENT__ 2020-03-12 11:43:01 +03:00
Dmitry Stogov
c774ca8d80 Merge branch 'PHP-7.4'
* PHP-7.4:
  Allow to fetch function address
2020-03-12 11:41:12 +03:00
Dmitry Stogov
c45552e32b Export FFI::__BIGGEST_ALIGNMENT__ 2020-03-11 15:29:58 +03:00
Dmitry Stogov
e902e4acd9 Allow to fetch function address 2020-03-11 15:13:27 +03:00
Máté Kocsis
960318ed95
Change argument error message format
Closes GH-5211
2020-02-26 15:00:08 +01:00
Máté Kocsis
ac0853eb26
Make type error messages more consistent
Closes GH-5092
2020-02-17 14:22:17 +01:00
Dmitry Stogov
53fc8ef41d Merge branch 'PHP-7.4'
* PHP-7.4:
  Disable instantiation of zero size FFI\CData objects
  Fix # 79171: heap-buffer-overflow in phar_extract_file
  Fix bug #79082 - Files added to tar with Phar::buildFromIterator have all-access permissions
  Fix bug #79221 - Null Pointer Dereference in PHP Session Upload Progress
2020-02-17 12:54:11 +03:00
Dmitry Stogov
54ecf57fe2 Disable instantiation of zero size FFI\CData objects 2020-02-17 12:48:55 +03:00
Nikita Popov
f8d795820e Reindent phpt files 2020-02-03 22:52:20 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Christoph M. Becker
127d6f3f39 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79096: FFI Struct Segfault
2020-01-14 16:47:24 +01:00
Christoph M. Becker
05f3cd23ed Fix #79096: FFI Struct Segfault
We must not assume that the size of a function's return value is at
most `sizeof(ffi_arg)`, but rather have to use the size which already
has been determined for the return type if it is larger than
`sizeof(ffi_arg)`.

To be able to have a regression test, we export the required test
function from the zend-test extension, and make sure that the test
can be run on different platforms regardless of whether zend-tests was
built statically or dynamically.
2020-01-14 16:46:58 +01:00
Nikita Popov
9b6c0bdcd6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove support for preloading on Windows
2020-01-06 22:42:31 +01:00
Nikita Popov
59c3ddab13 Remove support for preloading on Windows
Due to ASLR restrictions, preloading on Windows does not work with
any code that has preloading dependencies on internal classes.
This effectively makes it unusable for any non-trivial codebase.

Instead of pretending like preloading is going to work, only to
make people realize that it really doesn't once they get beyond
a dummy example, we disable support for preloading on Windows
entirely.

Closes GH-4999.
2020-01-06 22:41:55 +01:00
Christoph M. Becker
3fafa19777 Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip test for clang builds
2019-12-27 15:11:51 +01:00
Christoph M. Becker
58cc66e175 Skip test for clang builds
On Windows, clang builds don't use __vectorcall, so executing this test
does not make sense.
2019-12-27 15:09:19 +01:00
Christoph M. Becker
2804ea6127 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix test case for Windows
2019-11-11 12:56:55 +01:00
Christoph M. Becker
ce047e6091 Fix test case for Windows 2019-11-11 12:49:32 +01:00
Dmitry Stogov
6e9dd13d63 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78714 (funcs returning pointer can't use call convention spec)
2019-11-11 12:09:47 +03:00
Dmitry Stogov
ecd0c5b6ad Fixed bug #78714 (funcs returning pointer can't use call convention spec) 2019-11-11 12:07:48 +03:00
Christoph M. Becker
fe13066403 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78761: Zend memory heap corruption with preload and casting
2019-10-30 19:50:22 +01:00
Christoph M. Becker
0055f1e3dc Fix #78761: Zend memory heap corruption with preload and casting
We have to reset `FFI_G(persistent)` back to zero when preloading has
finished.
2019-10-30 19:49:39 +01:00
Christoph M. Becker
9b817264eb Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78762: Failing FFI::cast() may leak memory
2019-10-30 17:22:56 +01:00
Christoph M. Becker
1e2d3d58a8 Fix #78762: Failing FFI::cast() may leak memory
We have to release objects when we're done with them.
2019-10-30 17:21:58 +01:00
Christoph M. Becker
22523958f4 Skip test case on non Windows platforms 2019-10-29 10:05:31 +01:00