Commit Graph

53586 Commits

Author SHA1 Message Date
Christoph M. Becker
34defbb784 Accept int parameter in the first place
This is more liberal then before, where that parameter (if given) had
to be IS_LONG, while now it would be converted to int according to weak
typing rules.  This is, however, more what a developer would expect.
2019-11-01 19:15:48 +01:00
Máté Kocsis
f19950fea0 Promote some warnings to exceptions in standard lib
Closes GH-4879.
2019-11-01 17:07:51 +01:00
Christoph M. Becker
4008704f62 zend_parse_parameters_throw() is obsolete
Since `zend_parse_parameters()` throws now, there is no reason to
explicitly call `zend_parse_parameters_throw()` anymore, and since both
have actually the same implementation, we redefine the latter as macro.
2019-11-01 16:47:15 +01:00
Máté Kocsis
2204dbde3b Add missing ZPP checks
Closes GH-4878.
2019-11-01 15:26:52 +01:00
Christoph M. Becker
5dd5f1bc4a Finish OpenSSL arginfo stubs 2019-11-01 15:21:28 +01:00
Fabien Villepinte
8ea2be387e Merge branch 'PHP-7.4' 2019-11-01 12:38:32 +01:00
Fabien Villepinte
a0d58abb79 Fix conflicts between tests with obscure filenames
For non-windows tests
2019-11-01 12:33:36 +01:00
Fabien Villepinte
5955211710 Merge branch 'PHP-7.4' 2019-11-01 12:27:04 +01:00
Fabien Villepinte
5367f36da7 Fix conflicts between tests with obscure filenames 2019-11-01 12:24:38 +01:00
Cameron Porter
07964fc2b5 pdo_oci: Add support for setting and getting the oracle OCI 18c call timeout value. 2019-11-01 10:36:55 +01:00
Dmitry Stogov
61ebce1f06 Don't skip RECV instuctions when function uses type hints 2019-11-01 09:33:46 +03:00
Christoph M. Becker
32d3dbf789 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix test cases for libxml2 2.9.10
2019-10-31 16:10:18 +01:00
Christoph M. Becker
db14b78099 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test cases for libxml2 2.9.10
2019-10-31 16:09:38 +01:00
Christoph M. Becker
e175a0a1c8 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test cases for libxml2 2.9.10
2019-10-31 16:08:38 +01:00
Christoph M. Becker
e29922f054 Fix test cases for libxml2 2.9.10
Since the error reporting has been slightly changed, we have to adapt
the two affected test cases.
2019-10-31 16:07:34 +01:00
Christoph M. Becker
7816df2c57 Elevate warnings to ValueErrors in ext/calendar
All of these warnings/ValueErrors are due to programming errors, i.e.
calling a function with unsupported arguments.
2019-10-31 08:49:15 +01: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
Máté Kocsis
9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +01:00
Máté Kocsis
969e7a3c8b Cleanup return values for Intl when parameter parsing is unsuccessful
Closes GH-4871.
2019-10-30 13:21:40 +01:00
Nikita Popov
5cbe5a538c Don't use chunking for stream writes
We're currently splitting up large writes into 8K size chunks, which
adversely affects I/O performance in some cases. Splitting up writes
doesn't make a lot of sense, as we already must have a backing buffer,
so there is no memory/performance tradeoff to be made here.

This change disables the write chunking at the stream layer, but
retains the current retry loop for partial writes. In particular
network writes will typically only write part of the data for large
writes, so we need to keep the retry loop to preserve backwards
compatibility.

If issues due to this change turn up, chunking should be reintroduced
at lower levels where it is needed to avoid issues for specific streams,
rather than unnecessarily enforcing it for all streams.
2019-10-30 13:03:45 +01:00
Rimvydas Zilinskas
e4593c51ff Add more openssl stubs
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2019-10-30 11:20:48 +01:00
Nikita Popov
9241037837 Merge branch 'PHP-7.4'
* PHP-7.4:
  Optimize creation of empty arrays in json_decode
2019-10-30 11:06:59 +01:00
Tyson Andre
447f07cd28 Optimize creation of empty arrays in json_decode
Use the shared empty array from ZVAL_EMPTY_ARRAY

For code that created an 10 arrays of 100000 empty arrays
(has the same result with `$assoc=true` and `{}`)

- This is the worst-case comparison, but I'd expect 0-length arrays to be fairly
  common in regular data for json_decode
- The parser implementation was using function pointers so that third party
  extension developers could reuse the json parser for their own
  data structures, etc. (I think).

  This PR is meant to let those third party extensions continue working
  without changes.

Before this patch: In 0.126 seconds: added 97.99 MiB
After this patch:  In 0.096 seconds: added 41.99 MiB

```php
<?php
$json = '[' . str_repeat('[],', 100000) . "null]";
$start_memory = memory_get_usage();
$start_time = microtime(true);
$result = [];
for ($i = 0; $i < 10; $i++) {
    $result[] = json_decode($json);
}
$end_memory = memory_get_usage();
$end_time = microtime(true);
// Before this patch: In 0.126 seconds: added 97.99 MiB
// After this patch:  In 0.096 seconds: added 41.99 MiB
printf("In %.3f seconds: added %.2f MiB\n", $end_time - $start_time, ($end_memory - $start_memory)/1000000);

// For objects
$json = '[' . str_repeat('{},', 100000) . "null]";
$start_memory = memory_get_usage();
$start_time = microtime(true);
for ($i = 0; $i < 10; $i++) {
    $result[] = json_decode($json, true);
}
$end_memory = memory_get_usage();
$end_time = microtime(true);
// Before this patch: In 0.126 seconds: added 97.99 MiB
// After this patch:  In 0.096 seconds: added 41.99 MiB
printf("In %.3f seconds: added %.2f MiB (objects decoded as arrays) \n", $end_time - $start_time, ($end_memory - $start_memory)/1000000);
```

Closes GH-4861.
2019-10-30 11:06:46 +01:00
Nikita Popov
93ba3abe63 Warn on strtr(["" => "x"])
Previously:
 * If only ["" => "x"] was present, the original string was returned
   without warning.
 * If both ["" => "x"] and at least one more element was present,
   false was returned without warning.

New behavior:
 * Ignore "" keys in the replacement array (and perform any remaining
   replacement).
 * Throw a warning indicating that an empty string replacement has
   been ignored.

Closes GH-4792.
2019-10-30 10:53:45 +01:00
Nikita Popov
becda2e041 Promote mt_rand() min/max warning to ValueError 2019-10-30 10:36:42 +01:00
Máté Kocsis
ad9ea5abde Add stubs for various standard functions
Closes GH-4851.
2019-10-30 10:34:06 +01:00
Nikita Popov
e0be51d082 Use ArgumentCountError in IntlGregorianCalendar ctor 2019-10-30 10:27:52 +01:00
Tyson Andre
96f361dca0 Update documentation/comment for GH-4860
Fix folding for the new helper method.

Clarify comment in UPGRADING:
The performance on associative arrays would also improve,
as long as no offsets were unset (no gaps).
Packed arrays can have gaps.

Closes GH-4873.
[ci skip]
2019-10-30 10:26:56 +01:00
Máté Kocsis
fee94da127 Add stubs for directory and file functions 2019-10-30 10:10:40 +01:00
Nikita Popov
aef8836110 Don't check $this existence in object opcodes
We are now guaranteed that $this always exists inside methods, as
well as insides closures (if they use $this at all).

This removes checks for $this existence from the individual object
opcodes. Instead ZEND_FETCH_THIS is used in the cases where $this
is not guaranteed to exist, which is mainly the pseudo-main scope.

Closes GH-3822.
2019-10-30 09:30:13 +01:00
Christoph M. Becker
64685782e4 Allow to call XMLReader::open() and ::XML() statically
The implementation of `XMLReader::open()` and `XMLReader::XML()` still
supports calling the methods statically and non-statically.  However,
as of PHP 8.0.0, calling these methods statically is not allowed,
because they are not declared as static methods.  Since we consider it
to be cleaner to call these methods statically, but had deprecated to
call them statically, we properly support both variants.

We implement support for static and non-static calls by overloading, so
that non-static calls have access to the `$this` pointer.
2019-10-29 15:58:32 +01:00
Nikita Popov
817fbe8186 Remove some RETURN_FALSE on exception 2019-10-29 13:36:03 +01:00
Nikita Popov
6719d3e718 Add Z_PARAM_STRING/ARRAY_OR_NULL convenience macros 2019-10-29 13:29:52 +01:00
Nikita Popov
63a20cb400 Don't accept objects for options in password_hash()
This was likely a mixup of zpp modifiers in the original implementation.
Per the RFC only arrays should be accepted here.
2019-10-29 13:20:22 +01:00
Nikita Popov
c43179fb6b Promote base_convert "invalid base" errors to ValueError 2019-10-29 13:12:37 +01:00
Nikita Popov
26327bcd3b Throw "Unsupported operand types" error when using ** on arrays 2019-10-29 13:05:02 +01:00
Nikita Popov
8f20b9969f Expect number argument in round() 2019-10-29 12:50:29 +01:00
Nikita Popov
504f7ffdd6 Small ext/dom cleanups 2019-10-29 11:16:23 +01:00
Christoph M. Becker
22523958f4 Skip test case on non Windows platforms 2019-10-29 10:05:31 +01:00
Nikita Popov
39897eb80b Try to fix asan warning in scalar_constant_defaults.phpt
Doing the SAVE_VALID_OPLINE right before the call, because we
still need r0 before that.
2019-10-29 10:01:35 +01:00
Christoph M. Becker
657f7e898d Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip test case on non Windows platforms
2019-10-29 09:57:27 +01:00
Christoph M. Becker
c5e1a0454f Skip test case on non Windows platforms 2019-10-29 09:53:44 +01:00
Nikita Popov
778a9c05b6 Try to fix 32-bit fprintf test 2019-10-29 09:52:46 +01:00
Christoph M. Becker
3dbb90b07e Fix test cases for master 2019-10-29 09:35:16 +01:00
Christoph M. Becker
6c078d8bd5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Implement #78270: Support __vectorcall convention with FFI
2019-10-29 08:58:17 +01:00
Christoph M. Becker
bedbecf56d Implement #78270: Support __vectorcall convention with FFI
To work around the limitation of the current rudimentary vectorcall
support in our patched libffi, we forbid yet unsupported declarations,
i.e. float/double parameters at certain positions (SIMD vector types
and HVA types are not supported anyway).
2019-10-29 08:57:43 +01:00
Stanislav Malyshev
39bf35ca87 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix libmagic buffer overflow issue (CVE-2019-18218)
  bump version
  set versions for release
2019-10-28 20:47:57 -07:00
Stanislav Malyshev
53b1d76144 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix libmagic buffer overflow issue (CVE-2019-18218)
  bump version
  set versions for release
2019-10-28 20:47:50 -07:00
Stanislav Malyshev
8c2b3b0568 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix libmagic buffer overflow issue (CVE-2019-18218)
  bump version
  set versions for release
2019-10-28 20:47:44 -07:00
Stanislav Malyshev
2bdb13a1f7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix libmagic buffer overflow issue (CVE-2019-18218)
  bump version
  set versions for release
2019-10-28 20:47:30 -07:00
Christoph M. Becker
c2f56d0546 Merge branch 'PHP-7.4'
* PHP-7.4:
  Add support for Interbase 1 dialect
2019-10-28 16:41:16 +01:00
Simonov Denis
3fb42a382c Add support for Interbase 1 dialect 2019-10-28 16:40:51 +01:00
Christoph M. Becker
b897d19552 Add missing zend_parse_parameters_none()
We fix the trivial cases; some others need further discussion, see
<https://news-web.php.net/php.internals/107723>.
2019-10-28 16:18:15 +01:00
Christoph M. Becker
f9a98f6dbd Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78751: Serialising DatePeriod converts DateTimeImmutable
2019-10-28 13:09:44 +01:00
Christoph M. Becker
9e4c5db733 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78751: Serialising DatePeriod converts DateTimeImmutable
2019-10-28 13:09:24 +01:00
Christoph M. Becker
736cd93ef5 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78751: Serialising DatePeriod converts DateTimeImmutable
2019-10-28 13:08:34 +01:00
Christoph M. Becker
89c327f884 Fix #78751: Serialising DatePeriod converts DateTimeImmutable
When getting the properties of a DatePeriod instance we have to retain
the proper classes, and when restoring a DatePeriod instance we have to
cater to DateTimeImmutable instances as well.
2019-10-28 13:07:28 +01:00
Christoph M. Becker
84f2a984d4 Elevate warnings to Error Exceptions in ext/bcmath
`bcdiv()` and `bcmod()` throw DivisionByZeroError if the divisor is 0,
which matches the behavior of the `/` and `%` operators, and `bcsqrt()`
throws ValueError for negative operands.
2019-10-28 12:22:31 +01:00
kharhamel
82dc9a31c3 Convert warnings to Errors in sprintf() functions
Closes GH-4837.
2019-10-28 11:58:59 +01:00
Tyson Andre
9d48bf5152 Fix miscellaneous typos in docs and error messages
Closes GH-4863.
2019-10-28 11:44:08 +01:00
Tyson Andre
e7ff590d0d Optimize array_slice for packed arrays with large offsets
If the offset is 100000, and there are no gaps in the packed/unpacked array,
then advance the pointer once by 100000,
instead of looping and skipping 100000 times.

Add a new test of array_slice handling unset offsets.

Closes GH-4860.
2019-10-28 11:30:59 +01:00
Stanislav Malyshev
469820048d Fix libmagic buffer overflow issue (CVE-2019-18218)
Ported from 46a8443f76
2019-10-27 16:30:38 -07:00
Christoph M. Becker
addc78f379 Revert "Add missing zend_parse_parameters_none()"
This reverts commit ef439ec895.
Test failures need to be resolved first.
2019-10-27 13:41:41 +01:00
Christoph M. Becker
ef439ec895 Add missing zend_parse_parameters_none() 2019-10-27 13:12:45 +01:00
Nikita Popov
0040b2a958 Merge branch 'PHP-7.4'
* PHP-7.4:
  Try one more FD in ext/standard/tests/file/php_fd_wrapper_04.phpt
2019-10-27 09:36:44 +01:00
Nikita Popov
43dc7da8e3 Try one more FD in ext/standard/tests/file/php_fd_wrapper_04.phpt
For some reason FD 120 seems to exist on macos quite often, while
FD 12 did not... Let's try an even larger number, otherwise we
should just drop this test.
2019-10-27 09:35:57 +01:00
Christoph M. Becker
913a449b27 Remove generic type annotations
Cf. <de69a9d3eb (r35675846)>.
2019-10-26 16:24:53 +02:00
Christoph M. Becker
b823864926 Fix and make reflection arginfo stubs more specific 2019-10-26 16:17:02 +02:00
Fabien Villepinte
8a88f72beb Merge branch 'PHP-7.4' 2019-10-26 16:08:00 +02:00
Fabien Villepinte
601aef3468 Replace EXPECTF by EXPECT
In ext/dom all the tests with a EXPECTF section
starting by "Fatal error: Uncaught" have been updated
to use the faster EXPECT
2019-10-26 16:05:02 +02:00
Christoph M. Becker
de69a9d3eb Improve reflection arginfo stubs 2019-10-26 12:32:12 +02:00
Thomas Gerbet
c9fc076a75 Add stubs for ext-reflection 2019-10-26 12:32:12 +02:00
Nikita Popov
e63a44dd03 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #78226: Don't call __set() on uninitialized typed properties
2019-10-25 16:32:14 +02:00
Nikita Popov
f1848a4b3f Fix bug #78226: Don't call __set() on uninitialized typed properties
Assigning to an uninitialized typed property will no longer trigger
a call to __set(). However, calls to __set() are still triggered if
the property is explicitly unset().

This gives us both the behavior people generally expect, and still
allows ORMs to do lazy initialization by unsetting properties.

For PHP 8, we should fine a way to forbid unsetting of declared
properties entirely, and provide a different way to achieve lazy
initialization.
2019-10-25 16:31:45 +02:00
Nikita Popov
7d056fc6c0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78747
2019-10-25 12:53:24 +02:00
Nikita Popov
4d8541debb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78747
2019-10-25 12:50:26 +02:00
Nikita Popov
74699533e5 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78747
2019-10-25 12:50:12 +02:00
Nikita Popov
5249993814 Fixed bug #78747 2019-10-25 12:47:18 +02:00
Nikita Popov
225a02f3d6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Optimize VERIFY_RETURN_TYPE for TMP operands as well
2019-10-25 11:41:41 +02:00
Nikita Popov
6aece7be0a Optimize VERIFY_RETURN_TYPE for TMP operands as well
Only exclude CONST operands, which use a different instruction
format (they have a return operand).
2019-10-25 11:37:19 +02:00
Nikita Popov
711e2a1216 Merge branch 'PHP-7.4'
* PHP-7.4:
  Check class linking in VERIFY_RETURN_TYPE optimization
  Simplify travis setup scripts
2019-10-25 11:25:49 +02:00
Nikita Popov
f07565b0eb Check class linking in VERIFY_RETURN_TYPE optimization
instanceof_function() requires linked classes. I'm not reusing
unlinked_instanceof() here, because it performs class loading,
which wouldn't be right here, I think.
2019-10-25 11:24:32 +02:00
Nikita Popov
c858d17f06 Optimize instanceof_function
Split out the simple equality check into an inline function --
this is one of the common cases.

Replace instanceof_function_ex with zend_class_implements_interface.
There are a few more places where it may be used.
2019-10-25 10:51:17 +02:00
Nikita Popov
1f497b3db7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip IntlTimeZone::getOffset() error tests on non-x86
2019-10-24 15:26:24 +02:00
Nikita Popov
93a9b56c90 Skip IntlTimeZone::getOffset() error tests on non-x86
I'm not totally sure, but I have a strong suspicion that the fact
that this produces an error is an artifact of undefined cast behavior
(which will yield INDVAL on x86 but saturate on ARM). INF seems to
be the only value that results in an error even on x86 (variations
like -INF or NAN succeed).

It might make sense to just remove this test entirely, but for now
let's skip it on non-x86.
2019-10-24 15:26:11 +02:00
Nikita Popov
45deb01cc2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Skip large ftruncate test if large files not supported
  Don't test "blocks" in lstat_stat_variation7.phpt
  Increase FD used in php://fd test
  Use posix_getuid() to check for root in pcntl_setpriority() test
2019-10-24 14:47:15 +02:00
Nikita Popov
edf7346810 Skip large ftruncate test if large files not supported 2019-10-24 14:46:49 +02:00
Nikita Popov
6aa6d70e9d Don't test "blocks" in lstat_stat_variation7.phpt
This stat property seems to be somewhat unreliable depending on the
filesystem. On Travis ARM64 CI a much larger payload is required
to get this value to increase.
2019-10-24 14:46:41 +02:00
Nikita Popov
8fd30aae16 Increase FD used in php://fd test 2019-10-24 14:46:34 +02:00
Nikita Popov
a3469146d4 Use posix_getuid() to check for root in pcntl_setpriority() test
Using SUDO_USER doesn't seem to work on Travis ARM CI -- I guess
that sudo might be in use without the target being root.
2019-10-24 14:46:25 +02:00
Remi Collet
ff09d39328 Merge branch 'PHP-7.4'
* PHP-7.4:
  Added suppot for glob() wildcard matching in ffi.preload directive
  Reverting push to wrong repo
  Update alloc patch
2019-10-24 07:40:27 +02:00
Dmitry Stogov
fea8c5481b Added suppot for glob() wildcard matching in ffi.preload directive 2019-10-24 07:40:07 +02:00
Dmitry Stogov
aacea14359 Merge branch 'PHP-7.4'
* PHP-7.4:
  Ignore ZEND_FFI_TYPE_OWNED flag
2019-10-23 19:54:52 +03:00
Dmitry Stogov
c744531fff Ignore ZEND_FFI_TYPE_OWNED flag 2019-10-23 19:50:58 +03:00
Nikita Popov
62fcb11cbd Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix aarch64 crc32 implementation
2019-10-23 17:42:16 +02:00
Nikita Popov
5f13eff4a2 Fix aarch64 crc32 implementation
RETVAL vs RETURN mixup resulted in the fallback implementation
running as well.
2019-10-23 17:41:59 +02:00
Nikita Popov
ae46df0cb9 JIT: Add option to disable SSA checks 2019-10-23 11:25:13 +02:00
Nikita Popov
fe6c420b02 JIT: Handle typed refs in assign dim 2019-10-23 11:25:10 +02:00
Colin O'Dell
e7335eb420 Allow array_splice() length to be null 2019-10-23 11:22:12 +02:00
Christoph M. Becker
f65d42d56c Merge branch 'PHP-7.4'
* PHP-7.4:
  Added missing call to ZipArchive::close()
2019-10-23 10:47:59 +02:00
Florian Engelhardt
1eae77221e Added missing call to ZipArchive::close() 2019-10-23 10:44:26 +02:00
Nikita Popov
ecc309bfb9 JIT: Fix handling of typed ref in assign dim op 2019-10-23 10:08:25 +02:00
Nikita Popov
2f80fbe3ae JIT: Fix handling of typed ref in assign op 2019-10-23 10:08:09 +02:00
Nikita Popov
8cdbcd7d91 JIT: Check exception after jit_assign_dim_op_helper 2019-10-23 10:07:59 +02:00
Nikita Popov
097184cae7 JIT: UNDEF result on "Illegal offset type" exception 2019-10-23 10:07:48 +02:00
Remi Collet
3d9bbd1b53 Merge branch 'PHP-7.4'
* PHP-7.4:
  add new ffi.preload  option in php.ini and display ini entries in MINFO
2019-10-23 07:49:29 +02:00
Remi Collet
dcd772325d add new ffi.preload option in php.ini and display ini entries in MINFO 2019-10-23 07:49:13 +02:00
Christoph M. Becker
d04297a899 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix typo
2019-10-22 17:54:28 +02:00
Christoph M. Becker
598bf7f5d5 Fix typo 2019-10-22 17:53:34 +02:00
Dmitry Stogov
626a5837c0 Merge branch 'PHP-7.4'
* PHP-7.4:
  Allow loading FFI bindings through ffi.preload directive
2019-10-22 17:53:24 +03:00
Dmitry Stogov
1417352dda Allow loading FFI bindings through ffi.preload directive 2019-10-22 17:52:56 +03:00
Colin O'Dell
e6d3146bdc Accept null lengths for substr functions()
If a null $length is passed to any of these functions, behave as if no
parameter was passed:

 - substr()
 - substr_count()
 - substr_compare()
 - iconv_substr()
2019-10-22 12:09:04 +02:00
Colin O'Dell
8ccd58baca Add Z_PARAM_LONG_OR_NULL macro 2019-10-22 12:09:04 +02:00
Christoph M. Becker
c6cdfa967c Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78716: Function name mangling is wrong for some parameter types
2019-10-22 11:39:40 +02:00
Christoph M. Becker
1c9bfcb6a7 Fix #78716: Function name mangling is wrong for some parameter types
We have to cater to function parameter alignment when calculating the
parameter size.
2019-10-22 11:38:58 +02:00
Nikita Popov
530a8a3854 Fix and undeprecate ReflectionType::__toString()
Add deprecated _ZendTestClass::__toString() method to preserve
an existing test.

ReflectionType::__toString() will now return a complete
representation of the type, as it should have originally. Users
that relied on nullability being absent should have been pushed
to ReflectionNamedType::getName() by the deprecation of
ReflectionType::__toString() in PHP 7.1 / PHP 7.4.
2019-10-22 11:26:02 +02:00
Fabien Villepinte
084d401beb Merge branch 'PHP-7.4' 2019-10-21 21:33:30 +02:00
Fabien Villepinte
7ce85c34ff Revert "Add tests for ReflectionZendExtension"
This reverts commit 4194e0415b.

There were already tests for this class.
2019-10-21 21:31:36 +02:00
Fabien Villepinte
95390972f1 Merge branch 'PHP-7.4' 2019-10-21 21:17:50 +02:00
Fabien Villepinte
4194e0415b Add tests for ReflectionZendExtension 2019-10-21 21:17:16 +02:00
Dmitry Stogov
42f4bdba2a Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78512 (Cannot make preload work)
2019-10-21 14:53:03 +03:00
Dmitry Stogov
05c5e5dfde Fixed bug #78512 (Cannot make preload work) 2019-10-21 14:52:26 +03:00
Christoph M. Becker
f7c61c070f Add ext/sodium arginfo stubs 2019-10-21 10:19:57 +02:00
Joe Watkins
174ab25fd4
Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #78697: inaccurate error message
2019-10-21 09:25:24 +02:00
Joe Watkins
1ac961bea8
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78697: inaccurate error message
2019-10-21 09:24:41 +02:00
Joe Watkins
1c9b62fbd4
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78697: inaccurate error message
2019-10-21 09:23:26 +02:00
Fabien Villepinte
bea2ff88c9
Fix bug #78697: inaccurate error message 2019-10-21 09:22:09 +02:00
Stanislav Malyshev
c797ed5cc7 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78633: Heap buffer overflow (read) in mb_eregi
2019-10-20 23:20:26 -07:00
Stanislav Malyshev
d517c559fc Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78633: Heap buffer overflow (read) in mb_eregi
2019-10-20 23:20:16 -07:00
Christoph M. Becker
4f50d58cab Fix #78633: Heap buffer overflow (read) in mb_eregi
We backport kkos/oniguruma@15c4228aa2.
2019-10-20 22:47:38 -07:00
Fabien Villepinte
08b7279036 Merge branch 'PHP-7.4' 2019-10-19 22:12:18 +02:00
Fabien Villepinte
4b3e041f5b Fix proto of enchant_broker_list_dicts() 2019-10-19 22:11:34 +02:00
Christoph M. Becker
0436bc875e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix miscellaneous typos in docs
2019-10-19 19:20:25 +02:00
Tyson Andre
38f388fba4 Fix miscellaneous typos in docs 2019-10-19 19:19:28 +02:00
Fabien Villepinte
23f3b54906 Merge branch 'PHP-7.4' 2019-10-19 15:44:57 +02:00
Fabien Villepinte
550a2df043 Add tests for DOMEntityReference 2019-10-19 15:42:16 +02:00
Christoph M. Becker
284e993791 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78684: PCRE bug72463_2 test is sending emails on Linux
2019-10-19 12:59:59 +02:00
Christoph M. Becker
26635ed71a Fix #78684: PCRE bug72463_2 test is sending emails on Linux
This test is not supposed to run on non Windows systems; otherwise it
would try to send an email.
2019-10-19 12:59:32 +02:00
Christoph M. Becker
b00cc3378c Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78694: Appending to a variant array causes segfault
2019-10-19 11:52:38 +02:00
Christoph M. Becker
ee6a71ca73 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78694: Appending to a variant array causes segfault
2019-10-19 11:51:05 +02:00
Christoph M. Becker
ce035dc4a0 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78694: Appending to a variant array causes segfault
2019-10-19 11:49:18 +02:00
Christoph M. Becker
45a7723267 Fix #78694: Appending to a variant array causes segfault
`write_dimension` object handlers have to be able to handle `NULL`
`offset`s; for now we simply throw an exception instead of following
the `NULL` pointer.
2019-10-19 11:47:00 +02:00
Nikita Popov
49327e2e15 Merge branch 'PHP-7.4'
* PHP-7.4:
  Improve exif tag name fetching
  Implement a cache for exif tag name lookups
  Limit the amount of errors generated during exif parsing
2019-10-18 16:55:46 +02:00
Nikita Popov
650115c827 Improve exif tag name fetching 2019-10-18 16:55:05 +02:00
Nikita Popov
56e3e6f135 Implement a cache for exif tag name lookups 2019-10-18 16:54:56 +02:00
Nikita Popov
e5324a2484 Limit the amount of errors generated during exif parsing
Emitting errors is fairly expensive, to the point that parsing
a file with a huge number of invalid tags can take seconds.
Generating ten thousand errors is unlikely to help anybody, but
constitutes a potential DOS vector.
2019-10-18 16:54:49 +02:00
Christoph M. Becker
43a1363a05 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix test case
2019-10-18 16:24:14 +02:00
Christoph M. Becker
81806db90b Fix test case
Cf. <https://github.com/php/php-src/pull/4687>.
2019-10-18 16:23:56 +02:00
Christoph M. Becker
2484f1e88a Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #70153 \DateInterval incorrectly unserialized
2019-10-18 15:33:58 +02:00
Christoph M. Becker
197568d634 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #70153 \DateInterval incorrectly unserialized
2019-10-18 15:33:25 +02:00
Christoph M. Becker
c7c7ab53ac Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #70153 \DateInterval incorrectly unserialized
2019-10-18 15:32:08 +02:00
m.yakunin
d2cde0bfd3 Fix #70153 \DateInterval incorrectly unserialized
Added a separate macro for reading 'days' property, so that bool(false)
is correctly converted to the proper internal representation.
2019-10-18 15:31:14 +02:00
Christoph M. Becker
ecc9588d0c Properly handle non resources passed to socket_select()
As of PHP 8.0.0, failing `zend_fetch_resource_ex()` throws a TypeError,
so we cannot simply skip non resources in the `$read`, `$write` and
`$except` arrays.  Instead we bail out.  Since these arrays are already
checked in `php_sock_array_to_fd_set()`, we remove the additional check
in `php_sock_array_from_fd_set()`.
2019-10-18 14:16:25 +02:00
Christoph M. Becker
04d5086578 Merge branch 'PHP-7.4'
* PHP-7.4:
  Update array access syntax deprecated
2019-10-17 23:40:30 +02:00
Alex Porto dos Santos
a6a2d167d8 Update array access syntax deprecated
Update array access syntax deprecated in line 175 and 204
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/alex/php/hello/ext_skel.php on line 175
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/alex/php/hello/ext_skel.php on line 204
2019-10-17 23:39:55 +02:00
Dmitry Stogov
605e0de357 Clenup "smart branch" handling 2019-10-18 00:11:30 +03:00
Dmitry Stogov
65c4cc231d Fixed wrong shift 2019-10-17 23:31:47 +03:00
Nikita Popov
e80934d747 Pass cache slot when printing type errors
Instead of using a separate ce.
2019-10-17 17:06:48 +02:00
Dmitry Stogov
3df64af965 Relay on DO_ICALL/DO_UCALL opcode to avoid generation of useless code 2019-10-17 12:55:36 +03:00
Dmitry Stogov
3a88c5b87a Fixed exception handling 2019-10-16 22:38:01 +03:00
Fabien Villepinte
86c33b8ddd Merge branch 'PHP-7.4' 2019-10-16 20:53:52 +02:00
Fabien Villepinte
8b160f530c Change port to avoid collision with others tests
The 64321 port is already used with the ext/openssl tests.
2019-10-16 20:50:54 +02:00
Dmitry Stogov
5431837a6c Clenup "smart branch" handling 2019-10-16 12:28:30 +03:00
Dmitry Stogov
51da02375a Fixed exception handling 2019-10-16 02:36:06 +03:00
Dmitry Stogov
902b00e68e Fixed exception source 2019-10-16 01:26:35 +03:00
Derick Rethans
087d8cd214 Merge branch 'PHP-7.4' 2019-10-15 21:01:05 +01:00
Derick Rethans
3f7cc8361c Merge branch 'PHP-7.3' into PHP-7.4 2019-10-15 21:00:57 +01:00
Derick Rethans
3725a446ba Import timelib version 2018.03 2019-10-15 21:00:39 +01:00
Fabien Villepinte
3d22c80fc2 Test an error case with DOMDocument::createEntityReference 2019-10-15 21:56:44 +02:00
Sara Golemon
b8bf8a4372 Merge branch 'PHP-7.4'
* PHP-7.4:
  Silence undefined index warning when openssl not available.
2019-10-15 15:38:24 -04:00
Sara Golemon
15d7cd9e18
Silence undefined index warning when openssl not available. 2019-10-15 15:37:56 -04:00
Christoph M. Becker
6ff5316c7f Merge branch 'PHP-7.4'
* PHP-7.4:
  Prevent parallel testing conflicts
2019-10-15 16:30:07 +02:00
Christoph M. Becker
8e06504e94 Prevent parallel testing conflicts
disk_free_space_basic.phpt already uses this directory, so we rename
it.
2019-10-15 16:29:46 +02:00
Christoph M. Becker
273731fb76 Add Zend class/interface arginfo stubs
We also change `Generator::throw()` to expect a `Throwable` in the
first place, and we now throw a TypeError instead of returning `false`
from `Exception::getTraceAsString()`.
2019-10-15 16:21:00 +02:00
Dmitry Stogov
0d55456d73 Use "const" qualifier 2019-10-15 11:06:11 +03:00
Dmitry Stogov
cef1960ce7 Use "const" qualifier 2019-10-14 21:49:08 +03:00
Dmitry Stogov
5213612359 Fixed compilation warning 2019-10-14 21:47:46 +03:00
Dmitry Stogov
2958fecb8b Fixed incorrect JIT compilation 2019-10-14 21:32:10 +03:00
Joe Watkins
f8e3970ff0
Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix checksum calculation for opcache
2019-10-14 16:50:56 +02:00
Joe Watkins
042e3b227e
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix checksum calculation for opcache
2019-10-14 16:50:23 +02:00
Joe Watkins
22ac57b064
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix checksum calculation for opcache
2019-10-14 16:49:48 +02:00
Mitch Hagstrand
e2a6bf482f
Fix checksum calculation for opcache 2019-10-14 16:46:42 +02:00
Nikita Popov
4e563e6c95 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix handling of overflowing invalid octal in tokenizer
2019-10-14 16:37:27 +02:00
Nikita Popov
641f9615cc Fix handling of overflowing invalid octal in tokenizer
If token_get_all() is used, we still need to correctly distinguish
LNUMBER vs DNUMBER here for backwards compatibility.
2019-10-14 16:36:27 +02:00
Dmitry Stogov
3f50922aee Fixed incorrect JIT compilation 2019-10-14 16:45:58 +03:00
Dmitry Stogov
4273865bba Drop checkpoint that leaded to use after free 2019-10-14 13:37:22 +03:00
Dmitry Stogov
5197d0cd5e Reduced number of CFG pass iterations 2019-10-14 11:37:10 +03:00
Fabien Villepinte
6daa54d3be Fix grammar in skipif messages 2019-10-12 23:18:56 +02:00
Christoph M. Becker
77bd1ce60d Just return after exception has been thrown 2019-10-12 23:09:23 +02:00
Thomas Gerbet
428bd3d908 Add stubs for ext-sockets 2019-10-12 17:08:24 +02:00
Christoph M. Becker
cc8739cfb9 Fix potentially borked test case
If interface 'lo' is not available, `socket_set_option()` may warn,
which would cause the test to be marked as borked.  Thus we silence the
function call.
2019-10-12 16:48:45 +02:00
Christoph M. Becker
52f0610b74 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix test case
2019-10-12 16:29:42 +02:00
Christoph M. Becker
f6bd5dcbe9 Fix test case
`MSG_EOR` and `MSG_EOF` are not necessarily defined, in which case the
test would fail.
2019-10-12 16:28:57 +02:00
Christoph M. Becker
642f80636e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix potential heap corruption
2019-10-12 16:16:44 +02:00
Christoph M. Becker
c10d3d3a35 Fix potential heap corruption
`tmp` is allocated by `malloc()`, so we must not `LocalFree()` it.
2019-10-12 16:16:14 +02:00
Christoph M. Becker
993463a65e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78665: Multicasting may leak memory
2019-10-12 14:46:36 +02:00
Christoph M. Becker
586f8515d5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78665: Multicasting may leak memory
2019-10-12 14:46:10 +02:00