1
0
mirror of https://github.com/php/php-src.git synced 2026-04-02 13:43:02 +02:00
Commit Graph

118856 Commits

Author SHA1 Message Date
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
Tyson Andre
9b33272536 Allow generators to have a real return type of mixed or object
Fixes an edge case overlooked in
https://github.com/php/php-src/pull/5313

Generators are objects, so `object` should have also been allowed in addition to
`iterable` and `Traversable`

Closes GH-5626
2020-05-26 09:57:10 -04:00
Derick Rethans
446525cb87 Merge branch 'PHP-7.4' 2020-05-26 14:20:24 +01:00
Derick Rethans
c6fc400e8b Add (expected) release date, and new header for 7.4.8 2020-05-26 14:20:06 +01:00
Derick Rethans
46d88a49cc This bug fix was cherry picked into 7.4.6 2020-05-26 14:19:13 +01:00
Max Semenik
23ee4d4b57 Support catching exceptions without capturing them to variables
RFC: https://wiki.php.net/rfc/non-capturing_catches

Closes GH-5345.
2020-05-26 15:12:18 +02:00
Nikita Popov
1203bbf07e Merge branch 'PHP-7.4'
* PHP-7.4:
  Respect typed references in catch assignment
2020-05-26 15:03:26 +02:00
Nikita Popov
4a08ca1294 Respect typed references in catch assignment
I decided to null out EG(exception) early here, which means only
the exception from the dtor / ref assign is preserved, and the
previous exception is not chained in. This is more robust, and
I don't think this situation is common enough to be bothered about
the precise behavior.
2020-05-26 14:59:40 +02:00
Nikita Popov
2daa89b1e6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix zend_assign_to_typed_ref() implementation
2020-05-26 14:44:09 +02:00
Nikita Popov
314ab47e55 Fix zend_assign_to_typed_ref() implementation
There was some confusion going on here regarding the original
value vs the copied value.

I've dropped the needs_copy variable, because this code is not
inlined, so it would always be true anyway.

What we need to do is perform a move-assignment of the copied
value (in which case we don't care about performing the assignment
before destroying garbage), and destroying the original value
for the VAR/TMP cases. This is a bit complicated by the fact that
references are passed in via a separate ref variable, so we can't
just ptr_dtor the original variable.
2020-05-26 14:42:27 +02:00
Dmitry Stogov
59e69eb1c9 Fixed JIT for (LONG_MIN % -1) 2020-05-26 14:49:29 +03:00
Derick Rethans
ac2dd9d5e8 Merge branch 'PHP-7.4' 2020-05-26 11:47:43 +01:00
Derick Rethans
fb370ecbe5 Fixed historical dates in NEWS 2020-05-26 11:47:26 +01:00
Nikita Popov
81c824f41f Clarify ZEND_CATCH code
UNDEF the opcode result instead of addref'ing the exception.
2020-05-26 11:34:07 +02:00
Max Semenik
f825c0bb88 Improve language in error messages
Closes GH-5617
2020-05-26 11:27:07 +02:00
Christoph M. Becker
2261234720 Merge branch 'PHP-7.4'
* PHP-7.4:
  7.3.20 will be next
2020-05-26 10:58:45 +02:00
Christoph M. Becker
ee36478a03 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  7.3.20 will be next
2020-05-26 10:56:28 +02:00
Christoph M. Becker
c249f593ef 7.3.20 will be next 2020-05-26 10:53:22 +02:00
Dmitry Stogov
cf3b133a86 Fixed JIT for SEND_VAR $undefined_cv 2020-05-26 10:13:57 +03:00
Nikita Popov
ca358001b9 Revert "Fixed JIT for SEND_VAR $undefined_cv"
This reverts commit d60988257b.

This change causes segfaults in many tests.
2020-05-25 23:51:11 +02:00
Dmitry Stogov
0386cbb95c Fixed tracing JIT for RETRUN $undefined_cv 2020-05-25 22:19:13 +03:00
David Carlier
e8ba8908a9 proc_open FreeBSD build fix
On this platform the needed header is different.

Closes GH-5623
2020-05-25 18:38:38 +02:00