1
0
mirror of https://github.com/php/php-src.git synced 2026-04-26 09:28:21 +02:00
Commit Graph

3813 Commits

Author SHA1 Message Date
Dusk 13c430b1db Add array_is_list(array $array) function
This function tests if an array contains only sequential integer keys. While
list isn't an official type, this usage is consistent with the community usage
of "list" as an annotation type, cf.
https://psalm.dev/docs/annotating_code/type_syntax/array_types/#lists

Rebased and modified version of #4886

- Use .stub.php files
- Add opcache constant evaluation when argument is a constant
- Change from is_list(mixed $value) to array_is_list(array $array)

RFC: https://wiki.php.net/rfc/is_list

Co-Authored-By: Tyson Andre <tysonandre775@hotmail.com>
Co-Authored-By: Dusk <dusk@woofle.net>

Closes GH-6070
2021-01-20 18:53:48 -05:00
Nikita Popov 32cf58f7ba Merge branch 'PHP-8.0'
* PHP-8.0:
  Skip preloading test on windows
2021-01-20 10:09:46 +01:00
Nikita Popov 286c13e1e6 Skip preloading test on windows 2021-01-20 10:09:31 +01:00
Dmitry Stogov 378f870d7c Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code)
2021-01-20 11:04:30 +03:00
Dmitry Stogov 6288228b56 Fixed bug #80634 (write_property handler of internal classes is skipped on preloaded JITted code) 2021-01-20 11:03:37 +03:00
Nikita Popov dbe5725ff3 Rename zend-test to zend_test
The extension name should match the name of the ext/ directory,
otherwise it will not get picked up by run-tests. It would be possible
to remap this in run-tests, but I think it's better to rename the
extension to follow the standard format. Other extensions also
use underscore instead of hyphen (e.g. pdo_mysql and not pdo-mysql).
Of course, the ./configure option remains hyphenated.

Closes GH-6613.
2021-01-19 15:28:15 +01:00
Nikita Popov e422ab2af7 Merge branch 'PHP-8.0'
* PHP-8.0:
  Keep JIT region executable under ZTS
2021-01-19 10:28:42 +01:00
Dylan K. Taylor 872f302b8d Keep JIT region executable under ZTS
When one thread tries to compile a script, another thread may
already be executing JITed code. In this case we can't make the
memory non-executable.

This violates the W^X principle, but doesn't seem to be avoidable
for ZTS builds for now. The same problem does not exist for NTS,
as it's a different process executing there, which has it's own
memory protection mapping.

Closes GH-6595.
2021-01-19 10:25:42 +01:00
Nikita Popov 29cf59895a Merge branch 'PHP-8.0'
* PHP-8.0:
  Observe unused return values in JIT
2021-01-19 10:10:08 +01:00
Nikita Popov fbd8e20ed5 Observe unused return values in JIT
Even if the return value is not used, it should still be available
to the observer.
2021-01-19 10:09:53 +01:00
Dmitry Stogov b3bbb8fe3b Mark classes cached by opcache by ZEND_ACC_CACHED flag and prevent useless copying and desrpoying of immutable data. 2021-01-19 11:55:09 +03:00
Nikita Popov 3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Dmitry Stogov 924ec32426 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80422 (php_opcache.dll crashes when using Apache 2.4 with JIT)
2021-01-14 08:16:50 +03:00
Dmitry Stogov 3edf5c969a Fixed bug #80422 (php_opcache.dll crashes when using Apache 2.4 with JIT) 2021-01-14 08:16:27 +03:00
Dmitry Stogov 1a44599dee Always use CG(arena) for unin type lists 2021-01-12 16:33:38 +03:00
Nikita Popov 1f6a3e603b Remove unused bind_hash member
The last usage has been removed in aa16aee51c,
so drop the member as well.
2021-01-12 09:52:58 +01:00
Dmitry Stogov aa16aee51c Cleanup:
- ZCG(bind_hash) is not used anymore
- zend_accel_function_hash_copy() and zend_accel_function_hash_copy_from_shm() are the same
- zend_accel_class_hash_copy() and zend_accel_class_hash_copy_from_shm() are almost the same
2021-01-12 08:54:09 +03:00
Dmitry Stogov c6b2b3b1b5 Merge branch 'PHP-8.0'
* PHP-8.0:
  Add guard if lvalue of assignment may be a reference, but wasn't a reference during recording
2021-01-11 15:13:32 +03:00
Dmitry Stogov 35e0506a2e Add guard if lvalue of assignment may be a reference, but wasn't a reference during recording 2021-01-11 15:12:27 +03:00
Dmitry Stogov d9e441be42 Better CPU registers usage 2021-01-11 14:40:30 +03:00
Dmitry Stogov 59401aa2ef Remove redundand IS_INDIRECT checks (they were necessary for $GLOBALS handling) 2021-01-11 14:39:21 +03:00
Tyson Andre df0fa5b178 Clean up remaining opcodes for foreach([] as $x)
Previously, two useless FE_RESET_R and FE_FREE would be left over whether the empty array
was from a literal, a variable, or a class constant.

This doesn't pick up the RESET_RW case due to a weakness in our "may throw"
modeling. (for foreach by reference).

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
using https://gist.github.com/nikic/58d367ad605e10299f5433d2d83a0b5b

Closes GH-4949
2021-01-07 09:43:31 -05:00
Nikita Popov 3460af5262 Fold dirname in sccp for non-windows platforms 2021-01-07 14:27:12 +01:00
Nikita Popov 63263abff8 Remove unnecessary INDIRECT checks in JIT helpers 2021-01-06 14:28:17 +01:00
Nikita Popov 3c68f38fda Restrict allowed usages of $GLOBALS
This restricts allowed usage of $GLOBALS, with the effect that
plain PHP arrays can no longer contain INDIRECT elements.

RFC: https://wiki.php.net/rfc/restrict_globals_usage

Closes GH-6487.
2021-01-06 12:46:24 +01:00
Nikita Popov 73f989a83b Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix/improve mysqli stubs
2021-01-06 11:29:38 +01:00
Dharman 44a311dbbe Fix/improve mysqli stubs
* mysqli_commit $flags default value is 0, not -1.
* A number of functions cannot actually return null.
* mysqli_poll parameter names were incorrect, as this function
  has a different signature from select.
* fetch functions apart from fetch_all can return false on failure.
2021-01-06 11:28:45 +01:00
Nikita Popov ab9f497b90 Fix curl_getinfo() funcinfo
This can now return any type with any refcount.
2021-01-04 18:57:57 +01:00
Dmitry Stogov 984df80e27 Merge branch 'PHP-8.0'
* PHP-8.0:
  Initialize EX(call)->func by single instruction
  Reuse value stored in %r0 instead of immediate operand
2020-12-29 13:21:06 +03:00
Dmitry Stogov da0ca53f39 Initialize EX(call)->func by single instruction 2020-12-29 13:20:10 +03:00
Dmitry Stogov 56fde2a381 Reuse value stored in %r0 instead of immediate operand 2020-12-29 13:18:56 +03:00
Dmitry Stogov 14b5fff632 Merge branch 'PHP-8.0'
* PHP-8.0:
  Eliminate redundand comparison insructions
2020-12-24 16:59:27 +03:00
Dmitry Stogov 23bbff2b05 Eliminate redundand comparison insructions 2020-12-24 16:58:54 +03:00
Christoph M. Becker b85f0d1cd0 Convert file_info resources to objects
Besides our general desire to get rid of the legacy resource types,
this is particularly appealing for fileinfo, because there are already
respective objects.

Closes GH-5987.
2020-12-20 18:19:22 +01:00
Dmitry Stogov 6c05b33e84 Merge branch 'PHP-8.0'
* PHP-8.0:
  Optimize out result value of ASSIGN, ASSIGN_OP and INC/DEC opcodes, if possible.
2020-12-15 14:34:21 +03:00
Dmitry Stogov de78786566 Optimize out result value of ASSIGN, ASSIGN_OP and INC/DEC opcodes, if possible. 2020-12-15 14:30:58 +03:00
Nikita Popov 0896f36bc6 Merge branch 'PHP-8.0'
* PHP-8.0:
  JIT: Update invalid opcache.jit INI value message to include "tracing" and "function" values
2020-12-15 10:18:54 +01:00
Ayesh Karunaratne 724e241c9d JIT: Update invalid opcache.jit INI value message to include "tracing" and "function" values
`opcache.jit` accepts `tracing` and `function` as aliases, but they were not mentioned in the start-up INI warning message.
This updates the error message to include all possible values.

Closes GH-6490.
2020-12-15 10:18:33 +01:00
Nikita Popov f9942b061d Merge branch 'PHP-8.0'
* PHP-8.0:
  JIT disabled build fix.
2020-12-15 09:51:51 +01:00
David Carlier 1e6c7e776c JIT disabled build fix.
Closes GH-6514.
2020-12-15 09:51:16 +01:00
Dmitry Stogov f1e2cd8625 Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove unused flag
2020-12-14 15:29:34 +03:00
Dmitry Stogov b3377028dc Remove unused flag 2020-12-14 15:29:21 +03:00
Dmitry Stogov c3c7b673d1 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1))
2020-12-14 15:28:27 +03:00
Dmitry Stogov a12e7affd7 Fixed bug #80506 (Immediate SIGSEGV upon ini_set("opcache.jit_debug", 1)) 2020-12-14 15:26:11 +03:00
Dmitry Stogov 6ec7d4c406 Merge branch 'PHP-8.0'
* PHP-8.0:
  Eliminate some repeatable IS_REFERENCE checks
2020-12-10 14:46:03 +03:00
Dmitry Stogov dde5572937 Eliminate some repeatable IS_REFERENCE checks 2020-12-10 14:45:54 +03:00
Dmitry Stogov d92b001d50 Merge branch 'PHP-8.0'
* PHP-8.0:
  Perform early guard type check for result of FETCH_CONSTANT
2020-12-09 22:25:04 +03:00
Dmitry Stogov e9f9e9f863 Perform early guard type check for result of FETCH_CONSTANT 2020-12-09 22:24:03 +03:00
Dmitry Stogov 974b4429cd Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed IS_32BIT/IS_SIGNED_32BIT mess
2020-12-09 17:17:25 +03:00
Dmitry Stogov 8d268e8443 Fixed IS_32BIT/IS_SIGNED_32BIT mess 2020-12-09 17:16:54 +03:00