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

38 Commits

Author SHA1 Message Date
KsaR
01b3fc03c3 Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
13467bdcc0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81015
2021-05-06 10:47:22 +02:00
Nikita Popov
fd1d5ec2b4 Add ZEND_CLASS_CONST_FLAGS() macro
And drop Z_ACCESS_FLAGS(). We no longer store *only* access flags
in these.
2021-04-28 14:51:54 +02:00
Nikita Popov
88ce1c71b5 Look up func info using function name rather than lcname of call
As we already have the called zend_function here, let's use the
name directly, rather than using the lcname of the call. This means
that aliases would be handled correctly automatically.
2021-04-28 12:13:05 +02:00
Nikita Popov
97c6d6605e Remove FR/FX macros
Functions returning by-reference are generally a lost cause, we
won't be able to provide useful information for them.
2021-04-28 12:13:01 +02:00
Nikita Popov
d0610898f6 Remove UNKNOWN_INFO func info entries
There's no need to explicitly list that we don't know anything
about a function -- that's the default state.
2021-04-28 11:45:34 +02:00
Nikita Popov
bfa8b49196 Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove incorrect func info for array_reduce() and pos()
2021-04-28 11:41:59 +02:00
Nikita Popov
08afe9891c Merge branch 'PHP-8.0'
* PHP-8.0:
  filter_var_array() may return array_of_ref
2021-04-28 11:28:06 +02:00
Nikita Popov
b5778ce1b7 Merge branch 'PHP-8.0'
* PHP-8.0:
  fetch_assoc may return array_key_long
2021-04-28 11:20:55 +02:00
Nikita Popov
e8ef923dd6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove assert_options() return value info
2021-04-28 11:06:54 +02:00
Nikita Popov
bd5419abd6 Merge branch 'PHP-8.0'
* PHP-8.0:
  password_get_info() may return array_of_null
2021-04-28 10:55:57 +02:00
Nikita Popov
3ddab31842 Merge branch 'PHP-8.0'
* PHP-8.0:
  getdate() may return array_key_long
2021-04-28 10:48:04 +02:00
Nikita Popov
cb1d1138f6 Merge branch 'PHP-8.0'
* PHP-8.0:
  pg_connect() may return rcn
2021-04-28 10:38:07 +02:00
Nikita Popov
2ffab441c8 Fix pgsql func info
Some functions can now return a value with refcount > 1.
2021-04-28 10:14:29 +02:00
Nikita Popov
c4a749c932 Remove php includes from sccp.c 2021-04-20 12:26:12 +02:00
Nikita Popov
b82242a88d Remove unnecessary php.h includes from Zend/
The Zend/ directory really shouldn't be including php headers.
These particular includes are plain unnecessary.
2021-04-20 12:21:45 +02:00
Matt Brown
6cd0b48cac Implement never return type
The never type can be used to indicate that a function never
returns, for example because it always unwinds.

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

Closes GH-6761.
2021-04-19 11:27:29 +02:00
twosee
c457be80dd Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80900
2021-04-14 00:21:37 +08:00
Josh Soref
462da6e09c Fix spelling and grammar mistakes
This PR corrects misspellings identified by the check-spelling action.

The misspellings have been reported at jsoref@b6ba3e2#commitcomment-48946465

The action reports that the changes in this PR would make it happy: jsoref@602417c

Closes GH-6822.
2021-04-13 12:09:37 +02:00
Nikita Popov
6bd46d2f68 Don't use range information from a prototype method
The method may be overridden.
2021-04-12 10:30:04 +02:00
Dmitry Stogov
12ed58eca0 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed type inference for OP_DATA
2021-04-09 14:53:44 +03:00
George Peter Banyard
09efad615b Use zend_string_equals_(literal_)ci() API more often
Also drive-by usage of zend_ini_parse_bool()

Closes GH-6844
2021-04-09 02:34:50 +01:00
Nikita Popov
47a722e77f Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't mark non-refcounted phi as live
2021-04-08 18:24:57 +02:00
Nikita Popov
dbe2cdd7dc Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix DCE of FREE of COALESCE

Note that this is a non-trivial merge, as opt/coalesce.phpt
regresses with this change. I'll have to see if it can be
improved.
2021-04-08 17:06:40 +02:00
George Peter Banyard
5caaf40b43 Introduce pseudo-keyword ZEND_FALLTHROUGH
And use it instead of comments
2021-04-07 00:46:29 +01:00
Dmitry Stogov
2f3538c215 Improved type inference for FE_FETCH_R 2021-03-25 16:00:36 +03:00
Nikita Popov
6a5d60085d Support VERIFY_RETURN_TYPE elision with unused operand
This handles the degenerate case where SCCP replaced the value in
the RETURN opcode with a constant, but the VERIFY_RETURN is still
there. We can still apply the same optimization, just don't need
to adjust the use list in this case.

The result is still sub-optimal in that a dead QM_ASSIGN is left
behind.
2021-03-22 14:54:29 +01:00
Nikita Popov
2d0e2733c8 Support prototypes in call graph
Even if we don't know the exact method being called, include it
in the call graph with the is_prototype flag. In particular, we
can still make use of return types from prototype methods, as
PHP 8 makes LSP violations a hard error.

Most other places are adjusted to skip calls with !is_prototype.
Maybe some of them would be fine, but ignoring them is conservative.
2021-03-19 10:49:15 +01:00
Nikita Popov
e67156e967 Add missing rc1/rcn to return type initialization 2021-03-19 10:04:56 +01:00
Nikita Popov
dcac654fd5 Allow inferring narrowed return type
Even if an explicit return type is given, we might still infer
a more narrow one based on return statements. We shouldn't
pessimize this just because a type has been declared.
2021-03-18 17:11:56 +01:00
Nikita Popov
8690efd1f8 Update opt test
And fix a type in the fetch class flags dumping while here.
2021-03-18 15:25:40 +01:00
Ilija Tovilo
269c8dac1d Implement enums
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6489.
2021-03-17 19:08:03 +01:00
Nikita Popov
77ebf81492 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix refcount inference for typed properties
2021-03-16 11:18:12 +01:00
Nikita Popov
47a2e5c785 Reference dynamic functions through dynamic_defs
Currently, dynamically declared functions and closures are inserted
into the function table under a runtime definition key, and then later
possibly renamed. When opcache is not used and a file containing a
closure is repeatedly included, this leads to a very large memory leak,
as the no longer needed closure declarations will never be freed
(https://bugs.php.net/bug.php?id=76982).

With this patch, dynamic functions are instead stored in a
dynamic_func_defs member on the op_array, which opcodes reference
by index. When the parent op_array is destroyed, the dynamic_func_defs
it contains are also destroyed (unless they are stilled used elsewhere,
e.g. because they have been bound, or are used by a live closure). This
resolves the fundamental part of the leak, though doesn't completely
fix it yet due to some arena allocations.

The main non-obvious change here is to static variable handling:
We can't destroy static_variables_ptr in destroy_op_array, as e.g.
that would clear the static variables in a dynamic function when
the op_array containing it is destroyed. Static variable destruction
is separated out for this reason (we already do static variable
destruction separately for normal functions, so we only need to
handle main scripts).

Closes GH-5595.
2021-03-01 11:35:54 +01:00
Nikita Popov
4c088c5da7 Handle warnings during sccp function evaluation
Some upcoming changes like https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
will make it somewhat inconvenient to determine whether a given
function invocation will generate a diagnostic. Rather than trying
to exclude this in advance, call the function with diagnostics
suppressed, and check whether anything was thrown.

This adds a new EG flag that is kept specific to the SCCP use-case.
This does not use the error_cb hook as it is a (non-TLS) global,
and doesn't fully suppress error handling besides.

Test this by removing the in advance checks for implode and array_flip.
2021-02-11 12:36:35 +01:00
Nikita Popov
4224b704b1 Merge branch 'PHP-8.0'
* PHP-8.0:
  Update func info after password_get_info() change
2021-02-11 11:44:36 +01:00
Nikita Popov
27cd7a11cb Add support for string keys in array unpacking
This adds support for:

    $array1 = ['a' => 1, 'b' => 2];
    $array2 = ['b' => 3, 'c' => 4];
    $array = [...$array1, ...$array2];
    // => ['a' => 1, 'b' => 3, 'c' => 4]

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

Closes GH-6584.
2021-02-09 10:04:27 +01:00
Nikita Popov
83be073abe Move optimizer into core
This only moves the files, adjusts the build system, exports APIs
and does minor fixups to make sure the code builds.

This does not yet try to make the optimizer usable independently
of opcache.

Closes GH-6642.
2021-01-28 10:38:25 +01:00