1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 07:58:20 +02:00
Commit Graph

2744 Commits

Author SHA1 Message Date
Adam Saponara b35acd30f2 Fix misleading error message in ZendAccelerator.c.
Currently this error emits something like...

`Error Cannot kill process 12345: Success!`

...due to calling `time` before `strerror` which clears `errno`. This
patch adds an error log immediately after both `kill` calls which gives
us better indication of what exactly failed.
2019-12-02 10:06:32 +01:00
Lucas Martín c0e049656c Fix typo in xmm15 register 2019-12-01 12:28:19 +01:00
Dmitry Stogov f8f48ce8f5 Refactor JIT to reduce back-end dependency from SSA representation.
This commit shouldn't change JIT behavior, but it adds asserts, that may catch wrong-cases occasionally passed before.
2019-11-29 19:07:17 +03:00
Dmitry Stogov 3360d05f30 Don't keep QM_ASSIGN with IS_UNUSED result 2019-11-29 17:43:36 +03:00
Dmitry Stogov b7241adf5e typos 2019-11-28 13:23:17 +03:00
Dmitry Stogov 36175b3c3d Fixed wrong parameteris order 2019-11-27 16:48:01 +03:00
Dmitry Stogov 40ef3196e0 Fixed register allocation 2019-11-27 16:26:43 +03:00
Dmitry Stogov 249e9a63e8 Fixed JIT for LONG->DOUBLE conversion when optimizer disabled 2019-11-27 14:31:24 +03:00
Dmitry Stogov b046a8f7f8 Fixed incorrect JIT compilation 2019-11-26 16:45:19 +03:00
avkarenow 182f98a194 Open opcache.error_log with 'a' flag
When opcache.error_log is set to log to file the read flag is not needed and used.
2019-11-26 09:29:27 +03:00
Tyson Andre f7c44ef2a0 Make opcache infer array_key_exists is non-null bool
array_key_exists now throws a TypeError instead of returning null
for invalid arguments after 14bdb0cfc7
2019-11-20 00:11:51 +03:00
Dmitry Stogov 8bf663d3b2 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix $x = (bool)$x; for undefined with opcache
2019-11-18 11:29:38 +03:00
Dmitry Stogov be6fb13873 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix $x = (bool)$x; for undefined with opcache
2019-11-18 11:27:43 +03:00
Dmitry Stogov e72e3370c6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix $x = (bool)$x; for undefined with opcache
2019-11-18 11:26:30 +03:00
Tyson Andre a2c41c0ea6 Fix $x = (bool)$x; for undefined with opcache
And `$x = !$x`

Noticed while working on GH-4912

The included test would not emit undefined variable errors in php 8.0
with opcache enabled. The command used:

```
php -d zend_extension=opcache.so --no-php-ini -d error_reporting=E_ALL \
    -d opcache.file_cache= -d opcache.enable_cli=1  test.php
```
2019-11-18 11:24:03 +03:00
Nikita Popov bb41a1b7e7 Fix str_pad rc info
This fixes at least part of bug #78811.
2019-11-15 12:37:24 +01:00
Christoph M. Becker 39d04f15f8 Fix ASLR related invalid opline handler issues
Opcache stores `opline->handler`s in shared memory.  These pointers are
invalid, if the main PHP DLL is loaded at another base address due to
ASLR.  We therefore store the address of `execute_ex` in the mmap base
file, and check on startup whether it matches its current address.  If
not, we fall back on the file cache if enabled, and bail out otherwise.

This still does not address cases where the opline handler is located
inside of another DLL (e.g. for some profilers, debuggers), but there
seems to be no general solution for now.

(cherry picked from commit 8ba10b8fbc)
2019-11-15 09:46:58 +01:00
Dmitry Stogov 36afe4e39e Optimize $x === null into is_null($x) 2019-11-12 13:49:55 +03:00
Dmitry Stogov bd45881014 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed wrong constant usage
2019-11-12 13:00:37 +03:00
Dmitry Stogov 49fcbb4810 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed wrong constant usage
2019-11-12 13:00:27 +03:00
Dmitry Stogov 9083e178f6 Fixed wrong constant usage 2019-11-12 12:59:50 +03:00
Dmitry Stogov d94c27dcca Fixed JIT for TYPE_CHECK opcode (exception handling in case of undefined argument) 2019-11-12 10:42:29 +03:00
Máté Kocsis 27e83d0fb8 Add union return types for function stubs 2019-11-11 14:54:55 +01:00
Nikita Popov 999e32b65a Implement union types
According to RFC: https://wiki.php.net/rfc/union_types_v2

The type representation now makes use of both the pointer payload
and the type mask at the same time. Additionall, zend_type_list is
introduced as a new kind of pointer payload, which is used to store
multiple class types. Each of the class types is a tagged pointer,
which may be either a class name or class entry. The latter is only
used for typed properties, while arguments/returns will instead use
cache slots. A type list can contain a mix of both names and CEs at
the same time, as not all classes may be resolvable.

One thing this is missing is support for union types in arginfo
and stubs, which I want to handle separately.

I've also dropped the special object code from the JIT implementation
for now -- I plan to add this back in a different form at a later time.
For now I did not want to include non-trivial JIT changes together
with large functional changes.

Another possible piece of follow-up work is to implement "iterable"
as an internal alias for "array|Traversable". I believe this will
eliminate quite a few special-cases that had to be implemented.

Closes GH-4838.
2019-11-08 15:15:48 +01:00
Nikita Popov ac4e0f0852 Make zend_type a 2-field struct
We now store the pointer payload and the type mask separately. This
is in preparation for union types, where we will be using both at
the same time.

To avoid increasing the size of arginfo structures, the
pass_by_reference and is_variadic fields are now stored as part of
the type_mask (8-bit are reserved for custom use).

Different types of pointer payloads are distinguished based on bits
in the type_mask.
2019-11-08 15:15:48 +01:00
Fabien Villepinte a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00
Máté Kocsis 14bdb0cfc7 Fix consistency issues with array accesses warnings/exceptions
* Change a number of "resource used as offset" notices to warnings,
   which were previously missed.
 * Throw the "resource used as offset" warning for isset() as well.
 * Make array_key_exists() behavior with regard to different key
   types consistent with isset() and normal array accesses. All key
   types now use the usual coercions and array/object keys throw
   TypeError.

Closes GH-4887.
2019-11-06 12:56:47 +01:00
Dmitry Stogov 61ebce1f06 Don't skip RECV instuctions when function uses type hints 2019-11-01 09:33:46 +03:00
Máté Kocsis 9493893412 Cleanup return values when parameter parsing is unsuccessful 2019-10-30 16:05:20 +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
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
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 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
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
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