Dmitry Stogov [Fri, 19 Mar 2021 19:36:24 +0000 (22:36 +0300)]
Add zend_hash_lookup() and zend_hash_index_lookup() functions.
Thet search for an element with given key/index and add an empty one (NULL), if no found.
Fix #80889: Cannot set save handler when save_handler is invalid
There is no need to require a (valid) save_handler to be set, when a
user handler is supposed to be set. We just have to make sure, that
no user handler is already set in this case.
Nikita Popov [Thu, 18 Mar 2021 14:40:48 +0000 (15:40 +0100)]
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.
Nikita Popov [Thu, 18 Mar 2021 16:11:56 +0000 (17:11 +0100)]
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.
Nikita Popov [Thu, 18 Mar 2021 14:15:21 +0000 (15:15 +0100)]
Don't imply SILENT from NO_AUTOLOAD
We have separate flags for non-autoloading class fetches and
silent class fetches. There's no reason why NO_AUTOLOAD should
be special-cased to be implicitly silent.
Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
It is not guaranteed, that the driver inserts only a single NUL byte at
the end of the buffer. Apparently, there is no way to find out the
actual data length in the buffer after calling `SQLGetData()`, so we
adjust after the next `SQLGetData()` call.
We also prevent PDO::ODBC_ATTR_ASSUME_UTF8 from fetching garbage, by
fetching all chunks with the same C type.
Nikita Popov [Thu, 18 Mar 2021 09:48:43 +0000 (10:48 +0100)]
Fix locale switch back to C in pcre
The compile context is shared between patterns, so we need to set
the character tables unconditionally in case we switched from
a non-C locale to the C locale.
Nikita Popov [Thu, 18 Mar 2021 09:14:32 +0000 (10:14 +0100)]
Destroy constant values before object store
Now that constants can contain objects (currently only enums),
we should destroy them before we free the object store, otherwise
there will be false positive leak reports.
Fix #66783: UAF when appending DOMDocument to element
According to the DOM standard, elements may only contain element, text,
processing instruction and comment nodes[1]. It is also specified that
a HierarchyRequestError should be thrown if a document is to be
inserted[2]. We follow that standard, and prevent the use-after-free
this way.
Nikita Popov [Wed, 17 Mar 2021 11:19:09 +0000 (12:19 +0100)]
Avoid unnecessary static_variables persistence
static_variables should be treated the same way as all other
op_array components nowadays (only static_variables_ptr is
special). There's no need to persist/serialize it is separately
per shared op_array.
Max Semenik [Wed, 10 Feb 2021 12:17:03 +0000 (15:17 +0300)]
run-tests.php: class for test file loading
This moves a bunch of code outside of run_tests(), making it a bit
more manageable. Additionally, accessors provide better readability
than isset() and friends.
This is a minimal patch that moves the code but does not refactor
much. For the sake of reviewing experience, it does not involve
further refactoring which could include:
* Removing setSection()
* Fixing up the mess with hasSection() vs. sectionNotEmpty(), only
one of which is really needed.
* Moving more repetitive code into the new class.
All of this will be done with later commits.
Nikita Popov [Tue, 16 Mar 2021 09:38:04 +0000 (10:38 +0100)]
Add sanity check for type of read_property return value
If an internal class overrides read_property and declared property
types, make sure that the returned value matches the declared
type (in debug builds).
Dharman [Wed, 20 Jan 2021 22:50:55 +0000 (22:50 +0000)]
Change the default error mode of mysqli
Make MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT the new mysqli
error reporting default. Explicitly call
mysqli_report(MYSQLI_REPORT_OFF) to preserve previous behavior.