Nikita Popov [Fri, 25 Oct 2019 09:24:32 +0000 (11:24 +0200)]
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.
Nikita Popov [Thu, 24 Oct 2019 16:11:41 +0000 (18:11 +0200)]
Remove recursive check from instanceof_interface
Parent interfaces are copied into the interface list during
inheritance, so there's no need to perform a recursive check.
Only exception are instanceof checks performed during inheritance
itself. However, we already have unlinked_instanceof for this
purpose, it just needs to be taught to handle this case.
Nikita Popov [Thu, 24 Oct 2019 15:47:35 +0000 (17:47 +0200)]
Optimize instanceof_class/interface
instanceof_class does not need to check for a NULL pointer in the
first iteration -- passing NULL to this function is illegal.
instanceof_interface does not need to use instanceof_class(), it
only has to check whether the CEs match exactly. There is no way
for an interface to appear inside "parent", it will always be in
"interfaces" only.
Nikita Popov [Thu, 24 Oct 2019 12:41:05 +0000 (14:41 +0200)]
Skip IntlTimeZone::getOffset() error tests on non-x86
I'm not totally sure, but I have a strong suspicion that the fact
that this produces an error is an artifact of undefined cast behavior
(which will yield INDVAL on x86 but saturate on ARM). INF seems to
be the only value that results in an error even on x86 (variations
like -INF or NAN succeed).
It might make sense to just remove this test entirely, but for now
let's skip it on non-x86.
Nikita Popov [Thu, 24 Oct 2019 12:26:17 +0000 (14:26 +0200)]
Don't test "blocks" in lstat_stat_variation7.phpt
This stat property seems to be somewhat unreliable depending on the
filesystem. On Travis ARM64 CI a much larger payload is required
to get this value to increase.
Nikita Popov [Wed, 23 Oct 2019 10:19:33 +0000 (12:19 +0200)]
Don't autoload when checking property types
Noticed while working on union types: We do not load argument and
return types during type checks, but we do load property types.
I'm normalizing the behavior towards the existing status quo (not
loading), though we may consider loading everywhere (all types,
and instanceof) in order to properly support class aliases.
Maksim Nikulin [Wed, 24 Jul 2019 09:50:57 +0000 (16:50 +0700)]
Block signals during fpm master initialization
Fix PHP-FPM failure in the case of concurrent reload attempts.
Postpone signal delivery to the fpm master process till proper signal
handlers are set. Prevent the following case:
- Running master process receives `SIGUSR2` and performs `execvp()`.
- Another `SIGUSR2` is arrived before signal handlers are set.
- Master process dies.
- Requests to the HTTP server handled by PHP-fpm can not be served
any more.
Block some signals using `sigprocmask()` before `execvp()` and early
in the `main()` function. Unblock signals as soon as proper
handlers are set.
Fix #78694: Appending to a variant array causes segfault
`write_dimension` object handlers have to be able to handle `NULL`
`offset`s; for now we simply throw an exception instead of following
the `NULL` pointer.
Nikita Popov [Wed, 9 Oct 2019 13:07:51 +0000 (15:07 +0200)]
Limit the amount of errors generated during exif parsing
Emitting errors is fairly expensive, to the point that parsing
a file with a huge number of invalid tags can take seconds.
Generating ten thousand errors is unlikely to help anybody, but
constitutes a potential DOS vector.
Update array access syntax deprecated in line 175 and 204
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/alex/php/hello/ext_skel.php on line 175
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/alex/php/hello/ext_skel.php on line 204
Nikita Popov [Thu, 17 Oct 2019 11:01:02 +0000 (13:01 +0200)]
Integrate property types with variance system
Property types are invariant, but may still have to load classes in
order to check for class aliases. This class loading should follow
the same rules as all other variance checks, rather than just
loading unconditionally.
This change integrates property type invariance checks into the
variance system as a new obligation type, and prevent early binding
if the type check cannot be performed.
* Add an Azure Publish Code Coverage Results task
* Add `make gcovr-html` to generate a gcovr test coverage report in HTML
* Add `make gcovr-xml` to generate a gcovr test coverage report in XML
* Remove `test` target dependency from `make lcov-html`;
Run the two targets together instead: `make test lcov-html`.
See: https://externals.io/message/107113,
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results?view=azure-devops,
and https://github.com/php/php-src/pull/4759.
Nikita Popov [Thu, 10 Oct 2019 13:14:04 +0000 (15:14 +0200)]
Return error_zval form get_property_ptr_ptr on exception
This goes in the reverse direction of 4463acb9513dfb62206760c49b3da1fe4d92f40a.
After looking around a bit, it seems that we already check for
Z_ISERROR_P() on the get_property_ptr_ptr return value in other places.
So do this in zend_fetch_property_address() as well, and also make
sure that EG(error_zval) is indeed returned on exception in
get_property_ptr_ptr.
In particular, this fixes the duplicate exceptions that we used to
get because first get_property_ptr_ptr threw one and then
read_property throws the same exception again.
Nikita Popov [Thu, 10 Oct 2019 12:41:35 +0000 (14:41 +0200)]
Explicitly check for exceptions in by-ref obj prop assign
Relying on setting ERROR if an exception happened during the
property address fetch is both a bit fragile and may pessimize
other codepaths that will check for exceptions in the VM. Adding
an extra exception check instead, which should also allow us to
drop the use of ERROR in this area in master.