Commit Graph

113590 Commits

Author SHA1 Message Date
Simonov Denis
e84042cc72 Print Client Library Version in phpinfo 2019-11-02 10:19:15 +01:00
Nikita Popov
4c717abad2 Explicitly specify ubuntu versions on azure pipelines
Use the new 18.04 for the ones where the build succeeded and the
previous 16.04 where it didn't.
2019-11-02 10:12:58 +01:00
Nikita Popov
944c1cf034 Fixed bug #78768
Remove the typedef from zend_types.h, use explicit struct prefix
instead.
2019-11-01 17:04:15 +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
5367f36da7 Fix conflicts between tests with obscure filenames 2019-11-01 12:24:38 +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
Nikita Popov
edccf32f7f Remove configure checks for supported instruction sets
These were checking whether the instruction set is supported by
the host CPU, however they were only used to condition on whether
this instruction set is targeted at all. It would still use dynamic
dispatch (e.g. based on ifunc resolvers) to select the actual
implementation. Whether the target is guaranteed to support the
instruction set without dispatch is determined based on pre-defined
macros like __SSE2__.

This removes the configure-time builtin cpu checks to remove
confusion. Additionally this allows targeting an architecture that
is newer than the host architecture.
2019-10-31 11:27:53 +01:00
Nikita Popov
333d607d47 Fix bug #77930: Remove mmap limit
First, the limitation already doesn't trigger if you copy the whole
file (i.e. use copy() or stream_copy_to_stream() and don't specify
a length). This happens because length will be 0 at the time of the
check and only later calculated based on the file size. This means
that we're already completely blowing the length limit for what is
likely the most common case, and it doesn't seem like anyone complained
about that.

Second, the premise of the code comment ("to avoid runaway swapping")
seems incorrect to me. Because this performs a file-backed non-private
mmap, no swap backing is needed for the mapping. Concerns over "memory
usage" are also misplaced, as this is a virtual mapping.
2019-10-31 09:37:05 +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
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
Nikita Popov
c76dbefe05 Add UPGRADING note for stream_read() change
Ref bug #78575.

[ci skip]
2019-10-30 11:31:43 +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
7816275244 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing refcount increment
2019-10-30 09:23:06 +01:00
Nikita Popov
d3237b5504 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Add missing refcount increment
2019-10-30 09:22:51 +01:00
Nikita Popov
5f6eaf355c Add missing refcount increment 2019-10-30 09:22:20 +01:00
Nikita Popov
4f1d5380e2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78689
2019-10-29 15:07:28 +01:00
Nikita Popov
33dd25d21c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78689
2019-10-29 15:06:52 +01:00
Nikita Popov
f9895b4bf5 Fixed bug #78689 2019-10-29 15:06:16 +01:00
Christoph M. Becker
22523958f4 Skip test case on non Windows platforms 2019-10-29 10:05:31 +01:00
Derick Rethans
365a45210b Update NEWS for 7.4.0RC6 2019-10-29 08:50:32 +00:00
Derick Rethans
6d8168f1d1 Update NEWS for PHP 7.4.0RC5 2019-10-29 08:49:13 +00: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
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
Simonov Denis
3fb42a382c Add support for Interbase 1 dialect 2019-10-28 16:40:51 +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
ZiMuyang
99c84cd92a Remove redundant variable rv and optimize code
Closes GH-4864.
2019-10-28 11:42:45 +01:00
Nikita Popov
1ddda13d84 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78752
2019-10-28 10:28:14 +01:00
Nikita Popov
b61b60d15b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78752
2019-10-28 10:28:04 +01:00
Nikita Popov
16c4910876 Fix bug #78752
NULL out the execute_data before destroying it, otherwise GC may
trigger while the execute_data is partially destroyed, resulting
in double-frees.

The handling of call stack unfreezing is a bit awkward because it's
a ZEND_API function, so we can't change the signature.
2019-10-28 10:27:32 +01:00
Stanislav Malyshev
469820048d Fix libmagic buffer overflow issue (CVE-2019-18218)
Ported from 46a8443f76
2019-10-27 16:30:38 -07: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
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
Nikita Popov
bd379df48c Add ARM64 CI to Travis
We need to install a number of additional packages that are installed
by default on the AMD64 workers.

We also have to manually set up the MySQL user.

For now we don't set up Postgres -- if anyone wants to figure that
out, it would be great ;)

Log redirections in compile.sh are removed, because /dev/stdout is
not accessible. We don't see to use this anyway.
2019-10-25 16:37:46 +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
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
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
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
a8b4e40fa2 Simplify travis setup scripts
Reduce duplication.
2019-10-25 11:15:27 +02:00
Nikita Popov
184ba0c91c Remove recursive check from instanceof_interface
Parent interfaces are copied into the interface list during
inheritance, so there's no need to perform a recursive check.

Only exception are instanceof checks performed during inheritance
itself. However, we already have unlinked_instanceof for this
purpose, it just needs to be taught to handle this case.

Closes GH-4857.
2019-10-25 10:19:42 +02:00
Nikita Popov
c63a0e005a Optimize instanceof_class/interface
instanceof_class does not need to check for a NULL pointer in the
first iteration -- passing NULL to this function is illegal.

instanceof_interface does not need to use instanceof_class(), it
only has to check whether the CEs match exactly. There is no way
for an interface to appear inside "parent", it will always be in
"interfaces" only.
2019-10-24 17:47:35 +02:00
Nikita Popov
435f269108 Clean up and clarify instanceof_function_ex()
The instanceof_interface_only() function was dead code (always
returned zero).

Clarify that the last parameter indicates whether the passed CE
is interface or class and rewrite the code in terms of assertions.
2019-10-24 17:40:25 +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