Commit Graph

117101 Commits

Author SHA1 Message Date
George Peter Banyard
aaa1f90e3f Drop the custom I length modifier from snprintf custom implementation.
Extensions should rather use the ZEND_LONG_FMT, ZEND_ULONG_FMT and
ZEND_XLONG_FMT macros defined in php-src/Zend/zend_long.h

Closes GH-5089
2020-01-20 23:03:10 +01:00
Tyson Andre
691880b22c Speed up unserializing object properties
Hash table lookups are slow.
Don't do one a second time to update the property.

The call to zend_hash_update_ind goes back to 8b0deb8cd2

Background: Properties are IS_INDIRECT when they're a declared property,
and point to properties_table.
See https://nikic.github.io/2015/06/19/Internal-value-representation-in-PHP-7-part-2.html#objects-in-php-7
2020-01-20 09:54:04 -05:00
Nikita Popov
0fbdc5a378 Remove unnecessary result variable
Instead directly use return_value. Hopefully this also works
around the "may be uninitialized" warning...
2020-01-20 11:08:51 +01:00
Nikita Popov
6811222422 Eliminate uses of ZVAL_ZVAL and friends
Instead add RETURN_COPY(_VALUE) macros will the expected behavior.

RETURN_ZVAL doesn't make any sense since PHP 7, but has stuck
around, probably because the alternative was to write directly to
the return_value variable.
2020-01-20 10:34:17 +01:00
Nikita Popov
5947437d47 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #79112: IMAP can't find OpenSSL during configure
2020-01-20 09:59:40 +01:00
Nikita Popov
74380465ec Fix bug #79112: IMAP can't find OpenSSL during configure
Remove the check of PHP_OPENSSL inside SETUP_OPENSSL. It's the
responsibility of the caller to determine whether they want to
enable openssl or not. This makes SSL detection in IMAP work,
which uses a different option.

Additionally also clarify that --with-openssl-dir cannot actually
be used to specify an OpenSSL directory -- these options just
serve as a way to enable OpenSSL in extensions without also
enabling the OpenSSL extension. They need to be renamed to
something clearer in master.

Closes GH-5091.
2020-01-20 09:59:27 +01:00
Nikita Popov
6ada49a469 Merge branch 'PHP-7.4'
* PHP-7.4:
  Increase timeout in mysqli_reap_async_query test
2020-01-20 09:54:38 +01:00
Nikita Popov
b6506ab32a Increase timeout in mysqli_reap_async_query test
The 2000 here is 2ms, which is a bit optimistic for parallelized
testing.
2020-01-20 09:53:54 +01:00
Xinchen Hui
ce5d722a6d Merge branch 'PHP-7.4'
* PHP-7.4:
  Let's make this safer from maliciously crafted filename
2020-01-20 12:35:08 +08:00
Xinchen Hui
2958cdc0b5 Let's make this safer from maliciously crafted filename 2020-01-20 12:33:37 +08:00
Xinchen Hui
5aa12d2e32 Merge branch 'PHP-7.4'
* PHP-7.4:
  minor cleanup
2020-01-20 12:29:23 +08:00
Xinchen Hui
dda2addab2 minor cleanup 2020-01-20 12:28:57 +08:00
Xinchen Hui
31dd635eb3 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79114 (Eval class during preload causes class to be only half available)
2020-01-20 12:25:10 +08:00
Xinchen Hui
9c2fd55d01 Fixed bug #79114 (Eval class during preload causes class to be only half available) 2020-01-20 12:24:49 +08:00
Máté Kocsis
99db00b1f2
Fix #78880 Another round 2020-01-19 18:28:43 +01:00
Christoph M. Becker
7426e3b6a1 Bump required libcurl version to 7.29.0
libcurl 7.29.0 has been released almost eight years ago, so this
version is supposed to be available practically everywhere.  This bump
also allows us to get rid of quite some conditional code and tests
catering to very old libcurl versions.
2020-01-19 14:10:46 +01:00
Tyson Andre
3c72105edb Remove leftover ZEND_CAST code for (unset) cast.
Followup for d74d3922ce

Attempting to require a file with (unset) casts results in an E_COMPILE_ERROR
that can't be caught or handled by set_exception_handler/set_error_handler.

Also remove the (bool) cast, because the ZEND_BOOL opcode handles that.

Remove inference that array -> object cast can throw.
It was added in 2a286ad599 - I don't know how creating an stdClass would throw.
(numeric keys, references, etc. don't cause it to throw)

Closes GH-5042
2020-01-18 11:06:19 -05:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Nikita Popov
117b18d22d Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79115
2020-01-17 11:38:18 +01:00
Nikita Popov
384dfe331b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79115
2020-01-17 11:38:10 +01:00
Nikita Popov
07bda97e76 Fixed bug #79115 2020-01-17 11:37:35 +01:00
Nikita Popov
9ec1ee5976 Add support for deprecating constants
Internal constants can be marked as CONST_DEPRECATED, in which
case accessing them will throw a deprecation warning.

For now this is only supported on global constants, not class
constants. Complain to me if you need to deprecate a class
constant...

Closes GH-5072.
2020-01-17 10:05:06 +01:00
Nikita Popov
ae706e51e1 Merge branch 'PHP-7.4'
* PHP-7.4:
  Update php.ini files to add missing FTP extension
2020-01-17 09:51:31 +01:00
aand18
4d24f5a494 Update php.ini files to add missing FTP extension
FTP functionality isn't enabled by default and not listed as a disabled
extension in the `php.ini` file either.

This should spare a few googles to anyone needing FTP functionality in PHP.

Closes GH-5084.
2020-01-17 09:51:18 +01:00
Nikita Popov
75aa5bfa9e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #71876
2020-01-17 09:48:50 +01:00
Nikita Popov
9f65afca71 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #71876
2020-01-17 09:48:42 +01:00
Nikita Popov
018251a7c4 Fixed bug #71876
This is a backport of fcdc0a6db0
to the PHP-7.3 branch. We need to make sure that OnUpdateString
is also called for a NULL value, otherwise the reset of the encoding
at the end of the request will not work.

I believe I already tried to land this before once, but it didn't
actually end up on the PHP-7.3 branch due to a push conflict that
I only noticed just now.
2020-01-17 09:47:31 +01:00
Nikita Popov
43719022ea Improve SSA representation of FE_FETCH
The op2 of FE_FETCH is only written if the loop edge is taken.
Fix up the SSA form to use the pre-assignment value if the exit
edge is taken.

This allows us to properly infer the type of the loop variable,
without letting the pre-loop type leak in.

Closes GH-5040.
2020-01-17 09:41:27 +01:00
Nikita Popov
bd1977282c Use zend_type inside type lists
Instead of having a completely independent encoding for type list
entries. This is going to use more memory, but I'm not particularly
concerned about that, as type unions that contain multiple classes
should be uncommon. On the other hand, this allows us to treat
top-level types and types inside lists mostly the same.

A new ZEND_TYPE_FOREACH macros allows to transparently treat list
and non-list types the same way. I'm not using it everywhere it could be
used for now, just the places that seemed most obvious.

Of course, this will make any future type system changes much simpler,
as it will not be necessary to duplicate all logic two times.
2020-01-17 09:37:54 +01:00
Máté Kocsis
afdaa91170
Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Nikita Popov
1fa6f03265 Fix reflection leak if type inside type list is resolved 2020-01-16 15:30:24 +01:00
Christoph M. Becker
1e62e627fd Merge branch 'PHP-7.4'
* PHP-7.4:
  Disable optimizations for ASan instrumented builds
2020-01-16 13:58:28 +01:00
Christoph M. Becker
c9908ee5eb Disable optimizations for ASan instrumented builds
ASan instrumentation does not support the MSVC debug runtime, but still
it does not make sense to enable optimizations for such builds, since
they are not meant for production usage anyway, and although memory
corruption issues are still found in optimized builds, the generated
diagnostics are close to being useless, and apparently sometimes even
outright wrong.  Therefore, we disable all optimizations for ASan
instrumented builds.

We also introduce and use `ZEND_WIN32_NEVER_INLINE` for ASan enabled
builds to avoid inlining of functions, so we get even better
diagnostics.
2020-01-16 13:57:21 +01:00
Máté Kocsis
c3cf01b553
Fix #78880: Yet another batch of spelling errors 2020-01-16 12:04:00 +01:00
Máté Kocsis
0b4778c377
Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Christoph M. Becker
9d7e03c325 Remove useless skip check
As of PHP 5.4.0, `detect_unicode` is always available, so this check
cannot fail.
2020-01-15 18:38:15 +01:00
Christoph M. Becker
5d3be966f9 Use proper printf() specifiers 2020-01-15 18:18:36 +01:00
George Peter Banyard
9118a96fb0 Remove va_copy from zend_portability as it's always available since C99 2020-01-14 22:56:03 +01:00
Christoph M. Becker
f6fbe13717 Rename run-test.php to run-tests.php in the test packs
In the php-src repository, the test runner is named run-tests.php, but
when it is copied to the tests packs, it is renamed to run-test.php.
This renaming does not make sense, and is actually somewhat confusing.
Although changing the name back to run-tests.php constitutes a BC
break, we think the benefit of having a single name outweights the
disadvantages in the long run.
2020-01-14 18:31:25 +01:00
Christoph M. Becker
03bd4333f6 Add imagegetinterpolation()
While `imagesetinterpolation()` is available as of PHP 5.5.0,
there is no according getter function, so users would have to track the
current interpolation method manually.

To remedy this, we introduce `imagegetinterpolation()` as thin wrapper
for `gdImageGetInterpolationMethod()` (which has been introduced with
libgd 2.1.1), and use `im->interpolation_id` as fallback for older
libgd.  Since our bundled libgd does not yet have this function, we add
it.

We also simplify the recently introduced bug79068.phpt, where it is
sufficient to check that the interpolation method has not been changed.
2020-01-14 18:25:27 +01:00
Christoph M. Becker
127d6f3f39 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79096: FFI Struct Segfault
2020-01-14 16:47:24 +01:00
Christoph M. Becker
05f3cd23ed Fix #79096: FFI Struct Segfault
We must not assume that the size of a function's return value is at
most `sizeof(ffi_arg)`, but rather have to use the size which already
has been determined for the return type if it is larger than
`sizeof(ffi_arg)`.

To be able to have a regression test, we export the required test
function from the zend-test extension, and make sure that the test
can be run on different platforms regardless of whether zend-tests was
built statically or dynamically.
2020-01-14 16:46:58 +01:00
Dmitry Stogov
77bf144d52 Inline hot parts of bitwise instructions into hybrid VM 2020-01-14 13:47:10 +03:00
Christoph M. Becker
7232779fca Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79106: PDO may fetch wrong column indexes with PDO::FETCH_BOTH
2020-01-13 18:49:38 +01:00
Christoph M. Becker
ed78c6dbae Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79106: PDO may fetch wrong column indexes with PDO::FETCH_BOTH
2020-01-13 18:48:55 +01:00
Christoph M. Becker
30ce242435 Fix #79106: PDO may fetch wrong column indexes with PDO::FETCH_BOTH
Column names can be numeric strings, so we have to make sure to insert
the column values with the appropriate numeric keys, instead of adding
them.
2020-01-13 18:47:54 +01:00
Dmitry Stogov
8ee04946f0 typo 2020-01-13 16:25:42 +03:00
Christoph M. Becker
8ea190ba95 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
2020-01-13 13:24:12 +01:00
Christoph M. Becker
b0cdd8cc53 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
2020-01-13 13:23:12 +01:00
Christoph M. Becker
1752393bb4 Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
Column names can be numeric strings, so we have to make sure to insert
the column values with the appropriate numeric keys, instead of adding
them.
2020-01-13 13:21:45 +01:00