1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00
Commit Graph

118877 Commits

Author SHA1 Message Date
Dmitry Stogov 1d98bd41e5 Fixed incorrect type inference 2020-05-28 17:10:05 +03:00
Christoph M. Becker 6b769a3dc6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix PVS-Studio integration
2020-05-28 15:35:47 +02:00
Christoph M. Becker 8068fad481 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix PVS-Studio integration
2020-05-28 15:34:09 +02:00
Christoph M. Becker 744f9016c4 Fix PVS-Studio integration
Without this configuration option, PVS-Studio looks for preprocessed
files (*.i), but these do not exists.
2020-05-28 15:23:37 +02:00
David Carlier 6dca024a09 Build fix for newer versions of NetBSD.
its libutil contains newer conflicting apis as estrdup, emalloc.

Closes GH-5635
2020-05-28 14:31:04 +02:00
Nikita Popov 70b2aa7fb8 Ensure Exception::getFile/getLine return type is correct
These return an untyped protected property, so we can't rely on
the type being correct.

Also add return types to the interface -- normally this would be
a no-go, but Throwable is a special interface that can only
be implemented internally, so we control all implementations.
2020-05-28 14:19:47 +02:00
Nicolas Grekas d579e1809a Run Symfony tests in per-component 2020-05-28 14:08:27 +02:00
Nicolas Grekas ef9a790f12 Re-enable Symfony test on PHP 8 2020-05-28 14:08:25 +02:00
Nikita Popov 5716fa7f49 Make Exception::$previous a typed property
Exception::$previous is a private property, so we can add a type:

    private ?Throwable $previous = null;
2020-05-28 14:01:29 +02:00
Nikita Popov aaae77f7f1 Make Exception::$trace typed array property
This is a private property, so we are allowed to add a type.
The new declaration of the property is:

    private array $trace = [];

This ensures that Exception::getTrace() does indeed return an array.

Userland code that was modifying the property through refleciton
may have to be adjusted to assign an array (instead of null,
for example).

Closes GH-5636.
2020-05-28 13:55:38 +02:00
Dmitry Stogov c16dbed0c4 Avoid recording of uninitialized types.
VM doesn't set Z_TYPE() for IS_VAR when passes class_entry reference.
2020-05-28 14:39:41 +03:00
Máté Kocsis 58cb0e4732 Add some mixed parameter types and fix UNKNOWN default values in ext/xmlrpc 2020-05-28 12:41:48 +02:00
Nikita Popov 01e86d6d70 Extract code for declaring Exception/Error properties 2020-05-28 12:15:16 +02:00
Nikita Popov 55dd3945fb Convert Exception::getMessage() result to string
We specify that the return type of Exception::getMessage() is a
string. However, we don't currently ensure this, because
Exception::$message is a protected member that can be set to any
type. Fix this by performing an explicit type-cast.

This also requires a temporary refcount increment in the __toString()
object handler, because there is no additional owner of the object,
and it may get released prematurely as part of the __toString() call.
2020-05-28 11:51:35 +02:00
Dmitry Stogov efbe96166d Split "opcache.jit_max_recursion_unroll" into "opcache.jit_max_recursive_calls" and "opcache.jit_max_recursive_returns".
It's possible to disable recording of "recursive return loops" setting opcache.jit_max_recursive_returns to 0.
2020-05-28 12:28:05 +03:00
Nicolas Grekas caca664871 Fix func info for sodium_crypto_aead_xchacha20poly1305_ietf_decrypt 2020-05-28 10:44:26 +02:00
Nikita Popov b53f83c0c3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Use automatic port assignment in socket_import/export test
2020-05-28 10:20:12 +02:00
Nikita Popov 490ca05883 Use automatic port assignment in socket_import/export test 2020-05-28 10:18:59 +02:00
Dmitry Stogov 501a2e86e8 Add a side exit on enter to function if it may be called with different number of arguments. 2020-05-28 01:22:32 +03:00
Dmitry Stogov bd329a6019 Keep information about SEND_UNPACK/SEND_ARRAY in call_info 2020-05-27 22:15:14 +03:00
Dmitry Stogov d2d5738b32 Fixed tracing JIT support for ZEND_RETURN_BY_REF in CALL VM 2020-05-27 18:04:16 +03:00
Dmitry Stogov 0bf2bfcf8d Fixed tracing JIT for CALL VM 2020-05-27 17:05:06 +03:00
Dmitry Stogov 645ff9c8f6 Revert "Fixed tracing JIT for CALL VM"
This reverts commit 7f3a296f84.
2020-05-27 17:04:31 +03:00
Remi Collet 17649648ed always build json statically 2020-05-27 15:36:07 +02:00
Tyson Andre cc27781f40 [RFC] Always enable JSON support in php 8.0
Currently, it's possible to disable the json extension with
`./configure --disable-json` (for historical reasons that no longer apply).
However, JSON is widely used in many use cases - web sites, logging output,
and as a data format that can be used to share data with many applications
and programming languages,
so I'd personally find it useful if it was always enabled.

Examples of where this would be useful:

- For internal classes to be able to implement `JsonSerializable`
  which currently requires a hard dependency on the JSON extension.
- For PHP users to publish single-file scripts that use json_encode and
  json_decode and don't require polyfills or less readable var_export output.
  (polyfills are less efficient and may have issues with recursive data
  structures)
- So that php-src's own modules, tools and test cases can start using JSON
  if it's a good choice for encoding a value. (same for PECLs)

https://wiki.php.net/rfc/jsond mentions that in PHP 5,

> The current Json Parser in the json extension does not have a free license
> which is a problem for many Linux distros.
> This has been referenced at Bug #63520.
> That results in not packaging json extension in the many Linux distributions.

Starting in php 7.0 with the switch to jsond,
It looks like licensing is no longer an issue.

Changes:

- Remove all flags related to JSON such as `configure --disable-json`
- Require that JSON be compiled statically instead of as a shared library

Examples of uses of JSON in various distros
(backwards incompatible changes such as changing packaging are typically
reserved for major versions, and 8.0 is a major version)

- JSON is required by `php-cli` or `php` in ubuntu:
  https://packages.ubuntu.com/focal/php/
- The php-json package has to be installed separately
  from the PHP binary in Fedora repos.

Closes GH-5495
2020-05-27 09:08:43 -04:00
Dmitry Stogov 7f3a296f84 Fixed tracing JIT for CALL VM 2020-05-27 15:59:29 +03:00
Christoph M. Becker c5cf0af8a9 Mark several phpdbg tests as xfail
Apparently, breakpoints and watchpoints are practically disabled if
run with OPcache JIT under Windows, so we mark the affected tests as
xfail in that case for the time being.
2020-05-27 11:39:15 +02:00
Nikita Popov 0221b8b2ab Add support for * width and precision in printf()
If * is used for width/precision in printf, then the width/precision
is provided by a printf argument instead of being part of the format
string. Semantics generally match those of printf in C.

This can be used to easily reproduce PHP's float printing behavior:

    // Locale-sensitive using precision ini setting.
    // Used prior to PHP 8.0.
    sprintf("%.*G", (int) ini_get('precision'), $float);

    // Locale-insensitive using precision ini setting.
    // Used since to PHP 8.0.
    sprintf("%.*H", (int) ini_get('precision'), $float);

    // Locale-insensitive using serialize_precision ini setting.
    // Used in serialize(), json_encode() etc.
    sprintf("%.*H", (int) ini_get('serialize_precision'), $float);

Closes GH-5432.
2020-05-27 10:42:25 +02:00
Dmitry Stogov 2423288f0f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed possible usage of uninitialized value
2020-05-27 11:27:34 +03:00
Dmitry Stogov 886a34b1cc Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed possible usage of uninitialized value
2020-05-27 11:26:25 +03:00
Dmitry Stogov 1f521a0b23 Fixed possible usage of uninitialized value 2020-05-27 11:25:18 +03:00
Nikita Popov b6000b7e0e Add support for %h and %H in printf()
These are locale-independent variants of %g and %G.

Closes GH-5436.
2020-05-27 10:19:23 +02:00
Nikita Popov a01b6e5787 Return empty array instead of null from enchant APIs
Closes GH-5566.
2020-05-27 10:12:21 +02:00
Dmitry Stogov f91283fcd4 Fixed JIT for ext/opcache/tests/bool_not_cv.phpt with opcache.jit=1202 2020-05-27 10:57:33 +03:00
Alex Dowad 0bff4e56e2 Tweak style and grammar in proc_open.c 2020-05-27 09:05:31 +02:00
Alex Dowad dff7994ff4 Avoid compiler warnings in proc_open.c
We are getting a lot of compiler warnings when building on Appveyor CI (Windows).
Fix some of them.

Closes GH-5629
2020-05-27 09:05:14 +02:00
Dmitry Stogov 6e5247275a Fixed JIT for ext/opcache/tests/jit/cmp_004.phpt with opcache.jit=1201 2020-05-27 09:59:12 +03:00
Dmitry Stogov d2f811438e Set proper jit_extension for inherited methods 2020-05-27 09:58:03 +03:00
Máté Kocsis 0de3ca4f98 Let's try to fix the JIT compiler warning 2020-05-26 20:56:29 +02:00
Máté Kocsis fbe30592d6 Improve type error messages when an object is given
From now on, we always display the given object's type instead of just reporting "object".
Additionally, make the format of return type errors match the format of argument errors.

Closes GH-5625
2020-05-26 19:06:19 +02:00
Christoph M. Becker 38c85efe83 Fix picky builds
Due to `-Werror=maybe-uninitialized` a bogus warning may be thrown, so
we initialize the variable to work-around that.
2020-05-26 18:37:29 +02:00
Christoph M. Becker d2508ef947 Merge branch 'PHP-7.4'
* PHP-7.4:
  Enable phpdbg tests on AppVeyor
  Make phpdbg test portable
  Fix several mostly Windows related phpdbg bugs
  Fix #73926: phpdbg will not accept input on restart execution
2020-05-26 17:46:56 +02:00
Christoph M. Becker 9fad9addb5 Enable phpdbg tests on AppVeyor 2020-05-26 17:45:35 +02:00
Christoph M. Becker 9d5dafe040 Make phpdbg test portable 2020-05-26 17:45:35 +02:00
Christoph M. Becker 8483a21f29 Fix several mostly Windows related phpdbg bugs
* Properly initialize PHPDBG_G(watch_tmp)

  Otherwise that may cause segfaults in ZTS builds.

* Deactivate potentially remaining watchpoints after REPL

  Otherwise the memory could still be protected, resulting in segfaults
  during shutdown.

* NULL zend_handlers_table after freeing

  As of commit 4130fe4[1], the `zend_handlers_table` is explicitly
  freed in the `zend_vm_dtor()`.  Since phpdbg (and maybe some other
  SAPIs) may restart the engine afterwards, we have to make sure that
  the table is also NULLed.

* Only set context option if there is a context

  In other words, we must not follow the null pointer.

* Cater to file handles without attached console

  File handles do not necessarily have an attached console (for
  instance, pipes do not), in which case `GetConsoleScreenBufferInfo()`
  fails.  In this case we set a default value (`40`) for lines like on
  other systems.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=4130fe437a5db7ead1444d3748bd0fbad9829cb2>
2020-05-26 17:45:25 +02:00
Christoph M. Becker e483761a1e Fix #73926: phpdbg will not accept input on restart execution
We are more liberal, and accept Windows line endings (CRLF) as well.
2020-05-26 17:44:39 +02:00
Christoph M. Becker 31e410e098 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79595: zend_init_fpu() alters FPU precision
2020-05-26 17:21:29 +02:00
Christoph M. Becker 879004dae3 Fix #79595: zend_init_fpu() alters FPU precision
On startup, PHP deliberately changes the floating point control word to
enforce binary64 format for the calculations for best consistency
across platforms.  However, this is unnessary for x86_64 architectures,
because in this case SSE instructions are used by default, and there is
no good reason to pass `-mfpmath=i387` or such.

Therefore, we can skip the modification, which has the benefit that
system libraries are free to work in the mode of their liking.
2020-05-26 17:19:54 +02:00
Dmitry Stogov 15aa891c5e Fixed JIT for integer overflow checks 2020-05-26 17:59:15 +03:00
Nikita Popov baa285881f Fix variable type
This is no longer a boolean.
2020-05-26 15:58:36 +02:00