Sebastian Pop [Wed, 29 Jan 2020 14:54:19 +0000 (14:54 +0000)]
inline by hand to avoid uninitialized variable warning
When compiling with "-Wall -Werror" gcc emits two errors:
../src/pcre2_jit_neon_inc.h:211:8: error: ‘cmp1b’ is used uninitialized in this function [-Werror=uninitialized]
211 | data = fast_forward_char_pair_compare(compare1_type, data, cmp1a, cmp1b);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/pcre2_jit_neon_inc.h:212:9: error: ‘cmp2b’ is used uninitialized in this function [-Werror=uninitialized]
212 | data2 = fast_forward_char_pair_compare(compare2_type, data2, cmp2a, cmp2b);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The compiler emits the error message before inlining.
Because the warning is based on an intra-procedural data
flow analysis, the compiler does not see that cmp1b and
cmp2b are not used when they are not initialized.
Here is the code of that function, cmp2 is only used
when ctype is compare_match2 or compare_match1i,
and not when ctype is compare_match1:
Nikita Popov [Fri, 31 Jan 2020 09:21:37 +0000 (10:21 +0100)]
Fix bug #76047
Unlink the current stack frame before freeing CVs or extra args.
This means it will no longer show up in back traces that are
generated during CV destruction.
We already did this prior to destructing the object/closure,
presumably for the same reason.
Akim Demaille [Thu, 30 Jan 2020 17:09:25 +0000 (18:09 +0100)]
Use "%empty" in the parsers, instead of comments
The annotation %empty is properly enforced: warnings when it's
missing, and errors when it's inappropriate. Support for %empty was
introduced in Bison 3.0.
This change wasn't quite right: I noticed only now that the
RSHUTDOWN function is #ifdef PHP_WIN32 and I'm not fully convinced
that ifdef can be removed: syslog might also be used by error
logging in FPM for example, in which case we probably shouldn't
be closing the log here.
Generally it's unclear how the openlog() functionality exposed
by PHP is supposed to interact with openlog() uses by SAPIs.
For now I'll just revert this change and let it leak across
requests.
Nikita Popov [Thu, 30 Jan 2020 14:31:39 +0000 (15:31 +0100)]
Initialize SplFixedArray elements to NULL instead of UNDEF
The SplFixedArray API treats all elements as NULL, even if they
have not been explicitly initialized. Rather than initializing
to UNDEF an treating that specially in various circumstances,
directly initialize elements to NULL.
This also fixes an assertion failure in the attached test case.
Fix #70078: XSL callbacks with nodes as parameter leak memory
The fix for bug #49634 solved a double-free by copying the node with
`xmlDocCopyNodeList()`, but the copied node is later freed by calling
`xmlFreeNode()` instead of `xmlFreeNodeList()`, thus leaking memory.
However, there is no need to treat the node as node list, i.e. to copy
also the node's siblings; just creating a recursive copy of the node
with `xmlDocCopyNode()` is sufficient, while that also avoids the leak.
Fix #74063: NumberFormatter fails after retrieval from session
While it would be desireable to actually support unserialization of
NumberFormatter instances, at least we should not allow serialization
for now.
We also remove some doubtful tests, which have been added[1] claiming
that they would crash the intl extension, but apparently no fix has
been applied, and the test cases have not been marked as XFAIL.
Nikita Popov [Wed, 29 Jan 2020 15:40:13 +0000 (16:40 +0100)]
Restore digit check in mb_decode_numericentity()
I replaced it with a multiplication overflow check in 18599f9c52959b2e8cbfac57e278644499a3547d. However, we need both,
because the code for restoring the number can't handle numbers
with many leading zeros right now and I don't feel like teaching it.
Enable ZipArchive::setMtime(Name|Index) on Windows
These are enabled on non Windows systems as of zip 1.16.0 with libzip
>= 1.0.0. Since Windows builds use at least libzip 1.4.0, we also
enable these methods there.
Anatol Belski [Wed, 29 Jan 2020 11:34:04 +0000 (12:34 +0100)]
Fix datatype
This has been introduced by 84b0d0fabaaf21ee056984a33b573121296af942.
Besides it causes runtime issues on POWER5 (and presumably later), the
implementation would expect this array to consist on 32-bit integers.
Akim Demaille [Tue, 28 Jan 2020 19:41:56 +0000 (20:41 +0100)]
Use "%define parse.error verbose"
The YYERROR_VERBOSE macro will no longer be supported in Bison 3.6.
It was superseded by the "%error-verbose" directive in Bison 1.875
(2003-01-01). Bison 2.6 (2012-07-19) clearly announced that support
for YYERROR_VERBOSE would be removed. Note that since Bison 3.0
(2013-07-25), "%error-verbose" is deprecated in favor of "%define
parse.error verbose".
Nikita Popov [Tue, 28 Jan 2020 16:12:45 +0000 (17:12 +0100)]
Fix mysqli_get_warnings() with multi queries
In this case warning_count may be non-zero, but php_get_warnings()
may still return no warnings. In this case we should return false
rather than returning a corrupted mysqli_warning object.
Fix #79174: cookie values with spaces fail to round-trip
The fix for bug #78929 disabled the conversion of spaces in cookie
values to plus signs, but failed to adapt `php_setcookie()`
accordingly, so that it uses raw URL encoding as well.
This is already supported by non Windows builds for libzip >= 1.3.1,
and since we're using at least libzip 1.4.0 on Windows, we should
support it there as well.