Commit Graph

125130 Commits

Author SHA1 Message Date
Christoph M. Becker
6d8d6364df
Merge branch 'PHP-8.0'
* PHP-8.0:
2021-07-29 13:29:24 +02:00
Christoph M. Becker
4645a9d10f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:28:52 +02:00
Christoph M. Becker
92b1c17417
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:21:05 +02:00
Christoph M. Becker
3b461d93e1
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:19:04 +02:00
Christoph M. Becker
d1ccb5bd0c
Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
While our HTTP parser supports upgrade requests, the code using it does
not.  Since upgrade requests are only valid for HTTP/1.1 and we neither
support any higher version, nor HTTPS yet, we do not exit early in case
of such requests, i.e. we ignore them, what is allowed by the specs.

We keep the supporting code in case we can meaningfully support upgrade
requests in the future.

Closes GH-7316.
2021-07-29 13:16:15 +02:00
Nikita Popov
fc45223f85 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix parameter name in call_user_func() error message
2021-07-29 12:49:17 +02:00
Nikita Popov
840e441d2d Fix parameter name in call_user_func() error message
This parameter name has been changed to $callback.
2021-07-29 12:48:25 +02:00
Nikita Popov
29aed2a6c8 Clean up dependency resolution during preloading
Combine the code for checking whether all dependencies are
available and reporting an error if they are not. Actually store
the loaded deps and then use those when checking for type
availability, instead of looking up the same classes again and
again.
2021-07-28 16:55:06 +02:00
Mike Pall
58040f257c DynASM/x86: Add missing escape in pattern. 2021-07-28 17:13:08 +03:00
Nikita Popov
e011952576
Preload unlinked classes, remove preload autoload (#7311)
Currently, classes that can't be linked get moved back into the original script
and are not preloaded. As such classes may be referenced from functions that
did get preloaded, there is a preload autoload mechanism to load them at
runtime.

Since PHP 8.1, we can safely preload unlinked classes, which will then go
through usual lazy loading. This means that we no longer need the preload
autoload mechanism. However, we need to be careful not to modify any hash
table buckets in-place, and should create new buckets for lazy loaded classes.
2021-07-28 14:27:58 +02:00
George Peter Banyard
fb52b3c915 [skip-ci] Fix comments and UPGRADING.INTERNALS for zend_type changes 2021-07-28 13:31:52 +02:00
Nikita Popov
89aa42c74b Add missing EXTENSIONS section 2021-07-28 12:38:41 +02:00
Nikita Popov
380e705fc2 Use consistent line numbers for early binding errors
Non-early-bound classes report inheritance errors at the first line
of the class, if no better line information is available (we should
really store line numbers for properties at least...) Early bound
classes report it at the last line of the class instead.

Make the error reporting consistent by always reporting at the
first line.
2021-07-28 12:35:20 +02:00
Nikita Popov
f78216f62e Extract early binding registration code
This is the same for the cached and uncached cases and will make
GH-7311 a bit simpler.
2021-07-28 11:19:39 +02:00
Christoph M. Becker
19061e3b43
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81252: PDO_ODBC doesn't account for SQL_NO_TOTAL
2021-07-28 11:02:26 +02:00
Nikita Popov
a1c1ee6a48 Don't use opaque for encoding detection score
opaque is used by the htmlentities filter, which means that we
end up trying to free the score value as a pointer. Don't try to
be overly tricky here and simply allocate a separate structure
to hold the number of illegal characters and the score.
2021-07-28 10:54:27 +02:00
Christoph M. Becker
3244e0785d
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81252: PDO_ODBC doesn't account for SQL_NO_TOTAL
2021-07-28 10:53:27 +02:00
Christoph M. Becker
98049e8b9a
Fix #81252: PDO_ODBC doesn't account for SQL_NO_TOTAL
If `P->len` is negative (not only when it is `SQL_NULL_DATA`), we must
not go on, because the following code can't deal with that.  This means
that the output parameter will be set to `NULL` without any indication
what went wrong, but it's still better than crashing.

Closes GH-7295.
2021-07-28 10:51:38 +02:00
Kamil Tekiela
d2ccea1381
Remove wrappers for *printf functions (#7313) 2021-07-28 10:24:46 +02:00
Nikita Popov
9d0db2e98a Fixed bug #81298
Creation of the filter may fail for some special encodings, for
which detection is not supported.
2021-07-28 10:11:46 +02:00
Nikita Popov
dcf5e5bbf0 Reuse part of the class binding logic
This part of DECLARE_CLASS and DECLARE_CLASS_DELAYED is the
same.
2021-07-27 16:54:45 +02:00
Nikita Popov
8834cf013b Handle missing class when evaluating CONST_ENUM_INIT
When resolving constants on a dynamically declared class during
preloading, the enum class may not be available. Fail gracefully
in that case.

Possibly we shouldn't be trying to evaluate constants on
non-linked classes at all?
2021-07-27 14:36:38 +02:00
Nikita Popov
6aa08736bb Don't unlink preload file if test failed 2021-07-27 14:36:38 +02:00
Kamil Tekiela
abacd91cc8
Merge branch 'PHP-8.0'
* PHP-8.0:
  Prevent mysqli::next_result from reporting errors from previous calls (#7304)
2021-07-27 11:57:39 +01:00
Kamil Tekiela
65e2dbd0de
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Prevent mysqli::next_result from reporting errors from previous calls (#7304)
2021-07-27 11:56:14 +01:00
Kamil Tekiela
d26069a2f1
Prevent mysqli::next_result from reporting errors from previous calls (#7304) 2021-07-27 11:50:28 +01:00
Nikita Popov
8675380b67 Increment refcounts in mutable data copies
For mutable_data on preloaded classes, there may be refcounted
values in the constants/properties table.
2021-07-27 12:29:46 +02:00
Christoph M. Becker
ccb6642c91
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81294: Segfault when removing a filter
2021-07-27 12:17:07 +02:00
Christoph M. Becker
bf9afc184f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81294: Segfault when removing a filter
2021-07-27 12:14:22 +02:00
Christoph M. Becker
1fa26eccba
Fix #81294: Segfault when removing a filter
We need to call the proper method.

Closes GH-7308.
2021-07-27 12:12:02 +02:00
Nikita Popov
1bd6fafa2f Fix preloading of trait property attributes 2021-07-27 12:07:22 +02:00
Nikita Popov
5a7e1a7aa8 Don't use IMMUTABLE flag to decide whether mutable_data is used
mutable_data may be used for IMMUTABLE classes, internal classes
and to-be-preloaded classes. Check whether the mutable_data
map_ptr is set rather than only the IMMUTABLE flag.
2021-07-27 11:44:01 +02:00
Nikita Popov
b35418402f Allocate map_ptr for mutable_data during preloading
We need to discard objects in the class constants if they happened
to be evaluated during preloading. To allow doing so, we need to
use mutable_data, which will place the evaluated constants into
a separate table.
2021-07-27 11:16:38 +02:00
Nikita Popov
aef3bb70f4 Fix enum cast AST allocation, again
We always need to allocate space for the three children, and only
don't need one of the zend_ast_zval structures.
2021-07-27 11:05:45 +02:00
Nikita Popov
c1959e63e5 Fix preloading of enums
We should not store constants that resolve to objects.
2021-07-27 11:01:44 +02:00
Nikita Popov
703e92c121 Don't force constant resolution for include preloading
Same as with property types, we no longer require that all constants
are resolved for preloading to work, it's just an optimization. As
such, drop the forced resolution for include-based preloading and
just keep the optimization.
2021-07-27 10:50:31 +02:00
Nikita Popov
645ef62693 Fix enum cast AST allocation
I missed this occurrence of the hardcoded number "3".
2021-07-27 10:44:33 +02:00
Nikita Popov
70195c3561 Don't force property type resolution for include preloading
Having all property types resolved is no longer a hard requirement
for preloading, resolving the types is just an optimization. As
such, drop the special logic that forced loading of property
types when include-based preloading is used. Instead only keep
the code that resolves types based on actually preloaded classes.

Also drop the ZEND_ACC_PROPERTY_TYPES_RESOLVED flag, which is now
nearly useless and takes up flag space...
2021-07-27 10:36:21 +02:00
Nikita Popov
56ef117419 Remove special ctor handling in abstract class verification
This seems to be some kind of leftover from PHP 4 ctor support.
2021-07-27 10:16:47 +02:00
Máté Kocsis
663536d7d9
Improve class inheritance error messages (#7307) 2021-07-27 09:42:37 +02:00
Nikita Popov
a374230c15 Add support for internal enums
This adds support for internal enums with the same basic approach
as userland enums. Enum values are stored as CONSTANT_AST and
objects created during constant updating at runtime. This means
that we need to use mutable_data for internal enums.

This just adds basic support and APIs, it does not include the
stubs integration from #7212.

Closes GH-7302.
2021-07-27 09:19:14 +02:00
Christoph M. Becker
ff8e04ac30
[ci skip] UPGRADING: oci8.old_oci_close_semantics has been deprecated 2021-07-25 14:51:15 +02:00
Máté Kocsis
3babe9576e
Validate that promoted readonly properties have a type 2021-07-25 13:13:19 +02:00
Máté Kocsis
8d25b62414
Display the readonly property modifier when printing reflection info 2021-07-25 12:13:48 +02:00
Christoph M. Becker
f5ee3429db
Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81283: shmop can't read beyond 2147483647 bytes
2021-07-23 17:51:15 +02:00
Christoph M. Becker
71879d385e
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81283: shmop can't read beyond 2147483647 bytes
2021-07-23 17:49:56 +02:00
Christoph M. Becker
387c0de983
Fix #81283: shmop can't read beyond 2147483647 bytes
`start`, `count` and `shmop->size` are `zend_long`, so we must not
restrict to `INT_MAX`.

Closes GH-7301.
2021-07-23 17:46:42 +02:00
Nikita Popov
c4f4f1ece7 Share zval_make_interned_string() helper
The same function was defined in zend_compile.c and zend_API.c.
2021-07-23 16:10:34 +02:00
Nikita Popov
36d2dd087a Remove redundant static_members/mutable_data cleanup
static_members, mutable_data and static vars in methods are cleaned
up during an earlier shutdown phase (because this has to happen
before we destroy the object store). There is no need to repeat
this cleanup when destroying the classes.
2021-07-23 13:01:40 +02:00
Nikita Popov
89d0115409 Remove zend_cleanup_internal_classes()
If fast_shutdown is used, then we don't need to destroy static
members at all. If fast_shutdown is not used, then we already
loop over classes to destroy static members and static variables
in methods.
2021-07-23 12:51:47 +02:00