Compare commits

...
310 Commits
Author SHA1 Message Date
Sara Golemon 5da717d502 Update versions for PHP 8.0.7RC1 2021-05-19 17:58:53 +00:00
Sara Golemon 63998d3512 Mark for RC1 2021-05-19 17:57:54 +00:00
Sara Golemon c65a552288 Remove 8.0.8 on this branch 2021-05-19 17:51:45 +00:00
Sara Golemon 2242d15b5d Update NEWS for 8.0.8 2021-05-18 13:29:48 +00:00
Sara Golemon 122ad9c5c9 Update NEWS for PHP 8.0.7 2021-05-18 13:22:34 +00:00
Derick Rethans 6bc7370532 Merge branch 'PHP-8.0' of github.com:php/php-src into PHP-8.0 2021-05-18 13:46:04 +01:00
Derick Rethans 8cd6acd69b Merge branch 'PHP-7.4' into PHP-8.0 2021-05-18 13:45:14 +01:00
Derick Rethans 3938bfb564 The PHP 7.4 branch is now for 7.4.21 2021-05-18 13:44:01 +01:00
Máté Kocsis eedc988a4e Fix some nullable return types in ext/simplexml
Closes GH-7004
2021-05-18 14:43:36 +02:00
Christoph M. Becker 6c3896b1e9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] Removed incorrect news entry
2021-05-18 12:36:21 +02:00
Graham Campbell 66c3a174f5 [ci skip] Removed incorrect news entry
Closes GH-7007.
2021-05-18 12:34:46 +02:00
Nikita Popov 0bff67c0ab Fixed bug #81019
Before the zval -> zend_object migration, this code used macros
like FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK, which internally
clear the error. Now that they are no longer used, we need to
manually clear the error.
2021-05-17 16:33:35 +02:00
Nikita Popov c446d68f7c Fixed bug #81046
Literal compaction was incorrectly assuming that literals with
the same base literal and the same number of related literals
would be equal. Maybe that was the case historically, but at
least it isn't true in PHP 8, where FETCH_CONSTANT and INIT_METHOD
have distinct literals at the second position.

Fix this by making the cache key a concatenation of all literals,
rather than just the base literal. We still distinguish the number
of related literals based on a bias added to the string hash.
2021-05-17 15:46:49 +02:00
Máté Kocsis f0736631d9 Fix some types in ext/oci8
Closes GH-6992
2021-05-16 16:26:54 +02:00
Christoph M. Becker a75a4a4a70 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Properly push test artifacts
2021-05-16 14:46:31 +02:00
Christoph M. Becker fb86a176ba Properly push test artifacts
Cf. https://www.appveyor.com/docs/packaging-artifacts/#pushing-artifacts-from-scripts.

Closes GH-6990.
2021-05-16 14:45:06 +02:00
Kamil Tekiela 5c164a2223 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix NEWS
2021-05-14 12:34:46 +01:00
Kamil Tekiela ead72aabfb Fix NEWS 2021-05-14 12:33:32 +01:00
Kamil Tekiela 574b551567 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81037 PDO discards error message text from prepared statement
2021-05-14 11:59:36 +01:00
Kamil Tekiela 6afbb74194 Fixed bug #81037 PDO discards error message text from prepared statement 2021-05-14 11:54:49 +01:00
Christoph M. Becker c455f49a6a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81032: GD install is affected by external libgd installation
2021-05-14 12:26:40 +02:00
Flavio Heleno 28e7addb9d Fix #81032: GD install is affected by external libgd installation
This PR replaces the bundled libgd includes from #include <foo.h> with
#include "foo.h" for gd-related headers to avoid including headers that
may be available in system directories instead of the expected local
headers.

Closes GH-6975.
2021-05-14 12:24:45 +02:00
Christoph M. Becker b300c6b87f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Disable LSan for all PDO_Firebird tests
2021-05-13 23:34:37 +02:00
Christoph M. Becker f6c15e2caf Disable LSan for all PDO_Firebird tests
The tests leak memory, likely due to a slightly unclean shutdown of
libfbclient.  To avoid failing CI, we disable LSan for all the tests.

Closes GH-6966.
2021-05-13 23:30:17 +02:00
Christoph M. Becker 63c558bcbb Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #44643: bound parameters ignore explicit type definitions
2021-05-12 13:47:01 +02:00
Christoph M. Becker 23a3bbb468 Fix #44643: bound parameters ignore explicit type definitions
If `SQLDescribeParam()` fails for a parameter, we must not assume
`SQL_LONGVARCHAR` for any param which is not `PDO_PARAM_LOB`.  At least
mapping `PDO_PARAM_INT` to `SQL_INTEGER` should be safe, and not
introduce a BC break.

Closes GH-6973.
2021-05-12 13:30:51 +02:00
Dmitry Stogov e96b984026 Fixed JIT on first function execution (opcache.jit=1215) with CALL VM 2021-05-12 12:24:18 +03:00
Dmitry Stogov 6fa4493f7b Fixed incorrect stack size calculation (sizeof(zval) == 16) 2021-05-12 02:08:53 +03:00
Joe Watkins 33a93b5ed7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  missing ;
2021-05-11 11:10:52 +02:00
Joe Watkins ef3e0ee08a missing ; 2021-05-11 11:10:38 +02:00
Joe Watkins 6ccbaa12e0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  php-fpm: fix Solaris port events.mechanism
2021-05-11 11:07:47 +02:00
Joe Watkins 2558acbd66 Fixed bug #65800 php-fpm: fix Solaris port events.mechanism 2021-05-11 11:05:39 +02:00
Petr Sumbera 04078a597c php-fpm: fix Solaris port events.mechanism
Bug #65800
Fix by: rainer.jung@kippdata.de
2021-05-11 11:01:38 +02:00
Paragon Initiative Enterprises 0c57ebb116 Correct the argument names for ext/sodium functions
Closes GH-6969.
2021-05-10 17:22:02 +02:00
Nikita Popov 7fbfcfa851 Don't autoload classes during covariant type check against mixed
mixed should be behaving the same way as no type here, and not
require X to be autoloaded. Everything apart from "void" is trivially
covariant to "mixed".
2021-05-10 09:45:48 +02:00
Nikita Popov 090627048c Revert "Remove no longer used "log_errors_max_len" ini directive (#6838)"
This reverts commit d2d227e547.

This is an ABI break.
2021-05-08 20:54:53 +02:00
Ben Ramsey c2b5284734 Add entries for log_errors_max_len INI directive removal 2021-05-08 13:35:35 -05:00
Michael Voříšek d2d227e547 Remove no longer used "log_errors_max_len" ini directive (#6838) 2021-05-08 13:05:13 -05:00
Nikita Popov 1c2e7b4ea0 Fix zip build 2021-05-07 22:42:31 +02:00
Christoph M. Becker ab3052ab26 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80863: ZipArchive::extractTo() ignores references
2021-05-07 19:21:58 +02:00
Christoph M. Becker 57918b1a1b Fix #80863: ZipArchive::extractTo() ignores references
We need to cater to references, when traversing the files to extract.
While we're at it, we move the `zval_file` declaration into a narrower
scope.

Closes GH-6959.
2021-05-07 19:15:29 +02:00
Nikita Popov f547bddcc0 Update msan job to Ubuntu 20.04
Also don't explicitly specify symbolizer path. This doesn't appear
to be necessary anymore, and avoids a dependence on the specific
LLVM version used.
2021-05-07 16:28:01 +02:00
Nikita Popov af948ae24c Skip some tests under msan
These test functions which don't have msan interceptors. This
results in false positives running msan on ubuntu 20.04.
2021-05-07 16:26:49 +02:00
Máté Kocsis 54e2ef0b81 Fix return type of UConverter::fromUCallback() and UConverter::toUCallback()
Closes GH-6950
2021-05-07 15:21:58 +02:00
Máté Kocsis e8361eb0e3 Fix return type of mysqli::init() 2021-05-07 15:21:41 +02:00
Máté Kocsis a3c38c2596 Fix return type of php_user_filter::onCreate() 2021-05-07 15:21:11 +02:00
Nikita Popov 12118d592a Remove getservbyname() variation tests
These are zpp variations, which we no longer test.
2021-05-07 14:55:27 +02:00
Nikita Popov 0413cf3c20 Use SOL_TCP instead of getprotobyname() in tests
This is more idiomatic anyway, and works on msan, which misses
interceptors for getprotobyname().
2021-05-07 14:55:18 +02:00
Nikita Popov 9bf1224d07 Remove custom curl build on community job
This should no longer be necessary now that we're on Ubuntu 20.04.
2021-05-07 12:40:28 +02:00
Nikita Popov 674b884c7a Update community, coverage and file cache jobs to Ubuntu 20.04
This fixes the issue with apt, and seems like a good idea in
general. The msan job is now the only one on 18.04, but that one
needs more work.
2021-05-07 11:29:34 +02:00
Nikita Popov bcea74fd13 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix azure build
2021-05-07 10:26:59 +02:00
Nikita Popov 8deadfa31b Fix azure build
This is only needed on ubuntu-18.04, it works fine on ubuntu-20.04.
2021-05-07 10:26:04 +02:00
Christoph M. Becker fb2bf8bd58 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Add simple Firebird payload fake server to test suite
2021-05-06 14:50:22 +02:00
Christoph M. Becker f95f8a3c1e Add simple Firebird payload fake server to test suite
This is meant to test against certain fixed responses of Firebird
servers.  For now we add just a most basic test which verifies a
connection attempt.

Closes GH-6940.
2021-05-06 14:47:57 +02:00
David Carlier d87d2f006c opcache: more reliable way to get the current binary on solaris/illumos
Closes GH-6920.
2021-05-06 14:33:53 +02:00
Nikita Popov dd3e56ba24 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81015
2021-05-06 10:46:30 +02:00
Nikita Popov 178bbe3478 Fixed bug #81015
Make sure that the previous opline is part of the same block,
otherwise it may be non-dominating.

The test case does not fail on PHP-7.4, but I think the general
problem can appear on 7.4 as well, so I'm applying the patch to
that branch.
2021-05-06 10:46:00 +02:00
Nikita Popov bf9dc53435 Fixed bug #81007
Backport a change from the master branch. We usually test 32-bit
using -m32 from an x86-64 host, probably nobody tried using an
actual 32-bit host.
2021-05-05 16:53:43 +02:00
Máté KocsisandNikita Popov 068c8db276 Fix the signature of PDOStatement::fetchObject()
The ?array $ctorArgs = null parameter is changed to array $constructorArgs = [], and an additional memory leak revealed by the new test case is fixed.

Closes GH-6937

Co-Authored-By: Nikita Popov <nikita.ppv@gmail.com>
2021-05-05 16:48:22 +02:00
Christoph M. Becker 9e51b487f3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Add CONFLICTS file for PDO firebird tests
2021-05-05 15:24:58 +02:00
Nikita Popov 896e4d3428 Add CONFLICTS file for PDO firebird tests
Just in case anybody executes these test in parallel on PHP 7.4.

(cherry picked from commit b4ffe54174)

Closes GH-6943.
2021-05-05 15:24:30 +02:00
Christoph M. Becker 8294ad3295 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update version in php_version.h as well
2021-05-05 15:20:37 +02:00
Christoph M. Becker 125fc0b8d4 Update version in php_version.h as well
The version there is automatically updated during `./configure`, but
not on Windows.
2021-05-05 15:18:46 +02:00
Vincent JARDIN bb0107b63d openssl_pkcs7_read: input is data not filename
The argument should be an input string and not a filename.

Fix: https://github.com/php/doc-en/pull/559
Suggested-by: George Peter Banyard <girgias@php.net>

Closes GH-6942.
2021-05-05 09:49:53 +02:00
Sara Golemon f020d537b0 Reset for 8.0.7 2021-05-04 17:17:20 +00:00
Christoph M. Becker d1c0cbdcb1 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81011: mb_convert_encoding removes references from arrays
2021-05-04 18:39:39 +02:00
Christoph M. Becker 0cafd53d18 Fix #81011: mb_convert_encoding removes references from arrays
We need to dereference references.

Closes GH-6938.
2021-05-04 18:37:40 +02:00
Nikita Popov 398cfb982e Don't treat failed assignment as initialization
Only reset the uninitialized property flag once the type check
has succeeded. Previously the property was treated as unset rather
than uninitialized after a failed assignment.

Noticed this edge-case while working on accessors...
2021-05-04 14:46:04 +02:00
Derick Rethans 5ce0fa2129 Merge branch 'PHP-7.4' into PHP-8.0 2021-05-04 12:18:41 +01:00
Derick Rethans 0328ff49cc Reset PHP-7.4 for 7.4.20 2021-05-04 12:18:27 +01:00
Christoph M. Becker c2a06f5d9a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79100: Wrong FTP error messages
2021-05-03 15:24:17 +02:00
Christoph M. Becker 42c72ef463 Fix #79100: Wrong FTP error messages
First we need to properly clear the `inbuf`, what is an amendment to
commit d2881adcbc[1].

Then we need to report `php_pollfd_for_ms()` failures right away; just
setting `errno` does not really help, since at least in some cases it
would have been overwritten before we actually could check it.  We use
`php_socket_strerror()` to get a proper error message, and define
`ETIMEDOUT` to the proper value on Windows; otherwise we catch the
definition in errno.h, which is not compatible with WinSock.  The
proper solution for this issue would likely be to include something
like ext/sockets/windows_common.h.

Finally, we ensure that we only report warnings using `inbuf`, if it is
not empty.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=d2881adcbc9be60de7e7d45a3316b0e11b7eb1e8>.

Closes GH-6718.
2021-05-03 15:19:57 +02:00
Máté Kocsis 30d3062c9b Fix the default value of $mode in PDOStatement::fetch*()
Closes GH-6933
2021-05-03 13:06:38 +02:00
Christoph M. Becker 645815c5b7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73246: XMLReader: encoding length not checked
2021-05-03 12:29:24 +02:00
Christoph M. Becker 272df442f5 Fix #73246: XMLReader: encoding length not checked
libxml2 expects the passed encoding to be NUL terminated, so we reject
strings with NUL bytes right away.

Closes GH-6899.
2021-05-03 12:26:37 +02:00
Matteo Beccati 7bc9df4af2 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR"
2021-04-29 12:05:49 +02:00
Matteo Beccati b8e49fe872 Revert "Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR"
This reverts commit 340a06778c.
2021-04-29 11:59:16 +02:00
Nikita Popov 47bed58a53 Show used git commit in community tests
So we know exactly which revision was tested.
2021-04-29 11:03:48 +02:00
Nikita Popov 2ceef24f4a Remove incorrect func info for array_reduce() and pos()
These are both clearly not rc1 functions. As they are otherwise
UNKNOWN_INFO, I'm just dropping them entirely.
2021-04-28 11:41:21 +02:00
Nikita Popov 028dd891f9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  filter_var_array() may return array_of_ref
2021-04-28 11:27:55 +02:00
Nikita Popov 5acab7ebb4 filter_var_array() may return array_of_ref
This function preserves references in the input array.
2021-04-28 11:27:14 +02:00
Nikita Popov 220ffb90d0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  fetch_assoc may return array_key_long
2021-04-28 11:20:38 +02:00
Nikita Popov 67c4d1f5b9 fetch_assoc may return array_key_long
If the column name is a number (which is possible at least via
AS clauses), then symtable canonicalization will convert it into
an integer key.
2021-04-28 11:18:36 +02:00
Nikita Popov 76d1120a48 Remove assert_options() return value info
The ASSERT_CALLBACK value is not validated at all -- it's possible
to set it to an arbitrary value. As such, the function can also
return any value or type (even without outright abuse, the opcache
func info was wrong in that the return can be rcn, and the array
can be array_of_ref).
2021-04-28 11:05:05 +02:00
Nikita Popov af9fadc55a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  password_get_info() may return array_of_null
2021-04-28 10:55:43 +02:00
Nikita Popov c340f97ab0 password_get_info() may return array_of_null
The algo key is set to null if the algorithm can't be detected.
2021-04-28 10:54:31 +02:00
Nikita Popov 4a5bda6a8d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  getdate() may return array_key_long
2021-04-28 10:47:45 +02:00
Nikita Popov c7387ab92f getdate() may return array_key_long
This function mostly uses string keys, but the timestamp is
returned at key 0 (why???)
2021-04-28 10:46:37 +02:00
Nikita Popov 98a071e880 pg_connect() may return rcn
Without CONNECT_FORCE_NEW, pg_connect() may resuse an existing
connection and refcount may be larger than one.
2021-04-28 10:36:48 +02:00
Nikita Popov 9ce5776922 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Remove incorrect format argument
2021-04-27 22:23:06 +02:00
Nikita Popov 3f71ba2611 Remove incorrect format argument
rc is not used by the printf format.
2021-04-27 22:22:32 +02:00
Christoph M. Becker 4c80e439a8 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
2021-04-27 17:12:01 +02:00
Christoph M. Becker 7f83976200 Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
The `StrLen_or_IndPtr` parameter usually may be `SQL_NO_TOTAL`; we need
to cater to that possibility to avoid working with negative string
lengths and other issues.  A noteable exemption are calls to
`SQLGetData()` which return `SQL_SUCCESS`; in that case `SQL_NO_TOTAL`
can not occur.

Closes GH-6809.
2021-04-27 17:09:36 +02:00
Christoph M. Becker 606b2c39fc Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  7.3.29 is next
2021-04-27 16:58:32 +02:00
Christoph M. Becker 66308af539 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  7.3.29 is next
2021-04-27 16:56:53 +02:00
Christoph M. Becker 98c8ad9218 7.3.29 is next 2021-04-27 16:55:20 +02:00
Christoph M. Becker e1f8763a2c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix ./makedist wrt. to GH move
2021-04-27 15:50:54 +02:00
Christoph M. Becker 20b62ade29 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix ./makedist wrt. to GH move
2021-04-27 15:49:59 +02:00
Christoph M. BeckerandRemi Collet 096f148c61 Fix ./makedist wrt. to GH move
We can no longer export from git.php.net, and apparently exporting from
Github is not supported.  We apply a quick fix to export from the local
clone by default, still leaving an option to export from some other
repo.  This is, unfortunately, a minor BC break in a security release.

Co-authored-by: Remi Collet <remi@php.net>

Closes GH-6919.
2021-04-27 15:48:58 +02:00
Christoph M. Becker 3e518e069d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Add missing NEWS entry for #80710
2021-04-27 13:43:12 +02:00
Christoph M. Becker 12e15be921 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing NEWS entry for #80710
2021-04-27 13:41:20 +02:00
Christoph M. Becker 60a68a45c3 Add missing NEWS entry for #80710 2021-04-27 13:38:39 +02:00
Nikita Popov 7544f66da9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix build warning
2021-04-27 10:10:55 +02:00
Nikita Popov 310c0561a9 Fix build warning
This causes the build to fail on PHP-8.0 and higher.
2021-04-27 10:10:22 +02:00
Stanislav Malyshev a4d9ccbcd6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80710: imap_mail_compose() header injection
2021-04-26 21:49:38 -07:00
Stanislav Malyshev 568df31698 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80710: imap_mail_compose() header injection
2021-04-26 21:48:16 -07:00
Christoph M. Becker 37962c61d2 Fix #80710: imap_mail_compose() header injection
Like `mail()` and `mb_send_mail()`, `imap_mail_compose()` must prevent
header injection.  For maximum backward compatibility, we still allow
header folding for general headers, and still accept trailing line
breaks for address lists.
2021-04-26 21:43:03 -07:00
Stanislav Malyshev eed03fce59 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement"
2021-04-26 21:02:09 -07:00
Stanislav Malyshev 2b3346208a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Revert "Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement"
2021-04-26 21:02:03 -07:00
Stanislav Malyshev 1b88c85cd8 Revert "Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement"
Sorry, this solution seems to have BC breaks, will need to look
for better one.

This reverts commit 9f7e8b777c.
2021-04-26 21:01:25 -07:00
Stanislav Malyshev 6de2d54425 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement
2021-04-26 20:50:29 -07:00
Stanislav Malyshev 76637017ac Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement
2021-04-26 20:50:15 -07:00
Christoph M. Becker 9f7e8b777c Fix #80852: Stack-overflow when json_encode()'ing SimpleXMLElement
We ignore `XML_ENTITY_DECL` nodes when getting the hash of the
properties of a `SimpleXMLElement`.
2021-04-26 20:43:45 -07:00
Máté Kocsis d1e590fe72 Fix pg_get_notify() parameter name
Closes GH-6916
2021-04-26 19:37:41 +02:00
Christoph M. Becker 2bce26f2aa Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80901: Info leak in ftp extension
2021-04-26 15:08:44 +02:00
Christoph M. Becker c0ae3a7fb7 Fix #80901: Info leak in ftp extension
We ensure that inbuf is NUL terminated on `ftp_readline()` failure.

Closes GH-6894.
2021-04-26 15:07:08 +02:00
Christoph M. Becker bc6fc61c04 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix typo in NEWS
2021-04-26 15:03:10 +02:00
Christoph M. Becker 7f9183ce20 Fix typo in NEWS 2021-04-26 15:02:13 +02:00
Christoph M. Becker 361df6d39c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix Bug #80972: Memory exhaustion on invalid string offset
2021-04-26 14:59:18 +02:00
Christoph M. Becker 33d49551d1 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80901: Info leak in ftp extension
2021-04-26 14:45:55 +02:00
Christoph M. Becker 09696eee9d Fix #80901: Info leak in ftp extension
We ensure that inbuf is NUL terminated on `ftp_readline()` failure.

Closes GH-6894.
2021-04-26 14:23:04 +02:00
George Peter Banyard 97f8ca52fa Fix Bug #80972: Memory exhaustion on invalid string offset
Closes GH-6909
2021-04-26 13:22:12 +01:00
George Peter Banyard 418fcd22e8 Fix Bug #80972: Memory exhaustion on invalid string offset
Closes GH-6890
2021-04-26 13:21:40 +01:00
Christoph M. Becker fe219d912e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Export gzfwrite()
2021-04-26 12:12:04 +02:00
Christoph M. Becker a2771296c0 Export gzfwrite()
Extensions calling `gzfwrite()` cannot be built when linked against
php.dll (built with zlib support) otherwise.

Closes GH-6880.
2021-04-26 12:09:31 +02:00
Máté Kocsis cb84e5c332 Fix arginfo/ZPP mismatch for simplexml_import_dom
Closes GH-6905
2021-04-26 11:09:30 +02:00
Christoph M. Becker 23a192d12d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #67792: HTTP Authorization schemes are treated as case-sensitive
2021-04-23 15:57:11 +02:00
Christoph M. Becker 39ddf6b89c Fix #67792: HTTP Authorization schemes are treated as case-sensitive
We use `zend_binary_strncasecmp()` to avoid any locale issues, and
refactor.  We also add a test case for Digest authentication.

Closes GH-6900.
2021-04-23 15:54:17 +02:00
Nikita Popov b0f030509a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  PHPDBG: fix bug parsing 3-word opcodes
2021-04-22 10:12:25 +02:00
David Rans 054fad6d63 PHPDBG: fix bug parsing 3-word opcodes
PHPDBG won't parse opcodes correctly if they are more than two words
separated by underscores (as many opcodes, like ZEND_POST_INC, are).

Now opcodes that have more than one underscore (e.g. ZEND_POST_INC) are
parsed correctly.

Closes GH-6895.
2021-04-22 10:11:26 +02:00
Christoph M. Becker 3c6480552d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
2021-04-20 18:30:25 +02:00
Christoph M. Becker 1fcea24efb Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
`php_stream_can_cast()` forwards to `_php_stream_cast()` with `ret` set
to `NULL`.  `php_pgsql_fd_cast()` needs to cater to that, because
otherwise the stream would report that it is not castable.

This *might* fix https://bugs.php.net/73903.

Closes GH-6888.
2021-04-20 18:29:12 +02:00
Christoph M. Becker 0f40426450 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix misleading error message
2021-04-20 15:43:04 +02:00
Christoph M. Becker 263f14ac60 Fix misleading error message
Closes GH-6889.
2021-04-20 15:41:42 +02:00
Máté Kocsis ffb1ff371c Fix return type of SessionHandler::read() 2021-04-20 11:56:54 +02:00
Christoph M. Becker 8a7b786b7f Fix expected error message
These are slightly changed as of PHP 8.0.0.
2021-04-19 18:48:44 +02:00
Christoph M. Becker cb262cd974 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:17:01 +02:00
Christoph M. Becker ea3c992bff Fix #80960: opendir() warning wrong info when failed on Windows
Firstly, we must not forget to set appropriate error codes for "manual"
checks in `virtual_file_ex()`.

Secondly, we must not call `php_error_docref2()` for warnings regarding
unary functions; thus, we introduce `php_win32_docref1_from_error()`.

Closes GH-6872.
2021-04-19 16:12:22 +02:00
twosee d4a206b276 Backport "ignore some opcodes in the JIT check"
This is a backport of fc64a7bef4 to the PHP-8.0 branch so that extensions don’t have to bypass the JIT check in a hacky way.
2021-04-19 14:28:15 +08:00
Christoph M. Becker d918c1443e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update php_version.h
2021-04-16 17:45:41 +02:00
Christoph M. Becker 0071c7ed7e Update php_version.h 2021-04-16 17:42:29 +02:00
twosee ecc4bf14f0 Fixed bug #80958
Missing check after zval_try_get_string().

Closes GH-6871.
2021-04-16 16:17:37 +08:00
twosee 09f55604ec Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80929
2021-04-16 09:49:36 +08:00
twosee c0b1bdcdc3 Fixed bug #80929
The function name should be kept if Closure was created from the function which is marked as ZEND_ACC_CALL_VIA_TRAMPOLINE, because it is not a one-time thing and it may be called multiple times.

Closes GH-6867.
2021-04-16 09:48:36 +08:00
Nikita Popov d0fd118f9b Remove AMD64 jobs from Travis
We're only interested in the ARM64 and S390X jobs, x86 is already
extensively tested on Azure.
2021-04-15 15:16:18 +02:00
Nikita Popov 46f9fed0d8 Handle ref return from Iterator::key()
Handle this in the implementation of get_current_key of user_it,
so that the callers may assume that the key is not a reference.

Fixes oss-fuzz #33018.
2021-04-15 13:05:48 +02:00
Nikita Popov f40c8fdf67 Fix return-by-ref from array_reduce callback
Fixes oss-fuzz #32990.
2021-04-15 12:32:05 +02:00
twosee a3e6735999 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80900

# Conflicts:
#	ext/opcache/Optimizer/sccp.c
2021-04-14 00:15:06 +08:00
twosee 7c6cf09463 Fixed bug #80900
SCCP optimization marks the wrong target feasible when the constant is of the incorrect type.

Closes GH-6861.
2021-04-14 00:07:32 +08:00
Christoph M. Becker 80f921d7e0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80933: SplFileObject::DROP_NEW_LINE is broken for NUL and CR
2021-04-13 16:49:57 +02:00
Christoph M. BeckerandNikita Popov 976e71a2fa Fix #80933: SplFileObject::DROP_NEW_LINE is broken for NUL and CR
`buf` may contain NUL bytes, so we must not use `strcspn()` but rather
a binary safe variant.  However, we also must not detect a stray CR as
line ending, and since we only need to check line endings at the end
of the buffer, we can nicely optimize.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6836.
2021-04-13 16:49:06 +02:00
Levi Morrison 6fd13d0afd Fix function/file mixup in backtrace printing
The error says "Function name" is not a string, but it's actually
investigating the "file" field, not "function".

Closes GH-6768.
2021-04-13 16:33:30 +02:00
Nikita Popov ec24f14820 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix return type of sparc atomic helper
2021-04-13 14:37:18 +02:00
David Carlier 5ccb5fd91e Fix return type of sparc atomic helper
Closes GH-6808.
2021-04-13 14:36:58 +02:00
Derick Rethans f20ca94b1c Merge branch 'PHP-7.4' into PHP-8.0 2021-04-13 11:50:20 +01:00
Derick Rethans f99926f554 Put back inadvertedly removed NEWS entries 2021-04-13 11:48:50 +01:00
Gabriel Caruso 79872ac9c2 8.0.6 is the next version 2021-04-13 12:41:21 +02:00
Derick Rethans 3c06794e93 Merge branch 'PHP-7.4' into PHP-8.0 2021-04-13 11:34:55 +01:00
Derick Rethans 8e48895f48 Prepare for 7.4.19 2021-04-13 11:34:40 +01:00
Noriko Yamamoto 2ebd1c4e86 change PHP_EGG_LOGO_DATA_URI to php8 elePHPant called InPHPinity
Closes GH-6827.
2021-04-13 11:49:42 +02:00
Derick Rethans fac39fa36d Merge branch 'PHP-7.4' into PHP-8.0 2021-04-13 10:00:54 +01:00
Derick Rethans d4f7e8cedc Prepare NEWS for 7.4.18RC1 2021-04-13 10:00:45 +01:00
Nikita Popov 1395b874f4 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80950
2021-04-12 16:06:50 +02:00
Nikita Popov a1fdfa700b Fixed bug #80950
Function info for curl_exec() incorrect specified that the
function cannot return true. This is already fixed in PHP 8,
as the func info entry was removed there.
2021-04-12 16:05:37 +02:00
Nikita Popov 8effbd1cb0 PDO: Respect connection transaction state for dtor rollback
As mentioned in bug #80949, if a transaction is implicitly
committed, then PDO may still issue a ROLLBACK when the PDO
object is destroyed, as the transaction is still marked as active
in PDO's (inaccurate) transaction emulation.

Make sure we use the connection transaction state also for that
final ROLLBACK. A caveat here is that the connection might have
been dropped already, which may be the case for some drivers if
construction fails. Make sure we don't crash in that case.
2021-04-12 12:39:44 +02:00
Christoph M. Becker d74c61c133 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79812: Potential integer overflow in pcntl_exec()
2021-04-12 12:15:07 +02:00
Christoph M. Becker 0a36d417e8 Fix #79812: Potential integer overflow in pcntl_exec()
We use the proper type, and make sure that no overflow can occur by
using `safe_emalloc()` (we can assume that neither string length is
`SIZE_MAX`).

Closes GH-6845.
2021-04-12 12:12:40 +02:00
Nikita Popov 6700198d64 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Disable ifunc support on openbsd
2021-04-12 11:28:24 +02:00
David Carlier a04fac84e7 Disable ifunc support on openbsd
Enabling it leads to segfault when resolvers are used e.g.
php_stripslashes.

Closes GH-6851.
2021-04-12 11:27:50 +02:00
Rowan Tommins 4e98e65d53 Remove the "getdir" function which was introduced accidentally
The actual name of this function is dir(), but ever since it was
introduced in PHP 3, its internal name was "getdir", leading to it
being mistaken for an alias. This went unnoticed until the switch
to stubs for generating arginfo, at which point getdir() became a
real but undocumented function.

Fixes bug #80914.

Closes GH-6855.
2021-04-12 11:13:57 +02:00
Dmitry Stogov 9c6b926dae Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update zend_alloc.c
2021-04-12 09:28:41 +03:00
fishmore 600402d986 Update zend_alloc.c
Don't free main thunk.  It will crash.
2021-04-12 09:28:24 +03:00
Matteo Beccati 4f236635e7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR
2021-04-12 08:05:41 +02:00
Matteo Beccati 340a06778c Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR 2021-04-12 08:03:07 +02:00
Matteo Beccati 7f4784c1c9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Increased test compatibility
2021-04-11 17:32:13 +02:00
Matteo Beccati da3a807f22 Increased test compatibility
The test expects no masked signals at the beginning, but when run as part
of a Bamboo build, SIGQUIT is already masked and the test fails.
2021-04-11 17:19:58 +02:00
Nikita Popov 26d417d758 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix gidlist allocation leak on error
2021-04-11 10:38:07 +02:00
Nikita Popov 454d297564 Fix gidlist allocation leak on error 2021-04-11 10:37:40 +02:00
Dmitry Stogov 61e385a358 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed type inference for OP_DATA
2021-04-09 14:53:34 +03:00
Dmitry Stogov 7a8ffcec7d Fixed type inference for OP_DATA 2021-04-09 14:52:55 +03:00
Nikita Popov 332a367538 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Don't mark non-refcounted phi as live
2021-04-08 18:21:00 +02:00
Nikita Popov 29fa4d203a Don't mark non-refcounted phi as live
If the value is not refcounted, then it doesn't matter if the
FREE gets dropped.
2021-04-08 18:20:09 +02:00
Nikita Popov 59b2a899ca Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix DCE of FREE of COALESCE
2021-04-08 17:01:19 +02:00
Nikita Popov 0826a54836 Fix DCE of FREE of COALESCE
When encountering the following SSA graph:

    BB1:
    #2.T1 [string] = COALESCE #1.CV0($str) [null, string] BB2

    BB2:
    #5.T1 [string] = QM_ASSIGN string("")

    BB3:
    #7.X1 [string] = Phi(#2.X1 [string], #5.X1 [string])
    FREE #7.T1 [string]

We would currently determine that #7, #5 are dead, and eliminate
the FREE and QM_ASSIGN. However, we cannot eliminate #2, as
COALESCE is also responsible for control flow.

Fix this my marking all non-CV phis as live to start with. This
can be relaxed to check the kind of the source instruction, but
I couldn't immediately come up with a case where it would be
useful.
2021-04-08 17:01:13 +02:00
Remi Collet f421ebc056 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Improve fix for #80783
2021-04-08 15:28:29 +02:00
Remi Collet 25f5a1b2e1 Improve fix for #80783 2021-04-08 15:28:03 +02:00
Nikita Popov 032905b5a0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Support more than NGROUPS_MAX groups on macos
2021-04-08 12:25:16 +02:00
Nikita Popov eebcfeb68e Support more than NGROUPS_MAX groups on macos
I suspect this is the cause for our recent CI failures. Apparently,
on macos it is possible for getgroups() to return more than
NGROUPS_MAX groups. We avoid an EINVAL in that case by fetching
the exact number of groups in advance. This should work on both
macos and posix systems.
2021-04-08 12:23:39 +02:00
Christoph M. Becker ba6714a200 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update version in main/php_version.h as well
2021-04-07 12:52:44 +02:00
Christoph M. Becker 0a181ca27a Update version in main/php_version.h as well
Otherwise the file is modified by each new build, what is confusing.
2021-04-07 12:45:21 +02:00
Christoph M. Becker de9734a5bb Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80880: SSL_read on shutdown, ftp/proc_open
2021-04-06 14:07:25 +02:00
Christoph M. Becker 9688071679 Fix #80880: SSL_read on shutdown, ftp/proc_open
When `SSL_read()` after `SSL_shutdown()` fails with `SSL_ERROR_SYSCALL`,
we should not warn about this, because it is likely caused by the peer
having closed the connection without having sent a close_notify
shutdown alert.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6803.
2021-04-06 14:03:19 +02:00
Nikita Popov 304190c49d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  .gdbinit: make zbacktrace show the correct stack when switching threads
2021-04-05 21:11:19 +02:00
Dylan K. Taylor 50f476591f .gdbinit: make zbacktrace show the correct stack when switching threads
I found this mainly to be a problem when working with threading
extensions. zbacktrace doesn't show the correct stack when switching
threads.

Closes GH-6814.
2021-04-05 21:10:52 +02:00
Dmitry Stogov e0996decc3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
2021-03-31 13:11:11 +03:00
Dmitry Stogov 39d8fc1edc Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
Old registers (r28/r29) might be clobbered by _restgpr routine used for return from C function compiled with -Os.
2021-03-31 13:10:21 +03:00
Christoph M. Becker 443478109b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle reference zvals when outputting superglobals in phpinfo()

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-30 13:52:38 +02:00
Rowan Tommins 206fd35a98 Handle reference zvals when outputting superglobals in phpinfo()
Fixes <https://bugs.php.net/80915>.

Closes GH-80915.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-30 13:49:22 +02:00
Nikita Popov b95b553489 Remove zero size special case for copy_to_stream
This doesn't seem to serve a purpose anymore. Stats are expensive,
so doing an unnecessary stat just to short-circuit the zero size
case is rather dubious. It can also break with stream wrappers
that return inaccurate sizes (symfony/symfony#40574) and probably
can also break with stream filters.

Drop the special case and adjust code to make it more obvious that
it will still be handled correctly.

Closes GH-6807.
2021-03-29 15:21:59 +02:00
Christoph M. Becker dd227f61df Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #69668: SOAP special XML characters in namespace URIs not encoded

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-29 14:19:39 +02:00
Christoph M. Becker 75cb678206 Fix #69668: SOAP special XML characters in namespace URIs not encoded
`xmlNewNs()` does not XML encode the passed `href`, so we need to do
that manually.

Closes GH-6804.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-29 14:17:55 +02:00
Máté Kocsis d7ae64627f Fix PDOStatement::bindColumn() parameter default value 2021-03-25 19:31:04 +01:00
Dmitry Stogov 6800f0a3c2 XFAIL on WIN64 because of problem in libffi
(cherry picked from commit 6689bedd17)
2021-03-24 13:57:31 +01:00
Christoph M. Becker 5832be768c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
2021-03-24 11:52:54 +01:00
Christoph M. Becker 498eb8e052 Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
A string passed to `php_libxml_xmlCheckUTF8()` may be longer than
1<<31-1 bytes, so we're better using a `size_t`.

Closes GH-6802.
2021-03-24 11:50:50 +01:00
Christoph M. Becker 733b514326 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Properly initialize PS(mod) on RINIT
2021-03-23 13:13:43 +01:00
Christoph M. Becker 688e56d0ac Properly initialize PS(mod) on RINIT
We need to do that in case a user handler has been set.  However, we
can't do that in `php_rinit_session_globals()` since that function is
called by PHP function `session_destroy()` too, but in that case we
don't want to reset PS(mod).

Closes GH-6795.
2021-03-23 13:12:19 +01:00
Christoph M. Becker 90be86fc91 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80889: amendment
2021-03-22 22:49:46 +01:00
Christoph M. Becker 838951c2d6 Fix #80889: amendment
`session_set_save_handler()` may be called with callables instead of an
object; we need to cater to that as well.

We also extract a set_user_save_handler_ini() function to avoid code
duplication.

Closes GH-6796.
2021-03-22 22:17:35 +01:00
Jakub Zelenka 4dca1140cf Merge branch 'PHP-7.4' into PHP-8.0 2021-03-21 21:21:05 +00:00
Jakub Zelenka bc7ea73da5 Use ServerClientTestCase in a test for default_socket_timeout=-1 2021-03-21 21:19:40 +00:00
Jakub Zelenka 713b82131b Merge branch 'PHP-7.4' into PHP-8.0 2021-03-21 19:00:38 +00:00
Jakub Zelenka 538f95b1b7 Fix NEWS entry position for the latest FPM fix 2021-03-21 18:58:57 +00:00
Jakub Zelenka c483b59124 Fix bug #80024: Duplication of info about inherited socket after pool removing 2021-03-21 18:52:07 +00:00
Christoph M. Becker 2a1ed81ffc Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80889: Cannot set save handler when save_handler is invalid
2021-03-19 17:03:54 +01:00
Christoph M. Becker 06bfada99b 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.

Closes GH-6788.
2021-03-19 16:59:54 +01:00
Christoph M. Becker 97cfdcd73b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
2021-03-18 15:18:53 +01:00
Christoph M. Becker bccca0b53a 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.

Closes GH-6716.
2021-03-18 15:13:27 +01:00
Dmitry Stogov 465cfc499b Additional fix for bug #80847.
On x86_64 part of structure may be passed in CPU registers.
2021-03-18 16:13:42 +03:00
Nikita Popov 4dce2f83f5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix locale switch back to C in pcre
2021-03-18 10:50:57 +01:00
Nikita Popov 4be867e910 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.
2021-03-18 10:48:43 +01:00
Dmitry Stogov 7e494d9225 Fixed bug #80861 (erronous array key overflow in 2D array with JIT) 2021-03-17 22:59:59 +03:00
Nikita Popov 34e39ebaf5 Fix signed/unsigned warnings in PDO ODBC
Add add skipif to test.

(cherry picked from commit aa58db7232)
2021-03-17 16:33:32 +01:00
Nikita Popov d80118dc16 imagecolortransparent() cannot return null 2021-03-17 15:09:06 +01:00
Nikita Popov c17434429d Return bool from imageinterlace()
The function accepts a bool since PHP 8.0, so it should also return
a bool to keep things consistent.

Furthermore a null return from this functions is not possible.
2021-03-17 15:05:09 +01:00
Dmitry Stogov faf1567212 Fixed bug #80839 (PHP problem with JIT) 2021-03-17 16:55:09 +03:00
Christoph M. Becker fddd0ac552 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #66783: UAF when appending DOMDocument to element
2021-03-17 12:40:03 +01:00
Christoph M. Becker a08847ab39 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.

[1] <https://dom.spec.whatwg.org/#node-trees>
[2] <https://dom.spec.whatwg.org/#mutation-algorithms>

Closes GH-6765.
2021-03-17 12:37:18 +01:00
Christoph M. Becker c7fadd2328 8.0.5 is next
We also move the NEWS entry for bug 80847 to the proper version.
2021-03-17 12:14:26 +01:00
Dmitry Stogov 38ebb55c7c Fixed bug #80847 (CData structs with fields of type struct can't be passed as C function argument) 2021-03-17 09:55:20 +03:00
Nikita Popov 82622d7583 Fix refcount inference for typed properties
We were not adding RC1/RCN if the MAY_BE_OBJECT came from a class
type and there was no other refcounted type in the union.
2021-03-16 11:17:18 +01:00
Derick Rethans c2ff964de0 Merge branch 'PHP-7.4' into PHP-8.0 2021-03-16 09:41:40 +00:00
Derick Rethans 4adc08a403 Fix build version too 2021-03-16 09:41:21 +00:00
Derick Rethans 7dbe27222c Merge branch 'PHP-7.4' into PHP-8.0 2021-03-16 09:40:21 +00:00
Derick Rethans 5e4ee3d0bd NEWS for 7.4.18 2021-03-16 09:40:05 +00:00
Derick Rethans eb1d1fe373 Prepare for 7.4.17RC1 2021-03-16 09:33:33 +00:00
Máté Kocsis 465aa1d38f Fix ldap_next_entry() parameter name 2021-03-16 09:31:46 +01:00
Máté Kocsis b03438ba3a Fix crash in LDAP search functions during argument validation 2021-03-16 09:31:37 +01:00
Máté Kocsis 5ecc078a17 Add missing skipif sections to ext/dom tests 2021-03-15 23:45:37 +01:00
Christoph M. Becker eae69fcf71 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80817: dba_popen() may cause segfault during RSHUTDOWN
2021-03-15 18:39:26 +01:00
Christoph M. Becker f448b0e6dd Fix #80817: dba_popen() may cause segfault during RSHUTDOWN
We need to close persistent streams with the proper flag.
2021-03-15 18:37:44 +01:00
Nikita Popov 50254de0a2 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #80866
2021-03-15 14:48:02 +01:00
Dharman 282355efd5 Fix bug #80866
Closes GH-6774.
2021-03-15 14:47:45 +01:00
Nikita Popov 6493b516f9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #80837
2021-03-15 14:38:49 +01:00
Dharman c93b461ad7 Fix bug #80837
The error needs to be reported on the statement, not the connection.
2021-03-15 14:38:09 +01:00
Nikita Popov 3306baca50 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update ubuntu on i386 job
  Downgrade security level in tests using TLS < 1.2
2021-03-15 14:12:42 +01:00
Nikita Popov fc4cd598a2 Update ubuntu on i386 job
There is a failure with apt on PHP-7.4 that's not present on
PHP-8.0/master. Switching to a newer ubuntu version on PHP-7.4
avoids the issue.
2021-03-15 14:11:19 +01:00
Nikita Popov 703bbf5210 Downgrade security level in tests using TLS < 1.2
A few additional tests have been added on master that require
lower security level.

(cherry picked from commit c2a6395dcb)
2021-03-15 14:11:12 +01:00
Michael Heimpold eaf9421df6 ext/opcache: fix configure output while checking mmap MAP_ANON support
It seems that f3efb9e3fb introduced a "typo" which may result
in the following confusing message:

checking for mmap() using MAP_ANON shared memory support... no=yes

Let's fix this.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>

Closes GH-6758.
2021-03-15 10:52:57 +01:00
Dmitry Stogov 3b377b51a2 Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space available for static Thread Local Storage) 2021-03-10 16:03:47 +03:00
Christoph M. Becker 7931956805 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #51903: simplexml_load_file() doesn't use HTTP headers
2021-03-08 15:15:59 +01:00
Christoph M. BeckerandMichael Wallner f901bec494 Fix #51903: simplexml_load_file() doesn't use HTTP headers
The `encoding` attribute of the XML declaration is optional; it is good
practice to use external encoding information where available if it is
missing.  Thus, we check for `charset` info of `Content-Type` headers,
and see whether the encoding is supported.

We cater to trailing parameters and quoted-strings, but not to escaped
backslashes and quotes in quoted-strings, since no known character
encoding contains these anyway.

Co-authored-by: Michael Wallner <mike@php.net>

Closes GH-6747.
2021-03-08 15:07:01 +01:00
Christoph M. Becker 3880b8785b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80838: HTTP wrapper waits for HTTP 1 response after HTTP 101
2021-03-08 14:51:45 +01:00
manuel 5787f91c55 Fix #80838: HTTP wrapper waits for HTTP 1 response after HTTP 101
Don't wait for further responses after a HTTP 101 (Switching Protocols) response

Closes GH-6730.
2021-03-08 14:36:31 +01:00
Máté Kocsis 0f8312342f Fix the error message of attribute flag validation 2021-03-06 00:56:25 +01:00
George Wang 8462a3de1a Merge branch 'PHP-7.4' into PHP-8.0 2021-03-05 11:00:53 -05:00
George Wang 8fc0bdfb0a Merge branch 'PHP-7.4' of git.php.net:php-src into PHP-7.4 2021-03-05 10:57:46 -05:00
George Wang 797edd6211 LiteSpeed SAPI v7.9: Process manager keeps forked child process alive for longer time based on load. Reduces PM overhead for busy setup. 2021-03-05 10:46:12 -05:00
David Carlier ae23852e41 Add supports for FreeBSD's PROT_MAX to let mprotect knows X flag can be applied in addition.
Closes GH-6738.
2021-03-05 16:44:08 +01:00
Christoph M. Becker 1c16749eaa Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Print error code if CreateMutex() fails
2021-03-05 15:08:24 +01:00
Christoph M. Becker e0e167e581 Print error code if CreateMutex() fails
This issue came up recently in a bug report[1]; without the error code,
users can barely guess why the function failed.

[1] <https://bugs.php.net/80812>

Closes GH-6745.
2021-03-05 15:06:18 +01:00
Dmitry Stogov 187ba4353a Fix ASAN warning (Zend/zend_string.h:165:2: runtime error: null pointer passed as argument 2 of memcpy(), which is declared to never be null) 2021-03-04 17:27:26 +03:00
Christoph M. Becker 4f478af16d Fix #80825: ZipArchive::isCompressionMethodSupported does not exist
`HAVE_METHOD_SUPPORTED` should have been defined after we updated to
libzip 1.7.1 months ago.
2021-03-03 22:56:42 +01:00
Christoph M. Becker 303a4ae44a Fix test wrt. server.inc changes 2021-03-03 12:04:06 +01:00
Christoph M. Becker 90b24401d6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78719: http wrapper silently ignores long Location headers
2021-03-03 10:47:51 +01:00
Christoph M. Becker 51e2015af3 Fix #78719: http wrapper silently ignores long Location headers
When opening HTTP streams, and reading the headers, we currently
discard header lines longer than `HTTP_HEADER_BLOCK_SIZE` (1024 bytes).
While this is not generally forbidden by RFC 7230, section 3.2.5, it
is not generally allowed either, since that may change the "message
framing or response semantics".

We thus fix this by allowing arbitrarily long header lines.

Closes GH-6720.
2021-03-03 10:45:25 +01:00
Dmitry Stogov 957cb13a49 Fixed bug #80802: (zend_jit_fetch_indirect_var assert failure with tracing JIT) 2021-03-01 23:57:20 +03:00
Christoph M. Becker 37c9728615 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80751: Comma in recipient name breaks email delivery
2021-03-01 18:50:11 +01:00
Christoph M. BeckerandNikita Popov 71297a254b Fix #80751: Comma in recipient name breaks email delivery
So far, `SendText()` simply separates potential email address lists at
any comma, disregarding that commas inside a quoted-string do not
delimit addresses.  We fix that by introducing an own variant of
`strtok_r()` which caters to quoted-strings.

We also make `FormatEmailAddress()` aware of quoted strings.

We do not cater to email address comments, and potentially other quirks
of RFC 5322 email addresses, but catering to quoted-strings is supposed
to solve almost all practical use cases.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6735.
2021-03-01 18:46:21 +01:00
Nikita Popov 75a4f484f0 Fixed bug #80811
When filling in defaults for skipped params, make sure that
reference parameters get the expected reference wrapper.
2021-03-01 16:30:01 +01:00
Nikita Popov 5875bf754e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Always remove HT iterators, even for uninit HT
2021-03-01 16:22:29 +01:00
Nikita Popov 2c508c4d40 Always remove HT iterators, even for uninit HT
Fixes oss-fuzz #31423.
2021-03-01 16:22:11 +01:00
Nikita Popov 2c182a77f7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80805
2021-03-01 15:13:25 +01:00
Nikita Popov e857936518 Fixed bug #80805
Handle missing result_var in binary_op_result_type.

(cherry picked from commit 8446e28275)
2021-03-01 15:13:15 +01:00
George Peter Banyard 1ee6aad248 Fix Bug #80800 imap_open() fails when the flags parameter includes CL_EXPUNGE
This also affected imap_reopen().
Add a supplementary test that the CL_EXPUNGE flag does have
the intended effect.

Closes GH-6732
2021-02-27 13:12:22 +00:00
Felipe Pena 8813f2e0c3 Merge branch 'PHP-7.4' into PHP-8.0 2021-02-25 20:54:24 +00:00
Felipe Pena 988c3f9659 Fix memleak on ReflectionFunction and ReflectionGenerator classes when calling __construct after instantiation 2021-02-25 20:53:14 +00:00
Remi Collet 18071aaa08 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  skip test with openssl < 1.1.0
2021-02-25 13:54:19 +01:00
Remi Collet ae0585c98e skip test with openssl < 1.1.0
The test fails, but without any crash
(this test is designed to catch a crash)
2021-02-25 13:52:35 +01:00
Christoph M. Becker fb683030bf Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Capture Microsoft-defined HRESULT exit codes exit codes
2021-02-25 12:03:43 +01:00
Dylan K. Taylor a480bf8093 Capture Microsoft-defined HRESULT exit codes exit codes
The lack of such a check leads to false-passes of tests on Windows
which expect no output, but produce a segfault or similar issue. I
discovered this a while ago due to bad tests in an extension I maintain.

Closes GH-6722.
2021-02-25 12:01:04 +01:00
David CARLIER ddea5c0816 crc32 module, clang spurious warning removal.
Closes GH-6725.
2021-02-25 10:17:21 +01:00
Nikita Popov f06efce387 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  mysqlnd pam fix test error message
2021-02-25 09:52:07 +01:00
Daniel Black 8309c04464 mysqlnd pam fix test error message
Closes GH-6727.
2021-02-25 09:51:51 +01:00
Nikita Popov 44ef32ff2c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix potential file collision in dom tests
2021-02-24 21:30:44 +01:00
Nikita Popov 766f827e26 Fix potential file collision in dom tests 2021-02-24 21:30:20 +01:00
Felipe Pena aaea81de7c Merge branch 'PHP-7.4' into PHP-8.0 2021-02-24 19:07:22 +00:00
Felipe Pena 3ec37a74a2 Fix bug #80757 (Exit code is 0 when could not open file) 2021-02-24 18:50:27 +00:00
Felipe Pena 78b0a85de6 Update NEWS 2021-02-24 18:40:32 +00:00
Dmitry Stogov b7fa5268e4 Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1) 2021-02-24 12:20:20 +03:00
Christoph M. Becker 8162c3d1fd Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  run-tests: fixed exit code not being set on BORKED tests
2021-02-23 13:22:50 +01:00
Christoph M. Becker 67bb06cc9b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  run-tests: fixed exit code not being set on BORKED tests
2021-02-23 13:15:30 +01:00
Dylan K. Taylor 729cd8bacd run-tests: fixed exit code not being set on BORKED tests
When no test paths are specified this shows up when 'make test' is used on a PECL extension without specifying tests to run (or in php-src too, I guess...)

Closes GH-6717.
2021-02-23 12:50:03 +01:00
Christoph M. Becker 3f282e57ec Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Update php_version.h to proper version number
2021-02-23 12:16:15 +01:00
Christoph M. Becker 81396ea890 Update php_version.h to proper version number 2021-02-23 12:09:06 +01:00
Nikita Popov 79cf2c56d3 Fixed bug #80786
Don't use r0 as temporary register in math_double_long if it is
already used for a memory result.

This was already done in one branch, but not the other.
2021-02-23 10:22:00 +01:00
Christoph M. Becker b418fe266d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #75776: Flushing streams with compression filter is broken
2021-02-22 15:32:17 +01:00
Christoph M. Becker 963e50c8c4 Fix #75776: Flushing streams with compression filter is broken
First, the `bzip2.compress` filter has the same issue as `zlib.deflate`
so we port the respective fix[1] to ext/bz2.

Second, there is still an issue, if a stream with an attached
compression filter is flushed before it is closed, without any writes
in between.  In that case, the compression is never finalized.  We fix
this by enforcing a `_php_stream_flush()` with the `closing` flag set
in `_php_stream_free()`, whenever a write filter is attached.  This
call is superfluous for most write filters, but does not hurt, even
when it is unnecessary.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=20e75329f2adb11dd231852c061926d0e4080929>

Closes GH-6703.
2021-02-22 15:28:46 +01:00
Christoph M. Becker 1d2bbce532 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
2021-02-22 14:34:21 +01:00
Christoph M. Becker 073b6ea818 Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
There is no good reason not to show the credits in text based SAPIs,
except for brevity.  Thus, we suppress the credits from `php -i`.

Closes GH-6710.
2021-02-22 14:31:51 +01:00
Christoph M. Becker 6dcd640f35 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80774: session_name() problem with backslash
2021-02-22 12:35:23 +01:00
Christoph M. Becker d7c98ca1ac Fix #80774: session_name() problem with backslash
Since we do no longer URL decode cookie names[1], we must not URL
encode the session name.  We need to prevent broken Set-Cookie headers,
by rejecting names which contain invalid characters.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=6559fe912661ca5ce5f0eeeb591d928451428ed0>

Closes GH-6711.
2021-02-22 12:32:56 +01:00
Nikita Popov ab98944195 Fix trampoline leak on dynamic static call of non-static method
Fixes oss-fuzz #30317.
2021-02-22 10:32:59 +01:00
Nikita Popov ed4f90f0c7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80781
2021-02-22 09:38:34 +01:00
Nikita Popov 6dd85f83f7 Fixed bug #80781
zend_find_array_dim_slow() may throw, make sure to handle this.
This backports the code we already use for this on PHP-8.0,
and also backports an exception check that makes this easier to
catch.
2021-02-22 09:36:43 +01:00
Nikita Popov 85ffe8dcdc Avoid signed integer overflow in substr()
Perform negation after the (size_t) cast rather than before,
so as to avoid a signed integer overflow for PHP_INT_MIN.

Fixes oss-fuzz #31069.
2021-02-18 10:34:54 +01:00
Christoph M. Becker 553a0c52b1 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80763: msgfmt_format() does not accept DateTime references
2021-02-17 17:30:47 +01:00
Christoph M. Becker 84b6152842 Fix #80763: msgfmt_format() does not accept DateTime references
`intl_zval_to_millis()` needs to cater to references.

Closes GH-6707.
2021-02-17 17:26:48 +01:00
Nikita Popov cbdd21a22d Color LEAK&FAIL like a failure 2021-02-17 16:40:19 +01:00
Sara Golemon 8c6db654e7 Prep for 8.0.4 2021-02-17 15:24:43 +00:00
266 changed files with 3770 additions and 907 deletions

No files matched your search

+1 -3
View File
@@ -11,9 +11,7 @@ end
define ____executor_globals
if basic_functions_module.zts
if !$tsrm_ls
set $tsrm_ls = ts_resource_ex(0, 0)
end
set $tsrm_ls = _tsrm_ls_cache
set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1])
set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
set $eg_ptr = $eg
-6
View File
@@ -68,12 +68,6 @@ env:
jobs:
include:
- env: ENABLE_ZTS=0 ENABLE_DEBUG=0
arch: amd64
if: type = cron
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1
arch: amd64
if: type = cron
- env: ENABLE_ZTS=1 ENABLE_DEBUG=1 SKIP_IO_CAPTURE_TESTS=1 ARM64=1
arch: arm64
if: type = cron
+172 -2
View File
@@ -1,6 +1,177 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2021, PHP 8.0.3
20 May 2021, PHP 8.0.7RC1
- Core:
. Fixed bug #80960 (opendir() warning wrong info when failed on Windows).
(cmb)
. Fixed bug #67792 (HTTP Authorization schemes are treated as case-sensitive).
(cmb)
. Fixed bug #80972 (Memory exhaustion on invalid string offset). (girgias)
- FPM:
. Fixed bug #65800 (Events port mechanism). (psumbera)
- FTP:
. Fixed bug #80901 (Info leak in ftp extension). (cmb)
. Fixed bug #79100 (Wrong FTP error messages). (cmb)
- GD:
. Fixed bug #81032 (GD install is affected by external libgd installation).
(Flavio Heleno, cmb)
- Intl:
. Fixed bug #81019 (Unable to clone NumberFormatter after failed parse()).
(Nikita)
- MBString:
. Fixed bug #81011 (mb_convert_encoding removes references from arrays). (cmb)
- ODBC:
. Fixed bug #80460 (ODBC doesn't account for SQL_NO_TOTAL indicator). (cmb)
- Opcache:
. Fixed bug #81007 (JIT "not supported" on 32-bit x86 -- build problem?).
(Nikita)
. Fixed bug #81015 (Opcache optimization assumes wrong part of ternary
operator in if-condition). (Nikita)
. Fixed bug #81046 (Literal compaction merges non-equal related literals).
(Nikita)
- PDO_MySQL:
. Fixed bug #81037 (PDO discards error message text from prepared
statement). (Kamil Tekiela)
- PDO_ODBC:
. Fixed bug #44643 (bound parameters ignore explicit type definitions). (cmb)
- pgsql:
. Fixed php_pgsql_fd_cast() wrt. php_stream_can_cast(). (cmb)
- SPL:
. Fixed bug #80933 (SplFileObject::DROP_NEW_LINE is broken for NUL and CR).
(cmb, Nikita)
- XMLReader:
. Fixed bug #73246 (XMLReader: encoding length not checked). (cmb)
- Zip:
. Fixed bug #80863 (ZipArchive::extractTo() ignores references). (cmb)
06 May 2021, PHP 8.0.6
- PDO_pgsql:
. Revert "Fixed bug #80892 (PDO::PARAM_INT is treated the same as PDO::PARAM_STR)"
from PHP 8.0.5.
29 Apr 2021, PHP 8.0.5
- Core:
. Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
Old registers (r28/r29) might be clobbered by _restgpr routine used for
return from C function compiled with -Os. (Dmitry)
- DOM:
. Fixed bug #66783 (UAF when appending DOMDocument to element). (cmb)
- FFI:
. Fixed bug #80847 (CData structs with fields of type struct can't be passed
as C function argument). (Nickolas Daniel da Silva, Dmitry)
- FPM:
. Fixed bug #80024 (Duplication of info about inherited socket after pool
removing). (Jakub Zelenka)
- FTP:
. Fixed bug #80880 (SSL_read on shutdown, ftp/proc_open). (cmb, Jakub
Zelenka)
- Imap:
. Fixed bug #80710 (imap_mail_compose() header injection). (cmb, Stas)
- LibXML:
. Fixed bug #73533 (Invalid memory access in php_libxml_xmlCheckUTF8). (cmb)
- Opcache:
. Fixed bug #80839 (PHP problem with JIT). (Dmitry)
. Fixed bug #80861 (erronous array key overflow in 2D array with JIT).
(Dmitry)
- Pcntl:
. Fixed bug #79812 (Potential integer overflow in pcntl_exec()). (cmb)
- PDO_ODBC:
. Fixed bug #80783 (PDO ODBC truncates BLOB records at every 256th byte).
(cmb)
- PDO_pgsql:
. Fixed bug #80892 (PDO::PARAM_INT is treated the same as PDO::PARAM_STR).
(Matteo)
- Session:
. Fixed bug #80889 (Cannot set save handler when save_handler is invalid).
(cmb)
- SOAP:
. Fixed bug #69668 (SOAP special XML characters in namespace URIs not
encoded). (cmb)
- Standard:
. Fixed bug #80915 (Taking a reference to $_SERVER hides its values from
phpinfo()). (Rowan Tommins)
. Fixed bug #80914 ('getdir' accidentally defined as an alias of 'dir').
(Rowan Tommins)
01 Apr 2021, PHP 8.0.4
- Core:
. Fixed bug #75776 (Flushing streams with compression filter is broken). (cmb)
. Fixed bug #80811 (Function exec without $output but with $restult_code
parameter crashes). (Nikita)
. Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space
available for static Thread Local Storage). (Dmitry)
- Dba:
. Fixed bug #80817 (dba_popen() may cause segfault during RSHUTDOWN). (cmb)
- IMAP:
. Fixed bug #80800 (imap_open() fails when the flags parameter includes
CL_EXPUNGE). (girgias)
- Intl:
. Fixed bug #80763 (msgfmt_format() does not accept DateTime references).
(cmb)
- Libxml:
. Fixed bug #51903 (simplexml_load_file() doesn't use HTTP headers). (cmb)
- MySQLnd:
. Fixed bug #80837 (Calling stmt_store_result after fetch doesn't throw an
error). (Kamil Tekiela)
- Opcache:
. Fixed bug #80786 (PHP crash using JIT). (Nikita)
. Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1). (Dmitry)
- PCRE:
. Fixed bug #80866 (preg_split ignores limit flag when pattern with \K has
0-width fullstring match). (Kamil Tekiela)
- Session:
. Fixed bug #80774 (session_name() problem with backslash). (cmb)
- Standard:
. Fixed bug #80771 (phpinfo(INFO_CREDITS) displays nothing in CLI). (cmb)
. Fixed bug #78719 (http wrapper silently ignores long Location headers).
(cmb)
. Fixed bug #80838 (HTTP wrapper waits for HTTP 1 response after HTTP 101).
(manuelm)
- Zip:
. Fixed bug #80825 (ZipArchive::isCompressionMethodSupported does not exist).
(cmb)
18 Feb 2021, PHP 8.0.3
- Core:
. Fixed #80706 (mail(): Headers after Bcc headers may be ignored). (cmb)
@@ -598,4 +769,3 @@ PHP NEWS
. Fixed bug #71417 (fread() does not report zlib.inflate errors). (cmb)
. Fixed bug #78792 (zlib.output_compression disabled by Content-Type: image/).
(cmb)
+2 -2
View File
@@ -729,13 +729,13 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
#if defined(__APPLE__) && defined(__x86_64__)
// TODO: Implement support for fast JIT ZTS code ???
return 0;
#elif defined(__x86_64__) && defined(__GNUC__)
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(__FreeBSD__)
size_t ret;
asm ("movq _tsrm_ls_cache@gottpoff(%%rip),%0"
: "=r" (ret));
return ret;
#elif defined(__i386__) && defined(__GNUC__)
#elif defined(__i386__) && defined(__GNUC__) && !defined(__FreeBSD__)
size_t ret;
asm ("leal _tsrm_ls_cache@ntpoff,%0"
+1 -1
View File
@@ -147,7 +147,7 @@ TSRM_API const char *tsrm_api_name(void);
# define __has_attribute(x) 0
#endif
#if !__has_attribute(tls_model)
#if !__has_attribute(tls_model) || defined(__FreeBSD__)
# define TSRM_TLS_MODEL_ATTR
#elif __PIC__
# define TSRM_TLS_MODEL_ATTR __attribute__((tls_model("initial-exec")))
@@ -0,0 +1,15 @@
--TEST--
HT iterator should be destroyed if array becomes empty during array_splice
--FILE--
<?php
$a=[4];
$i = 0;
foreach ($a as &$r) {
var_dump($r);
$a = array_splice($a, 0);
if (++$i == 2) break;
}
?>
--EXPECT--
int(4)
int(4)
@@ -8,4 +8,4 @@ class A1 { }
?>
--EXPECTF--
Fatal error: Attribute::__construct(): Argument #1 ($flags) must must be of type int, string given in %s
Fatal error: Attribute::__construct(): Argument #1 ($flags) must be of type int, string given in %s
+2 -1
View File
@@ -35,11 +35,12 @@ try {
}
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
try {
/* This must not affect the string value */
$simpleString["wrong"] = "f";
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
echo $simpleString["0"] === "f"?"ok\n":"bug\n";
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
?>
--EXPECTF--
bool(false)
+1 -1
View File
@@ -58,7 +58,7 @@ Warning: Illegal string offset -1 in %s on line %d
NULL
string(0) ""
Cannot access offset of type string on string
string(1) "a"
string(0) ""
Error: [] operator not supported for strings
string(0) ""
Error: Cannot use assign-op operators with string offsets
+2 -2
View File
@@ -39,7 +39,7 @@ string(36) "#0 [internal function]: ()
Array of array of NULL values:
Warning: Function name is not a string in %s on line %d
Warning: File name is not a string in %s on line %d
Warning: Value for class is not a string in %s on line %d
@@ -48,5 +48,5 @@ Warning: Value for type is not a string in %s on line %d
Warning: Value for function is not a string in %s on line %d
Warning: args element is not an array in %s on line %d
string(60) "#0 [unknown function][unknown][unknown][unknown]()
string(58) "#0 [unknown file]: [unknown][unknown][unknown]()
#1 {main}"
+31
View File
@@ -0,0 +1,31 @@
--TEST--
Bug #80781: Error handler that throws ErrorException infinite loop
--FILE--
<?php
function handle(int $severity, string $message, string $file, int $line): bool {
if((error_reporting() & $severity) !== 0) {
throw new \ErrorException($message, 0, $severity, $file, $line);
}
return true; // stfu operator
}
set_error_handler('handle');
function getPlugin(string $plugin) : bool{
return false;
}
$data = [];
$array = [];
if (isset($array[$data]) or getPlugin($data)) {
}
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #80811: Function exec without $output but with $restult_code parameter crashes
--FILE--
<?php
echo 'Executing with all params:' . PHP_EOL;
exec('echo Something', output: $output, result_code: $resultCode);
var_dump($resultCode);
echo 'Executing without output param:' . PHP_EOL;
exec('echo Something', result_code: $resultCode);
var_dump($resultCode);
?>
--EXPECT--
Executing with all params:
int(0)
Executing without output param:
int(0)
+41
View File
@@ -0,0 +1,41 @@
--TEST--
Bug #80972: Memory exhaustion on invalid string offset
--FILE--
<?php
function exceptions_error_handler($severity, $message, $filename, $lineno) {
if (error_reporting() & $severity) {
throw new ErrorException($message, 0, $severity, $filename, $lineno);
}
}
set_error_handler('exceptions_error_handler');
$float = 10e120;
$string_float = (string) $float;
$string = 'Here is some text for good measure';
try {
echo 'Float casted to string compile', \PHP_EOL;
$string[(string) 10e120] = 'E';
var_dump($string);
} catch (\TypeError $e) {
echo $e->getMessage(), \PHP_EOL;
}
/* This same bug also permits to modify the first byte of a string even if
* the offset is invalid */
try {
/* This must not affect the string value */
$string["wrong"] = "f";
} catch (\Throwable $e) {
echo $e->getMessage() . \PHP_EOL;
}
var_dump($string);
?>
--EXPECT--
Float casted to string compile
Cannot access offset of type string on string
Cannot access offset of type string on string
string(34) "Here is some text for good measure"
+56
View File
@@ -0,0 +1,56 @@
--TEST--
Bug #80929: Method name corruption related to zend_closure_call_magic
--FILE--
<?php
class DefaultListener
{
public function handleDefaultEvent($event) { }
}
class SubscriberProxy
{
private array $subscribedEvents;
private object $subscriber;
private Closure $listener;
public function __construct(array $subscribedEvents, object $subscriber)
{
$this->subscribedEvents = $subscribedEvents;
$this->subscriber = $subscriber;
foreach ($this->subscribedEvents as $eventName => $params) {
$this->listener = Closure::fromCallable([$this, $params]);
}
}
public function __call(string $name, array $arguments)
{
return $this->subscriber->$name(...$arguments);
}
public function dispatch($event, string $eventName)
{
($this->listener)($event, $eventName, null);
}
}
$proxy = new SubscriberProxy(
['defaultEvent' => 'handleDefaultEvent'],
new DefaultListener()
);
for ($i = 0; $i < 10; $i++) {
echo $i . PHP_EOL;
$proxy->dispatch(null, 'defaultEvent');
}
?>
--EXPECT--
0
1
2
3
4
5
6
7
8
9
+30
View File
@@ -0,0 +1,30 @@
--TEST--
Dynamic static call of non-static method
--FILE--
<?php
class Foo {
function test1() {
$method = ['Foo', 'bar'];
$method();
}
function test2() {
$method = 'Foo::bar';
$method();
}
function __call($name, $args) {}
}
$x = new Foo;
try {
$x->test1();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$x->test2();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Non-static method Foo::bar() cannot be called statically
Non-static method Foo::bar() cannot be called statically
+1 -5
View File
@@ -52,7 +52,7 @@ foreach ($testvalues as $testvalue) {
}
?>
--EXPECTF--
--EXPECT--
*** Indexing - Testing value assignment with key ***
array(1) {
["foo"]=>
@@ -74,12 +74,8 @@ array(1) {
int(1)
}
}
Warning: Array to string conversion in %s on line %d
Cannot access offset of type string on string
string(0) ""
Warning: Array to string conversion in %s on line %d
Cannot access offset of type string on string
string(1) " "
Cannot use a scalar value as an array
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Iterator::key() with by-ref return
--FILE--
<?php
class Test extends ArrayIterator {
function &key() {
return $foo;
}
}
foreach (new Test([0]) as $k => $v) {
var_dump($k);
}
?>
--EXPECT--
NULL
@@ -0,0 +1,36 @@
--TEST--
A failed assignment should not be considered an initialization
--FILE--
<?php
class Test {
public int $prop;
public function __get($name) {
echo "__get() called\n";
return 0;
}
}
$test = new Test;
try {
$test->prop;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$test->prop = "foo";
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$test->prop;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Typed property Test::$prop must not be accessed before initialization
Cannot assign string to property Test::$prop of type int
Typed property Test::$prop must not be accessed before initialization
@@ -0,0 +1,20 @@
--TEST--
Everything is trivially a subtype of mixed
--FILE--
<?php
spl_autoload_register(function($class) {
echo "Loading $class\n";
});
class A {
public function test(): mixed {}
}
class B extends A {
public function test(): X {}
}
?>
===DONE===
--EXPECT--
===DONE===
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
#define ZEND_VERSION "4.0.3-dev"
#define ZEND_VERSION "4.0.7RC1"
#define ZEND_ENGINE_3
+1 -1
View File
@@ -1099,7 +1099,7 @@ static zend_always_inline void zend_mm_free_pages_ex(zend_mm_heap *heap, zend_mm
/* this setting may be not accurate */
chunk->free_tail = page_num;
}
if (free_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
if (free_chunk && chunk != heap->main_chunk && chunk->free_pages == ZEND_MM_PAGES - ZEND_MM_FIRST_PAGE) {
zend_mm_delete_chunk(heap, chunk);
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ void validate_attribute(zend_attribute *attr, uint32_t target, zend_class_entry
if (Z_TYPE(flags) != IS_LONG) {
zend_error_noreturn(E_ERROR,
"Attribute::__construct(): Argument #1 ($flags) must must be of type int, %s given",
"Attribute::__construct(): Argument #1 ($flags) must be of type int, %s given",
zend_zval_type_name(&flags)
);
}
+2 -1
View File
@@ -288,7 +288,6 @@ static ZEND_NAMED_FUNCTION(zend_closure_call_magic) /* {{{ */ {
zend_call_function(&fci, &fcc);
zval_ptr_dtor(&fci.params[0]);
zval_ptr_dtor(&fci.params[1]);
}
/* }}} */
@@ -485,6 +484,8 @@ static void zend_closure_free_storage(zend_object *object) /* {{{ */
if (closure->func.type == ZEND_USER_FUNCTION) {
destroy_op_array(&closure->func.op_array);
} else if (closure->orig_internal_handler == zend_closure_call_magic) {
zend_string_release(closure->func.common.function_name);
}
if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
+3 -6
View File
@@ -543,20 +543,17 @@ static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num) /*
file = zend_hash_find_ex(ht, ZSTR_KNOWN(ZEND_STR_FILE), 1);
if (file) {
if (Z_TYPE_P(file) != IS_STRING) {
zend_error(E_WARNING, "Function name is not a string");
smart_str_appends(str, "[unknown function]");
zend_error(E_WARNING, "File name is not a string");
smart_str_appends(str, "[unknown file]: ");
} else{
zend_long line;
zend_long line = 0;
tmp = zend_hash_find_ex(ht, ZSTR_KNOWN(ZEND_STR_LINE), 1);
if (tmp) {
if (Z_TYPE_P(tmp) == IS_LONG) {
line = Z_LVAL_P(tmp);
} else {
zend_error(E_WARNING, "Line is not an int");
line = 0;
}
} else {
line = 0;
}
smart_str_append(str, Z_STR_P(file));
smart_str_appendc(str, '(');
+23 -4
View File
@@ -54,11 +54,11 @@
# define ZEND_VM_FP_GLOBAL_REG "%r14"
# define ZEND_VM_IP_GLOBAL_REG "%r15"
# elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__powerpc64__)
# define ZEND_VM_FP_GLOBAL_REG "r28"
# define ZEND_VM_IP_GLOBAL_REG "r29"
# define ZEND_VM_FP_GLOBAL_REG "r14"
# define ZEND_VM_IP_GLOBAL_REG "r15"
# elif defined(__IBMC__) && ZEND_GCC_VERSION >= 4002 && defined(__powerpc64__)
# define ZEND_VM_FP_GLOBAL_REG "r28"
# define ZEND_VM_IP_GLOBAL_REG "r29"
# define ZEND_VM_FP_GLOBAL_REG "r14"
# define ZEND_VM_IP_GLOBAL_REG "r15"
# elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__aarch64__)
# define ZEND_VM_FP_GLOBAL_REG "x27"
# define ZEND_VM_IP_GLOBAL_REG "x28"
@@ -1525,6 +1525,14 @@ static zend_never_inline void zend_assign_to_string_offset(zval *str, zval *dim,
zend_long offset;
offset = zend_check_string_offset(dim, BP_VAR_W EXECUTE_DATA_CC);
/* Illegal offset assignment */
if (UNEXPECTED(EG(exception) != NULL)) {
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_UNDEF(EX_VAR(opline->result.var));
}
return;
}
if (offset < -(zend_long)Z_STRLEN_P(str)) {
/* Error on negative offset */
zend_error(E_WARNING, "Illegal string offset " ZEND_LONG_FMT, offset);
@@ -4005,6 +4013,10 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) {
zend_non_static_method_call(fbc);
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release_ex(fbc->common.function_name, 0);
zend_free_trampoline(fbc);
}
return NULL;
}
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
@@ -4129,6 +4141,10 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
}
if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
zend_non_static_method_call(fbc);
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release_ex(fbc->common.function_name, 0);
zend_free_trampoline(fbc);
}
return NULL;
}
object_or_called_scope = called_scope;
@@ -4571,6 +4587,9 @@ ZEND_API zend_result ZEND_FASTCALL zend_handle_undef_args(zend_execute_data *cal
}
ZVAL_COPY_VALUE(arg, &default_value);
if (ZEND_ARG_SEND_MODE(arg_info) & ZEND_SEND_BY_REF) {
ZVAL_NEW_REF(arg, arg);
}
}
}
+1 -1
View File
@@ -1655,10 +1655,10 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
} else if (EXPECTED(HT_FLAGS(ht) & HASH_FLAG_UNINITIALIZED)) {
goto free_ht;
}
zend_hash_iterators_remove(ht);
SET_INCONSISTENT(HT_DESTROYED);
efree(HT_GET_DATA_ADDR(ht));
free_ht:
zend_hash_iterators_remove(ht);
FREE_HASHTABLE(ht);
}
+7
View File
@@ -429,6 +429,13 @@ static inheritance_status zend_perform_covariant_type_check(
{
ZEND_ASSERT(ZEND_TYPE_IS_SET(fe_type) && ZEND_TYPE_IS_SET(proto_type));
/* Apart from void, everything is trivially covariant to the mixed type.
* Handle this case separately to ensure it never requires class loading. */
if (ZEND_TYPE_PURE_MASK(proto_type) == MAY_BE_ANY &&
!ZEND_TYPE_CONTAINS_CODE(fe_type, IS_VOID)) {
return INHERITANCE_SUCCESS;
}
/* Builtin types may be removed, but not added */
uint32_t fe_type_mask = ZEND_TYPE_PURE_MASK(fe_type);
uint32_t proto_type_mask = ZEND_TYPE_PURE_MASK(proto_type);
+3
View File
@@ -154,6 +154,9 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke
zend_user_iterator *iter = (zend_user_iterator*)_iter;
zval *object = &iter->it.data;
zend_call_method_with_0_params(Z_OBJ_P(object), iter->ce, &iter->ce->iterator_funcs_ptr->zf_key, "key", key);
if (UNEXPECTED(Z_ISREF_P(key))) {
zend_unwrap_reference(key);
}
}
/* }}} */
+1 -1
View File
@@ -728,7 +728,6 @@ found:
}
if (Z_PROP_FLAG_P(variable_ptr) == IS_PROP_UNINIT) {
/* Writes to uninitializde typed properties bypass __set(). */
Z_PROP_FLAG_P(variable_ptr) = 0;
goto write_std_property;
}
} else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) {
@@ -783,6 +782,7 @@ write_std_property:
goto exit;
}
value = &tmp;
Z_PROP_FLAG_P(variable_ptr) = 0;
goto found; /* might have been updated via e.g. __toString() */
}
+6
View File
@@ -1061,6 +1061,11 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
}
#endif
if (path_length + state_cwd_length + 1 >= MAXPATHLEN-1) {
#ifdef ZEND_WIN32
SET_ERRNO_FROM_WIN32_CODE(ERROR_BUFFER_OVERFLOW);
#else
errno = ENAMETOOLONG;
#endif
return 1;
}
memcpy(resolved_path, state->cwd, state_cwd_length);
@@ -1089,6 +1094,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
#ifdef ZEND_WIN32
if (memchr(resolved_path, '*', path_length) ||
memchr(resolved_path, '?', path_length)) {
SET_ERRNO_FROM_WIN32_CODE(ERROR_INVALID_NAME);
return 1;
}
#endif
+1 -1
View File
@@ -102,6 +102,6 @@ nmake test TESTS="%OPCACHE_OPTS% -q --offline --show-diff --show-slow 1000 --set
set EXIT_CODE=%errorlevel%
powershell -Command "$wc = New-Object 'System.Net.WebClient'; $wc.UploadFile('https://ci.appveyor.com/api/testresults/junit/%APPVEYOR_JOB_ID%', 'c:\junit.out.xml')"
appveyor PushArtifact %TEST_PHP_JUNIT%
exit /b %EXIT_CODE%
+6 -11
View File
@@ -16,21 +16,11 @@ jobs:
- job: ${{ parameters.configurationName }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
variables:
ubsan_options: 'print_stacktrace=1'
steps:
- template: apt.yml
- script: |
# Compile a newer version of curl, otherwise there will be an asan warning
# when running symfony tests.
wget https://curl.haxx.se/download/curl-7.65.3.tar.gz
tar xzf curl-7.65.3.tar.gz
cd curl-7.65.3/
./configure
make -j2
sudo make install
displayName: 'Build Curl'
- template: configure.yml
parameters:
configurationParameters: ${{ parameters.configurationParameters }}
@@ -51,6 +41,7 @@ jobs:
- script: |
git clone https://github.com/laravel/framework.git --branch=master --depth=1
cd framework
git rev-parse HEAD
php7.4 /usr/bin/composer install --no-progress
# Hack to disable a test that hangs on azure
sed -i 's/PHP_OS/"Darwin"/' tests/Filesystem/FilesystemTest.php
@@ -64,6 +55,7 @@ jobs:
- script: |
git clone https://github.com/symfony/symfony.git --depth=1
cd symfony
git rev-parse HEAD
php7.4 /usr/bin/composer install --no-progress
php7.4 ./phpunit install
export USE_ZEND_ALLOC=0
@@ -83,6 +75,7 @@ jobs:
- script: |
git clone https://github.com/amphp/amp.git --branch=master --depth=1
cd amp
git rev-parse HEAD
php /usr/bin/composer install --no-progress --ignore-platform-reqs
export USE_ZEND_ALLOC=0
sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php
@@ -92,6 +85,7 @@ jobs:
- script: |
git clone https://github.com/sebastianbergmann/phpunit.git --branch=master --depth=1
cd phpunit
git rev-parse HEAD
export USE_ZEND_ALLOC=0
export USE_TRACKED_ALLOC=1
export ASAN_OPTIONS=exitcode=139
@@ -104,6 +98,7 @@ jobs:
- script: |
php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress
cd symfony_demo
git rev-parse HEAD
export USE_ZEND_ALLOC=0
export USE_TRACKED_ALLOC=1
sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php
+1 -1
View File
@@ -8,7 +8,7 @@ jobs:
- job: ${{ parameters.configurationName }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
steps:
- template: apt.yml
- script: |
+1 -1
View File
@@ -8,7 +8,7 @@ jobs:
- job: ${{ parameters.configurationName }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
steps:
- template: apt.yml
- template: configure.yml
+1 -1
View File
@@ -8,7 +8,7 @@ jobs:
- job: ${{ parameters.configurationName }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
pool:
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
steps:
- template: apt.yml
- script: |
-1
View File
@@ -12,7 +12,6 @@ steps:
export TEST_PHP_JUNIT=junit.xml
export REPORT_EXIT_STATUS=no
export SKIP_IO_CAPTURE_TESTS=1
export MSAN_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer
rm -rf junit.xml | true
php run-tests.php -P -q \
-j$(/usr/bin/nproc) \
+2 -2
View File
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------
AC_PREREQ([2.68])
AC_INIT([PHP],[8.0.3-dev],[https://bugs.php.net],[php],[https://www.php.net])
AC_INIT([PHP],[8.0.7RC1],[https://bugs.php.net],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER
@@ -524,7 +524,7 @@ dnl Fix for these systems is already included in GCC 7, but not on GCC 6.
dnl
dnl At least some versions of FreeBSD seem to have buggy ifunc support, see
dnl bug #77284. Conservatively don't use ifuncs on FreeBSD.
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*], [true], [
AS_CASE([$host_alias], [*-*-*android*|*-*-*uclibc*|*-*-*musl*|*freebsd*|*openbsd*], [true], [
AX_GCC_FUNC_ATTRIBUTE([ifunc])
AX_GCC_FUNC_ATTRIBUTE([target])
])
+10 -3
View File
@@ -39,6 +39,7 @@ typedef struct _php_bz2_filter_data {
enum strm_status status; /* Decompress option */
unsigned int small_footprint : 1; /* Decompress option */
unsigned int expect_concatenated : 1; /* Decompress option */
unsigned int is_flushed : 1; /* only for compression */
int persistent;
} php_bz2_filter_data;
@@ -227,6 +228,8 @@ static php_stream_filter_status_t php_bz2_compress_filter(
bucket = php_stream_bucket_make_writeable(buckets_in->head);
while (bin < bucket->buflen) {
int flush_mode;
desired = bucket->buflen - bin;
if (desired > data->inbuf_len) {
desired = data->inbuf_len;
@@ -234,7 +237,9 @@ static php_stream_filter_status_t php_bz2_compress_filter(
memcpy(data->strm.next_in, bucket->buf + bin, desired);
data->strm.avail_in = desired;
status = BZ2_bzCompress(&(data->strm), flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN));
flush_mode = flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : (flags & PSFS_FLAG_FLUSH_INC ? BZ_FLUSH : BZ_RUN);
data->is_flushed = flush_mode != BZ_RUN;
status = BZ2_bzCompress(&(data->strm), flush_mode);
if (status != BZ_RUN_OK && status != BZ_FLUSH_OK && status != BZ_FINISH_OK) {
/* Something bad happened */
php_stream_bucket_delref(bucket);
@@ -260,11 +265,12 @@ static php_stream_filter_status_t php_bz2_compress_filter(
php_stream_bucket_delref(bucket);
}
if (flags & PSFS_FLAG_FLUSH_CLOSE) {
if (flags & PSFS_FLAG_FLUSH_CLOSE || ((flags & PSFS_FLAG_FLUSH_INC) && !data->is_flushed)) {
/* Spit it out! */
status = BZ_FINISH_OK;
while (status == BZ_FINISH_OK) {
status = BZ2_bzCompress(&(data->strm), BZ_FINISH);
status = BZ2_bzCompress(&(data->strm), (flags & PSFS_FLAG_FLUSH_CLOSE ? BZ_FINISH : BZ_FLUSH));
data->is_flushed = 1;
if (data->strm.avail_out < data->outbuf_len) {
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -380,6 +386,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
}
status = BZ2_bzCompressInit(&(data->strm), blockSize100k, 0, workFactor);
data->is_flushed = 1;
fops = &php_bz2_compress_ops;
} else {
status = BZ_DATA_ERROR;
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #75776 (Flushing streams with compression filter is broken)
--SKIPIF--
<?php
if (!extension_loaded('bz2')) die('skip bz2 extension not available');
?>
--FILE--
<?php
$text = str_repeat('0123456789abcdef', 1000);
$temp = fopen('php://temp', 'r+');
stream_filter_append($temp, 'bzip2.compress', STREAM_FILTER_WRITE);
fwrite($temp, $text);
rewind($temp);
var_dump(bin2hex(stream_get_contents($temp)));
var_dump(ftell($temp));
fclose($temp);
?>
--EXPECT--
string(144) "425a68343141592653599fe7bbbf0001f389007fe03f002000902980026826aa80003ea9061520c6a41954833a9069520d6a41b54837a9071520e6a41d5483ba9079520f6a41f548"
int(72)
+2 -2
View File
@@ -863,9 +863,9 @@ restart:
zend_bool close_both;
close_both = (info->fp != info->lock.fp);
php_stream_close(info->lock.fp);
php_stream_free(info->lock.fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
if (close_both) {
php_stream_close(info->fp);
php_stream_free(info->fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE);
}
info->fp = NULL;
info->lock.fp = NULL;
+7 -3
View File
@@ -1243,9 +1243,13 @@ int dom_hierarchy(xmlNodePtr parent, xmlNodePtr child)
{
xmlNodePtr nodep;
if (parent == NULL || child == NULL || child->doc != parent->doc) {
return SUCCESS;
}
if (parent == NULL || child == NULL || child->doc != parent->doc) {
return SUCCESS;
}
if (child->type == XML_DOCUMENT_NODE) {
return FAILURE;
}
nodep = parent;
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
$filename = __DIR__."/DOMDocument_saveHTMLFile_basic.html";
$doc = new DOMDocument('1.0');
$root = $doc->createElement('html');
$root = $doc->appendChild($root);
@@ -9,7 +9,7 @@ require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
$filename = __DIR__."/tmp_savehtmlfile".time().".html";
$filename = __DIR__."/DOMDocument_saveHTMLFile_formatOutput.html";
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$root = $doc->createElement('html');
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #66783 (UAF when appending DOMDocument to element)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die('skip dom extension not available');
?>
--FILE--
<?php
$doc = new DomDocument;
$doc->loadXML('<root></root>');
$e = $doc->createElement('e');
try {
$e->appendChild($doc);
} catch (DOMException $ex) {
echo $ex->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
Hierarchy Request Error
+2
View File
@@ -1,5 +1,7 @@
--TEST--
Bug #79852: count(DOMNodeList) doesn't match count(IteratorIterator(DOMNodeList))
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
+2
View File
@@ -1,5 +1,7 @@
--TEST--
dom: DOMChildNode::remove does not work on character data
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
+53 -34
View File
@@ -293,57 +293,85 @@ static int zend_ffi_is_compatible_type(zend_ffi_type *dst_type, zend_ffi_type *s
}
/* }}} */
static ffi_type *zend_ffi_make_fake_struct_type(zend_ffi_type *type) /* {{{ */
static ffi_type* zend_ffi_face_struct_add_fields(ffi_type* t, zend_ffi_type *type, int *i, size_t size)
{
ffi_type *t = emalloc(sizeof(ffi_type) + sizeof(ffi_type*) * (zend_hash_num_elements(&type->record.fields) + 1));
int i;
zend_ffi_field *field;
t->size = type->size;
t->alignment = type->align;
t->type = FFI_TYPE_STRUCT;
t->elements = (ffi_type**)(t + 1);
i = 0;
ZEND_HASH_FOREACH_PTR(&type->record.fields, field) {
switch (ZEND_FFI_TYPE(field->type)->kind) {
case ZEND_FFI_TYPE_FLOAT:
t->elements[i] = &ffi_type_float;
t->elements[(*i)++] = &ffi_type_float;
break;
case ZEND_FFI_TYPE_DOUBLE:
t->elements[i] = &ffi_type_double;
t->elements[(*i)++] = &ffi_type_double;
break;
#ifdef HAVE_LONG_DOUBLE
case ZEND_FFI_TYPE_LONGDOUBLE:
t->elements[i] = &ffi_type_longdouble;
t->elements[(*i)++] = &ffi_type_longdouble;
break;
#endif
case ZEND_FFI_TYPE_SINT8:
case ZEND_FFI_TYPE_UINT8:
case ZEND_FFI_TYPE_BOOL:
case ZEND_FFI_TYPE_CHAR:
t->elements[i] = &ffi_type_uint8;
t->elements[(*i)++] = &ffi_type_uint8;
break;
case ZEND_FFI_TYPE_SINT16:
case ZEND_FFI_TYPE_UINT16:
t->elements[i] = &ffi_type_uint16;
t->elements[(*i)++] = &ffi_type_uint16;
break;
case ZEND_FFI_TYPE_SINT32:
case ZEND_FFI_TYPE_UINT32:
t->elements[i] = &ffi_type_uint32;
t->elements[(*i)++] = &ffi_type_uint32;
break;
case ZEND_FFI_TYPE_SINT64:
case ZEND_FFI_TYPE_UINT64:
t->elements[i] = &ffi_type_uint64;
t->elements[(*i)++] = &ffi_type_uint64;
break;
case ZEND_FFI_TYPE_POINTER:
t->elements[i] = &ffi_type_pointer;
t->elements[(*i)++] = &ffi_type_pointer;
break;
case ZEND_FFI_TYPE_STRUCT: {
zend_ffi_type *field_type = ZEND_FFI_TYPE(field->type);
/* for unions we use only the first field */
int num_fields = !(field_type->attr & ZEND_FFI_ATTR_UNION) ?
zend_hash_num_elements(&field_type->record.fields) : 1;
if (num_fields > 1) {
size += sizeof(ffi_type*) * (num_fields - 1);
t = erealloc(t, size);
t->elements = (ffi_type**)(t + 1);
}
t = zend_ffi_face_struct_add_fields(t, field_type, i, size);
break;
default:
efree(t);
return NULL;
}
i++;
default:
t->elements[(*i)++] = &ffi_type_void;
break;
}
if (type->attr & ZEND_FFI_ATTR_UNION) {
/* for unions we use only the first field */
break;
}
} ZEND_HASH_FOREACH_END();
return t;
}
static ffi_type *zend_ffi_make_fake_struct_type(zend_ffi_type *type) /* {{{ */
{
/* for unions we use only the first field */
int num_fields = !(type->attr & ZEND_FFI_ATTR_UNION) ?
zend_hash_num_elements(&type->record.fields) : 1;
size_t size = sizeof(ffi_type) + sizeof(ffi_type*) * (num_fields + 1);
ffi_type *t = emalloc(size);
int i;
t->size = type->size;
t->alignment = type->align;
t->type = FFI_TYPE_STRUCT;
t->elements = (ffi_type**)(t + 1);
i = 0;
t = zend_ffi_face_struct_add_fields(t, type, &i, size);
t->elements[i] = NULL;
return t;
}
@@ -391,11 +419,7 @@ again:
kind = type->enumeration.kind;
goto again;
case ZEND_FFI_TYPE_STRUCT:
if (!(type->attr & ZEND_FFI_ATTR_UNION)) {
ffi_type *t = zend_ffi_make_fake_struct_type(type);
return t;
}
break;
return zend_ffi_make_fake_struct_type(type);
default:
break;
}
@@ -2534,18 +2558,13 @@ again:
kind = type->enumeration.kind;
goto again;
case ZEND_FFI_TYPE_STRUCT:
if (!(type->attr & ZEND_FFI_ATTR_UNION)
&& Z_TYPE_P(arg) == IS_OBJECT && Z_OBJCE_P(arg) == zend_ffi_cdata_ce) {
if (Z_TYPE_P(arg) == IS_OBJECT && Z_OBJCE_P(arg) == zend_ffi_cdata_ce) {
zend_ffi_cdata *cdata = (zend_ffi_cdata*)Z_OBJ_P(arg);
if (zend_ffi_is_compatible_type(type, ZEND_FFI_TYPE(cdata->type))) {
/* Create a fake structure type */
ffi_type *t = zend_ffi_make_fake_struct_type(type);
if (t) {
*pass_type = t;
arg_values[n] = cdata->ptr;
break;
}
*pass_type = zend_ffi_make_fake_struct_type(type);;
arg_values[n] = cdata->ptr;
break;
}
}
zend_ffi_pass_incompatible(arg, type, n, execute_data);
+68
View File
@@ -0,0 +1,68 @@
--TEST--
Bug #80847 (Nested structs)
--SKIPIF--
<?php
if (!extension_loaded('ffi')) die('skip ffi extension not available');
if (!extension_loaded('zend-test')) die('skip zend-test extension not available');
if (PHP_OS_FAMILY == 'Windows' && ((1 << 31) > 0)) die('xfail libffi doesn\'t properly support passing big strctures by value on Windows/64');
?>
--FILE--
<?php
require_once('utils.inc');
$header = <<<HEADER
typedef struct bug80847_01 {
uint64_t b;
double c;
} bug80847_01;
typedef struct bug80847_02 {
bug80847_01 a;
} bug80847_02;
bug80847_02 ffi_bug80847(bug80847_02 s);
HEADER;
if (PHP_OS_FAMILY !== 'Windows') {
$ffi = FFI::cdef($header);
} else {
try {
$ffi = FFI::cdef($header, 'php_zend_test.dll');
} catch (FFI\Exception $ex) {
$ffi = FFI::cdef($header, ffi_get_php_dll_name());
}
}
$x = $ffi->new('bug80847_02');
$x->a->b = 42;
$x->a->c = 42.5;
var_dump($x);
$y = $ffi->ffi_bug80847($x);
var_dump($x, $y);
?>
--EXPECTF--
object(FFI\CData:struct bug80847_02)#%d (1) {
["a"]=>
object(FFI\CData:struct bug80847_01)#%d (2) {
["b"]=>
int(42)
["c"]=>
float(42.5)
}
}
object(FFI\CData:struct bug80847_02)#%d (1) {
["a"]=>
object(FFI\CData:struct bug80847_01)#%d (2) {
["b"]=>
int(42)
["c"]=>
float(42.5)
}
}
object(FFI\CData:struct bug80847_02)#%d (1) {
["a"]=>
object(FFI\CData:struct bug80847_01)#%d (2) {
["b"]=>
int(52)
["c"]=>
float(32.5)
}
}
+35 -22
View File
@@ -59,6 +59,11 @@
#include "ftp.h"
#include "ext/standard/fsock.h"
#ifdef PHP_WIN32
# undef ETIMEDOUT
# define ETIMEDOUT WSAETIMEDOUT
#endif
/* sends an ftp command, returns true on success, false on error.
* it sends the string "cmd args\r\n" if args is non-null, or
* "cmd\r\n" if args is null
@@ -1260,7 +1265,8 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const size_t cmd_len, const char *arg
data = ftp->outbuf;
/* Clear the extra-lines buffer */
/* Clear the inbuf and extra-lines buffer */
ftp->inbuf[0] = '\0';
ftp->extra = NULL;
if (my_send(ftp, ftp->fd, data, size) != size) {
@@ -1313,10 +1319,12 @@ ftp_readline(ftpbuf_t *ftp)
data = eol;
if ((rcvd = my_recv(ftp, ftp->fd, data, size)) < 1) {
*data = 0;
return 0;
}
} while (size);
*data = 0;
return 0;
}
/* }}} */
@@ -1428,15 +1436,15 @@ my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
n = php_pollfd_for_ms(s, POLLOUT, ftp->timeout_sec * 1000);
if (n < 1) {
char buf[256];
if (n == 0) {
#ifdef PHP_WIN32
if (n == 0) {
_set_errno(ETIMEDOUT);
}
#else
if (n == 0) {
errno = ETIMEDOUT;
}
#endif
}
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
return -1;
}
@@ -1464,18 +1472,17 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)
SSL *handle = NULL;
php_socket_t fd;
#endif
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, ftp->timeout_sec * 1000);
if (n < 1) {
char buf[256];
if (n == 0) {
#ifdef PHP_WIN32
if (n == 0) {
_set_errno(ETIMEDOUT);
}
#else
if (n == 0) {
errno = ETIMEDOUT;
}
#endif
}
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
return -1;
}
@@ -1541,15 +1548,15 @@ data_available(ftpbuf_t *ftp, php_socket_t s)
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, 1000);
if (n < 1) {
char buf[256];
if (n == 0) {
#ifdef PHP_WIN32
if (n == 0) {
_set_errno(ETIMEDOUT);
}
#else
if (n == 0) {
errno = ETIMEDOUT;
}
#endif
}
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
return 0;
}
@@ -1564,15 +1571,15 @@ data_writeable(ftpbuf_t *ftp, php_socket_t s)
n = php_pollfd_for_ms(s, POLLOUT, 1000);
if (n < 1) {
char buf[256];
if (n == 0) {
#ifdef PHP_WIN32
if (n == 0) {
_set_errno(ETIMEDOUT);
}
#else
if (n == 0) {
errno = ETIMEDOUT;
}
#endif
}
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
return 0;
}
@@ -1588,15 +1595,15 @@ my_accept(ftpbuf_t *ftp, php_socket_t s, struct sockaddr *addr, socklen_t *addrl
n = php_pollfd_for_ms(s, PHP_POLLREADABLE, ftp->timeout_sec * 1000);
if (n < 1) {
char buf[256];
if (n == 0) {
#ifdef PHP_WIN32
if (n == 0) {
_set_errno(ETIMEDOUT);
}
#else
if (n == 0) {
errno = ETIMEDOUT;
}
#endif
}
php_error_docref(NULL, E_WARNING, "%s", php_socket_strerror(errno, buf, sizeof buf));
return -1;
}
@@ -1886,6 +1893,12 @@ static void ftp_ssl_shutdown(ftpbuf_t *ftp, php_socket_t fd, SSL *ssl_handle) {
/* SSL wants a write. Really odd. Let's bail out. */
done = 1;
break;
case SSL_ERROR_SYSCALL:
/* most likely the peer closed the connection without
sending a close_notify shutdown alert;
bail out to avoid raising a spurious warning */
done = 1;
break;
default:
if ((sslerror = ERR_get_error())) {
ERR_error_string_n(sslerror, buf, sizeof(buf));
+60 -20
View File
@@ -200,7 +200,9 @@ PHP_FUNCTION(ftp_login)
/* log in */
if (!ftp_login(ftp, user, user_len, pass, pass_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -224,7 +226,9 @@ PHP_FUNCTION(ftp_pwd)
}
if (!(pwd = ftp_pwd(ftp))) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -247,7 +251,9 @@ PHP_FUNCTION(ftp_cdup)
}
if (!ftp_cdup(ftp)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -273,7 +279,9 @@ PHP_FUNCTION(ftp_chdir)
/* change directories */
if (!ftp_chdir(ftp, dir, dir_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -299,7 +307,9 @@ PHP_FUNCTION(ftp_exec)
/* execute serverside command */
if (!ftp_exec(ftp, cmd, cmd_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -347,7 +357,9 @@ PHP_FUNCTION(ftp_mkdir)
/* create directory */
if (NULL == (tmp = ftp_mkdir(ftp, dir, dir_len))) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -373,7 +385,9 @@ PHP_FUNCTION(ftp_rmdir)
/* remove directorie */
if (!ftp_rmdir(ftp, dir, dir_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -399,7 +413,9 @@ PHP_FUNCTION(ftp_chmod)
}
if (!ftp_chmod(ftp, mode, filename, filename_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -548,7 +564,9 @@ PHP_FUNCTION(ftp_systype)
}
if (NULL == (syst = ftp_syst(ftp))) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -593,7 +611,9 @@ PHP_FUNCTION(ftp_fget)
}
if (!ftp_get(ftp, stream, file, file_len, xtype, resumepos)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -642,7 +662,9 @@ PHP_FUNCTION(ftp_nb_fget)
ftp->closestream = 0; /* do not close */
if ((ret = ftp_nb_get(ftp, stream, file, file_len, xtype, resumepos)) == PHP_FTP_FAILED) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_LONG(ret);
}
@@ -728,7 +750,9 @@ PHP_FUNCTION(ftp_get)
if (!ftp_get(ftp, outstream, remote, remote_len, xtype, resumepos)) {
php_stream_close(outstream);
VCWD_UNLINK(local);
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -796,7 +820,9 @@ PHP_FUNCTION(ftp_nb_get)
php_stream_close(outstream);
ftp->stream = NULL;
VCWD_UNLINK(local);
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_LONG(PHP_FTP_FAILED);
}
@@ -888,7 +914,9 @@ PHP_FUNCTION(ftp_fput)
}
if (!ftp_put(ftp, remote, remote_len, stream, xtype, startpos)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -941,7 +969,9 @@ PHP_FUNCTION(ftp_nb_fput)
ftp->closestream = 0; /* do not close */
if (((ret = ftp_nb_put(ftp, remote, remote_len, stream, xtype, startpos)) == PHP_FTP_FAILED)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_LONG(ret);
}
@@ -994,7 +1024,9 @@ PHP_FUNCTION(ftp_put)
if (!ftp_put(ftp, remote, remote_len, instream, xtype, startpos)) {
php_stream_close(instream);
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
php_stream_close(instream);
@@ -1029,7 +1061,9 @@ PHP_FUNCTION(ftp_append)
if (!ftp_append(ftp, remote, remote_len, instream, xtype)) {
php_stream_close(instream);
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
php_stream_close(instream);
@@ -1159,7 +1193,9 @@ PHP_FUNCTION(ftp_rename)
/* rename the file */
if (!ftp_rename(ftp, src, src_len, dest, dest_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -1185,7 +1221,9 @@ PHP_FUNCTION(ftp_delete)
/* delete the file */
if (!ftp_delete(ftp, file, file_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
@@ -1211,7 +1249,9 @@ PHP_FUNCTION(ftp_site)
/* send the site command */
if (!ftp_site(ftp, cmd, cmd_len)) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
if (*ftp->inbuf) {
php_error_docref(NULL, E_WARNING, "%s", ftp->inbuf);
}
RETURN_FALSE;
}
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #79100 (Wrong FTP error messages)
--SKIPIF--
<?php
require 'skipif.inc';
?>
--FILE--
<?php
$bug79100 = true;
require 'server.inc';
$ftp = ftp_connect("127.0.0.1", $port);
if (!$ftp) die("Couldn't connect to the server");
var_dump(ftp_login($ftp, 'user', 'pass'));
var_dump(ftp_set_option($ftp, FTP_TIMEOUT_SEC, 1));
ftp_systype($ftp);
?>
--EXPECTF--
bool(true)
bool(true)
Warning: ftp_systype(): %rConnection|Operation%r timed out in %s on line %d
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #80901 (Info leak in ftp extension)
--SKIPIF--
<?php
require 'skipif.inc';
?>
--INI--
log_errors_max_len=0
--FILE--
<?php
$bug80901 = true;
require 'server.inc';
$ftp = ftp_connect("127.0.0.1", $port);
if (!$ftp) die("Couldn't connect to the server");
var_dump(ftp_login($ftp, 'user', 'pass'));
ftp_systype($ftp);
?>
--EXPECTF--
bool(true)
Warning: ftp_systype(): **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** in %s on line %d
+5
View File
@@ -107,6 +107,7 @@ if ($pid) {
fputs($s, "234 auth type accepted\r\n");
} else {
fputs($s, "666 dummy\r\n");
sleep(1);
fputs($s, "666 bogus msg\r\n");
exit;
}
@@ -197,6 +198,10 @@ if ($pid) {
} elseif ($buf === "SYST\r\n") {
if (isset($bug27809)) {
fputs($s, "215 OS/400 is the remote operating system. The TCP/IP version is \"V5R2M0\"\r\n");
} elseif (isset($bug79100)) {
// do nothing so test hits timeout
} elseif (isset($bug80901)) {
fputs($s, "\r\n" . str_repeat("*", 4096) . "\r\n");
} else {
fputs($s, "215 UNIX Type: L8.\r\n");
}
+18 -8
View File
@@ -59,13 +59,23 @@
static int le_gd_font;
#include <gd.h>
#include <gd_errors.h>
#include <gdfontt.h> /* 1 Tiny font */
#include <gdfonts.h> /* 2 Small font */
#include <gdfontmb.h> /* 3 Medium bold font */
#include <gdfontl.h> /* 4 Large font */
#include <gdfontg.h> /* 5 Giant font */
#ifdef HAVE_GD_BUNDLED
# include "libgd/gd.h"
# include "libgd/gd_errors.h"
# include "libgd/gdfontt.h" /* 1 Tiny font */
# include "libgd/gdfonts.h" /* 2 Small font */
# include "libgd/gdfontmb.h" /* 3 Medium bold font */
# include "libgd/gdfontl.h" /* 4 Large font */
# include "libgd/gdfontg.h" /* 5 Giant font */
#else
# include <gd.h>
# include <gd_errors.h>
# include <gdfontt.h> /* 1 Tiny font */
# include <gdfonts.h> /* 2 Small font */
# include <gdfontmb.h> /* 3 Medium bold font */
# include <gdfontl.h> /* 4 Large font */
# include <gdfontg.h> /* 5 Giant font */
#endif
#if defined(HAVE_GD_FREETYPE) && defined(HAVE_GD_BUNDLED)
# include <ft2build.h>
@@ -2601,7 +2611,7 @@ PHP_FUNCTION(imageinterlace)
gdImageInterlace(im, INT);
}
RETURN_LONG(gdImageGetInterlaced(im));
RETURN_BOOL(gdImageGetInterlaced(im));
}
/* }}} */
+2 -2
View File
@@ -177,9 +177,9 @@ function imagefill(GdImage $image, int $x, int $y, int $color): bool {}
function imagecolorstotal(GdImage $image): int {}
function imagecolortransparent(GdImage $image, ?int $color = null): ?int {}
function imagecolortransparent(GdImage $image, ?int $color = null): int {}
function imageinterlace(GdImage $image, ?bool $enable = null): ?int {}
function imageinterlace(GdImage $image, ?bool $enable = null): bool {}
function imagepolygon(GdImage $image, array $points, int $num_points_or_color, ?int $color = null): bool {}
+3 -3
View File
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 63898b501cc3ae38585fe0c6f70a9f7865fbee4d */
* Stub hash: 012a149dba5332fcb73544771b881fc7e6d53925 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_gd_info, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
@@ -358,12 +358,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolorstotal, 0, 1, IS_LONG,
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_LONG, 1)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imagecolortransparent, 0, 1, IS_LONG, 0)
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, color, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, IS_LONG, 1)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_imageinterlace, 0, 1, _IS_BOOL, 0)
ZEND_ARG_OBJ_INFO(0, image, GdImage, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 1, "null")
ZEND_END_ARG_INFO()
+2 -1
View File
@@ -19,11 +19,12 @@
* (end code)
**/
#include <gd.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "gd.h"
static int gdGuessBackgroundColorFromCorners(gdImagePtr im, int *color);
static int gdColorMatch(gdImagePtr im, int col1, int col2, float threshold);
+1 -1
View File
@@ -58,7 +58,7 @@ TODO:
#include <string.h>
#include <math.h>
#include <gd.h>
#include "gd.h"
#include "gdhelpers.h"
#ifdef _MSC_VER
+3 -3
View File
@@ -51,13 +51,13 @@
----------------------------------------------------------------------------
*/
#include <gd.h>
#include <gdfonts.h>
#include <gd_errors.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "gd.h"
#include "gdfonts.h"
#include "gd_errors.h"
#include "wbmp.h"
+2 -2
View File
@@ -8,14 +8,14 @@ if (!extension_loaded('gd')) die('skip gd extension not available');
<?php
$im = imagecreatetruecolor(10, 10);
imagefilledrectangle($im, 0, 0, 9, 9, imagecolorallocate($im, 255, 255, 255));
imageinterlace($im, 1);
imageinterlace($im, true);
imagegif($im, __DIR__ . 'bug77700.gif');
$im = imagecreatefromgif(__DIR__ . 'bug77700.gif');
var_dump(imageinterlace($im));
?>
--EXPECT--
int(1)
bool(true)
--CLEAN--
<?php
unlink(__DIR__ . 'bug77700.gif');
+1 -1
View File
@@ -14,4 +14,4 @@ $image = imagecreatetruecolor(100, 100);
var_dump(imageinterlace($image));
?>
--EXPECT--
int(0)
bool(false)
+3 -3
View File
@@ -12,9 +12,9 @@ if (!extension_loaded("gd")) die("skip GD not present");
$image = imagecreatetruecolor(100, 100);
var_dump(imageinterlace($image, 1));
var_dump(imageinterlace($image, true));
var_dump(imageinterlace($image));
?>
--EXPECT--
int(1)
int(1)
bool(true)
bool(true)
+4 -4
View File
@@ -13,12 +13,12 @@ if (!extension_loaded("gd")) die("skip GD not present");
$image = imagecreatetruecolor(100, 100);
//setting the interlace bit to on
imageinterlace($image, 1);
imageinterlace($image, true);
//setting de interlace bit to off
var_dump(imageinterlace($image, 0));
var_dump(imageinterlace($image, false));
var_dump(imageinterlace($image));
?>
--EXPECT--
int(0)
int(0)
bool(false)
bool(false)
+66 -2
View File
@@ -735,7 +735,11 @@ PHP_FUNCTION(imap_open)
RETURN_THROWS();
}
if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | CL_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
/* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
* to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
* the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
* IMAPConnection object being destroyed naturally at the end of the PHP script */
if (flags && ((flags & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | PHP_EXPUNGE | OP_DEBUG | OP_SHORTCACHE
| OP_SILENT | OP_PROTOTYPE | OP_SECURE)) != 0)) {
zend_argument_value_error(4, "must be a bitmask of the OP_* constants, and CL_EXPUNGE");
RETURN_THROWS();
@@ -858,7 +862,11 @@ PHP_FUNCTION(imap_reopen)
}
/* TODO Verify these are the only options available as they are pulled from the php.net documentation */
if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | CL_EXPUNGE)) != 0)) {
/* Check for PHP_EXPUNGE and not CL_EXPUNGE as the user land facing CL_EXPUNGE constant is defined
* to something different to prevent clashes between CL_EXPUNGE and an OP_* constant allowing setting
* the CL_EXPUNGE flag which will expunge when the mailbox is closed (be that manually, or via the
* IMAPConnection object being destroyed naturally at the end of the PHP script */
if (options && ((options & ~(OP_READONLY | OP_ANONYMOUS | OP_HALFOPEN | OP_EXPUNGE | PHP_EXPUNGE)) != 0)) {
zend_argument_value_error(3, "must be a bitmask of OP_READONLY, OP_ANONYMOUS, OP_HALFOPEN, "
"OP_EXPUNGE, and CL_EXPUNGE");
RETURN_THROWS();
@@ -3055,6 +3063,23 @@ PHP_FUNCTION(imap_fetch_overview)
}
/* }}} */
static zend_bool header_injection(zend_string *str, zend_bool adrlist)
{
char *p = ZSTR_VAL(str);
while ((p = strpbrk(p, "\r\n")) != NULL) {
if (!(p[0] == '\r' && p[1] == '\n')
/* adrlists do not support folding, but swallow trailing line breaks */
&& !((adrlist && p[1] == '\0')
/* other headers support folding */
|| (!adrlist && (p[1] == ' ' || p[1] == '\t')))) {
return 1;
}
p++;
}
return 0;
}
/* {{{ Create a MIME message based on given envelope and body sections */
PHP_FUNCTION(imap_mail_compose)
{
@@ -3078,6 +3103,13 @@ PHP_FUNCTION(imap_mail_compose)
zend_argument_value_error(2, "cannot be empty");
}
#define CHECK_HEADER_INJECTION(zstr, adrlist, header) \
if (header_injection(zstr, adrlist)) { \
php_error_docref(NULL, E_WARNING, "header injection attempt in " header); \
RETVAL_FALSE; \
goto done; \
}
#define PHP_RFC822_PARSE_ADRLIST(target, value) \
str_copy = estrndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); \
rfc822_parse_adrlist(target, str_copy, "NO HOST"); \
@@ -3086,46 +3118,57 @@ PHP_FUNCTION(imap_mail_compose)
env = mail_newenvelope();
if ((pvalue = zend_hash_str_find(envelope, "remail", sizeof("remail") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "remail");
env->remail = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(envelope, "return_path", sizeof("return_path") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "return_path");
PHP_RFC822_PARSE_ADRLIST(&env->return_path, pvalue);
}
if ((pvalue = zend_hash_str_find(envelope, "date", sizeof("date") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "date");
env->date = (unsigned char*)cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(envelope, "from", sizeof("from") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "from");
PHP_RFC822_PARSE_ADRLIST(&env->from, pvalue);
}
if ((pvalue = zend_hash_str_find(envelope, "reply_to", sizeof("reply_to") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "reply_to");
PHP_RFC822_PARSE_ADRLIST(&env->reply_to, pvalue);
}
if ((pvalue = zend_hash_str_find(envelope, "in_reply_to", sizeof("in_reply_to") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "in_reply_to");
env->in_reply_to = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(envelope, "subject", sizeof("subject") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "subject");
env->subject = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(envelope, "to", sizeof("to") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "to");
PHP_RFC822_PARSE_ADRLIST(&env->to, pvalue);
}
if ((pvalue = zend_hash_str_find(envelope, "cc", sizeof("cc") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "cc");
PHP_RFC822_PARSE_ADRLIST(&env->cc, pvalue);
}
if ((pvalue = zend_hash_str_find(envelope, "bcc", sizeof("bcc") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 1, "bcc");
PHP_RFC822_PARSE_ADRLIST(&env->bcc, pvalue);
}
if ((pvalue = zend_hash_str_find(envelope, "message_id", sizeof("message_id") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "message_id");
env->message_id=cpystr(Z_STRVAL_P(pvalue));
}
@@ -3136,6 +3179,7 @@ PHP_FUNCTION(imap_mail_compose)
ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pvalue), env_data) {
custom_headers_param = mail_newbody_parameter();
convert_to_string_ex(env_data);
CHECK_HEADER_INJECTION(Z_STR_P(env_data), 0, "custom_headers");
custom_headers_param->value = (char *) fs_get(Z_STRLEN_P(env_data) + 1);
custom_headers_param->attribute = NULL;
memcpy(custom_headers_param->value, Z_STRVAL_P(env_data), Z_STRLEN_P(env_data) + 1);
@@ -3178,6 +3222,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
tmp_param = mail_newbody_parameter();
tmp_param->value = cpystr(Z_STRVAL_P(pvalue));
tmp_param->attribute = cpystr("CHARSET");
@@ -3190,9 +3235,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3203,18 +3250,22 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
bod->id = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
bod->description = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
}
@@ -3224,9 +3275,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3257,6 +3310,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
}
} else if (Z_TYPE_P(data) == IS_ARRAY && topbod->type == TYPEMULTIPART) {
@@ -3289,6 +3343,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "charset", sizeof("charset") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body charset");
tmp_param = mail_newbody_parameter();
tmp_param->value = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(tmp_param->value, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue) + 1);
@@ -3302,9 +3357,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body type.parameters key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body type.parameters value");
disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3315,18 +3372,22 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "subtype", sizeof("subtype") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body subtype");
bod->subtype = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "id", sizeof("id") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body id");
bod->id = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "description", sizeof("description") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body description");
bod->description = cpystr(Z_STRVAL_P(pvalue));
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "disposition.type", sizeof("disposition.type") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body disposition.type");
bod->disposition.type = (char *) fs_get(Z_STRLEN_P(pvalue) + 1);
memcpy(bod->disposition.type, Z_STRVAL_P(pvalue), Z_STRLEN_P(pvalue)+1);
}
@@ -3336,9 +3397,11 @@ PHP_FUNCTION(imap_mail_compose)
SEPARATE_ARRAY(pvalue);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) {
if (key == NULL) continue;
CHECK_HEADER_INJECTION(key, 0, "body disposition key");
disp_param = mail_newbody_parameter();
disp_param->attribute = cpystr(ZSTR_VAL(key));
convert_to_string_ex(disp_data);
CHECK_HEADER_INJECTION(Z_STR_P(disp_data), 0, "body disposition value");
disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1);
memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1);
disp_param->next = tmp_param;
@@ -3369,6 +3432,7 @@ PHP_FUNCTION(imap_mail_compose)
}
if ((pvalue = zend_hash_str_find(Z_ARRVAL_P(data), "md5", sizeof("md5") - 1)) != NULL) {
convert_to_string_ex(pvalue);
CHECK_HEADER_INJECTION(Z_STR_P(pvalue), 0, "body md5");
bod->md5 = cpystr(Z_STRVAL_P(pvalue));
}
}
+37
View File
@@ -0,0 +1,37 @@
--TEST--
Bug #80710 (imap_mail_compose() header injection) - MIME Splitting Attack
--SKIPIF--
<?php
if (!extension_loaded("imap")) die("skip imap extension not available");
?>
--FILE--
<?php
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
$envelope["x-remail"] = "bar@example.com\nFrom: X-INJECTED";
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$part2["type"] = TYPEAPPLICATION;
$part2["encoding"] = ENCBINARY;
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
$part2["description"] = "some file\nContent-Type: X-INJECTED";
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
$part3["type"] = TYPETEXT;
$part3["subtype"] = "plain";
$part3["description"] = "description3";
$part3["contents.data"] = "contents.data3\n\n\n\t";
$body[1] = $part1;
$body[2] = $part2;
$body[3] = $part3;
echo imap_mail_compose($envelope, $body);
?>
--EXPECTF--
Warning: imap_mail_compose(): header injection attempt in from in %s on line %d
+37
View File
@@ -0,0 +1,37 @@
--TEST--
Bug #80710 (imap_mail_compose() header injection) - Remail
--SKIPIF--
<?php
if (!extension_loaded("imap")) die("skip imap extension not available");
?>
--FILE--
<?php
$envelope["from"]= "joe@example.com\n From : X-INJECTED";
$envelope["to"] = "foo@example.com\nFrom: X-INJECTED";
$envelope["cc"] = "bar@example.com\nFrom: X-INJECTED";
$envelope["subject"] = "bar@example.com\n\n From : X-INJECTED";
$envelope["remail"] = "X-INJECTED-REMAIL: X-INJECTED\nFrom: X-INJECTED-REMAIL-FROM"; //<--- Injected as first hdr
$envelope["something"] = "bar@example.com\nFrom: X-INJECTED";
$part1["type"] = TYPEMULTIPART;
$part1["subtype"] = "mixed";
$part2["type"] = TYPEAPPLICATION;
$part2["encoding"] = ENCBINARY;
$part2["subtype"] = "octet-stream\nContent-Type: X-INJECTED";
$part2["description"] = "some file\nContent-Type: X-INJECTED";
$part2["contents.data"] = "ABC\nContent-Type: X-INJECTED";
$part3["type"] = TYPETEXT;
$part3["subtype"] = "plain";
$part3["description"] = "description3";
$part3["contents.data"] = "contents.data3\n\n\n\t";
$body[1] = $part1;
$body[2] = $part2;
$body[3] = $part3;
echo imap_mail_compose($envelope, $body);
?>
--EXPECTF--
Warning: imap_mail_compose(): header injection attempt in remail in %s on line %d
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #80800: imap_open() fails when the flags parameter includes CL_EXPUNGE
--SKIPIF--
<?php
require_once(__DIR__.'/setup/skipif.inc');
?>
--FILE--
<?php
require_once __DIR__.'/setup/imap_include.inc';
$mail_box = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, flags: CL_EXPUNGE);
var_dump(imap_reopen($mail_box, IMAP_DEFAULT_MAILBOX, flags: CL_EXPUNGE));
imap_close($mail_box);
echo 'Connected without any issues', "\n";
?>
--EXPECT--
bool(true)
Connected without any issues
@@ -0,0 +1,43 @@
--TEST--
Test imap_open() using the CL_EXPUNGE flag
--SKIPIF--
<?php
require_once(__DIR__.'/setup/skipif.inc');
?>
--FILE--
<?php
// include file for required variables in imap_open()
require_once(__DIR__.'/setup/imap_include.inc');
// set up temp mailbox with 3 messages
$stream_id = setup_test_mailbox('imapopenwithclexpunge', 3, $mailbox, flags: CL_EXPUNGE);
// mark messages in inbox for deletion
for ($i = 1; $i < 4; $i++) {
imap_delete($stream_id, $i);
}
echo "\n-- Call to imap_close() --\n";
var_dump( imap_close($stream_id) );
// check that CL_EXPUNGE in previous imap_open() call worked
$stream_id = imap_open($mailbox, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
// Close connection
var_dump( imap_close($stream_id) );
?>
--CLEAN--
<?php
$mailbox_suffix = 'imapopenwithclexpunge';
require_once(__DIR__.'/setup/clean.inc');
?>
--EXPECTF--
Create a temporary mailbox and add 3 msgs
New mailbox created
-- Call to imap_close() --
bool(true)
There are now 0 msgs in mailbox '%sINBOX.phpttestimapopenwithclexpunge'
bool(true)
@@ -0,0 +1,48 @@
--TEST--
Test imap_reopen() using the CL_EXPUNGE flag
--SKIPIF--
<?php
require_once(__DIR__.'/setup/skipif.inc');
?>
--FILE--
<?php
// include file for required variables in imap_open()
require_once(__DIR__.'/setup/imap_include.inc');
$mailbox_suffix = 'imapreopenwithclexpunge';
// set up temp mailbox with 3 messages
$stream_id = setup_test_mailbox($mailbox_suffix , 3, $mailbox);
var_dump(imap_reopen($stream_id, IMAP_DEFAULT_MAILBOX . '.' . IMAP_MAILBOX_PHPT_PREFIX . $mailbox_suffix, flags: CL_EXPUNGE));
// mark messages in inbox for deletion
for ($i = 1; $i < 4; $i++) {
imap_delete($stream_id, $i);
}
echo "\n-- Call to imap_close() --\n";
var_dump( imap_close($stream_id) );
// check that CL_EXPUNGE in previous imap_reopen() call worked
$stream_id = imap_open($mailbox, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
echo "There are now " . imap_num_msg($stream_id) . " msgs in mailbox '$mailbox'\n";
// Close connection
var_dump( imap_close($stream_id) );
?>
--CLEAN--
<?php
$mailbox_suffix = 'imapreopenwithclexpunge';
require_once(__DIR__.'/setup/clean.inc');
?>
--EXPECTF--
Create a temporary mailbox and add 3 msgs
New mailbox created
bool(true)
-- Call to imap_close() --
bool(true)
There are now 0 msgs in mailbox '%sINBOX.phpttestimapreopenwithclexpunge'
bool(true)
+9 -2
View File
@@ -63,12 +63,19 @@ function displayOverviewFields($resp, array $fields = MANDATORY_OVERVIEW_FIELDS)
* @param int message_count number of test msgs to be written to new mailbox
* @param null $new_mailbox
* @param bool $simpleMessages
* @param int $flags OP_* (or CL_EXPUNGE) flags to pass to imap_open() sub-call
* @return resource IMAP stream to new mailbox
* @throws Exception
*/
function setup_test_mailbox(string $mailbox_suffix, int $message_count, &$new_mailbox = null, bool $simpleMessages = true){
function setup_test_mailbox(
string $mailbox_suffix,
int $message_count,
&$new_mailbox = null,
bool $simpleMessages = true,
int $flags = 0,
){
// open a stream to default mailbox
$imap_stream = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD);
$imap_stream = imap_open(IMAP_DEFAULT_MAILBOX, IMAP_MAILBOX_USERNAME, IMAP_MAILBOX_PASSWORD, flags: $flags);
if ($imap_stream === false) {
throw new Exception("Cannot connect to IMAP server " . IMAP_SERVER . ": " . imap_last_error());
+4
View File
@@ -173,6 +173,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func)
return ZEND_NAN;
}
try_again:
switch (Z_TYPE_P(z)) {
case IS_STRING:
type = is_numeric_string(Z_STRVAL_P(z), Z_STRLEN_P(z), &lv, &rv, 0);
@@ -225,6 +226,9 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func)
efree(message);
}
break;
case IS_REFERENCE:
z = Z_REFVAL_P(z);
goto try_again;
default:
spprintf(&message, 0, "%s: invalid PHP type for date", func);
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR,
+2 -2
View File
@@ -11,7 +11,7 @@ class UConverter
/**
* @param int $error
* @return string|null
* @return string|int|array|null
*/
public function fromUCallback(int $reason, array $source, int $codePoint, &$error) {}
@@ -59,7 +59,7 @@ class UConverter
/**
* @param int $error
* @return string|null
* @return string|int|array|null
*/
public function toUCallback(int $reason, string $source, string $codeUnits, &$error) {}
+1 -1
View File
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: e33e2614c969c59b79c6062f7a347a8e8e486d85 */
* Stub hash: 07a152ecebadf8f1766fb231cd60bfefda0dd6a6 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_UConverter___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, destination_encoding, IS_STRING, 1, "null")
+1
View File
@@ -77,6 +77,7 @@ zend_object *IntlDateFormatter_object_clone(zend_object *object)
zend_object *new_obj;
dfo = php_intl_dateformatter_fetch_object(object);
intl_error_reset(INTL_DATA_ERROR_P(dfo));
new_obj = IntlDateFormatter_ce_ptr->create_object(object->ce);
new_dfo = php_intl_dateformatter_fetch_object(new_obj);
+2
View File
@@ -64,6 +64,8 @@ zend_object *NumberFormatter_object_clone(zend_object *object)
zend_object *new_obj;
nfo = php_intl_number_format_fetch_object(object);
intl_error_reset(INTL_DATA_ERROR_P(nfo));
new_obj = NumberFormatter_ce_ptr->create_object(object->ce);
new_nfo = php_intl_number_format_fetch_object(new_obj);
/* clone standard parts */
+2
View File
@@ -62,6 +62,8 @@ zend_object *MessageFormatter_object_clone(zend_object *object)
zend_object *new_obj;
mfo = php_intl_messageformatter_fetch_object(object);
intl_error_reset(INTL_DATA_ERROR_P(mfo));
new_obj = MessageFormatter_ce_ptr->create_object(object->ce);
new_mfo = php_intl_messageformatter_fetch_object(new_obj);
/* clone standard parts */
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #80763 (msgfmt_format() does not accept DateTime references)
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not available');
?>
--FILE--
<?php
$today = new DateTime('2021-02-17 12:00:00');
$formatter = new \MessageFormatter('en_US', 'Today is {today, date, full}.');
$params = ['today' => $today];
array_walk($params, fn() => 1);
var_dump($formatter->format($params));
?>
--EXPECT--
string(38) "Today is Wednesday, February 17, 2021."
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #81019: Unable to clone NumberFormatter after failed parse()
--FILE--
<?php
$fmt = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
$fmt->parse('abc');
$fmt2 = clone $fmt;
$datefmt = new IntlDateFormatter('en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL);
$datefmt->parse('abc');
$datefmt2 = clone $datefmt;
$msgfmt = new MessageFormatter('en_US', '{0,number,integer}');
$msgfmt->parse('abc');
$msgfmt2 = clone $msgfmt;
?>
===DONE===
--EXPECT--
===DONE===
+4
View File
@@ -1602,11 +1602,15 @@ cleanup_parallel:
if (!base_dn_str) {
zend_argument_type_error(2, "must be of type string when argument #1 ($ldap) is a resource");
ret = 0;
goto cleanup;
}
ldap_base_dn = zend_string_copy(base_dn_str);
if (!filter_str) {
zend_argument_type_error(3, "must be of type string when argument #1 ($ldap) is a resource");
ret = 0;
goto cleanup;
}
ldap_filter = zend_string_copy(filter_str);
+2 -2
View File
@@ -70,10 +70,10 @@ function ldap_first_entry($ldap, $result) {}
/**
* @param resource $ldap
* @param resource $result
* @param resource $entry
* @return resource|false
*/
function ldap_next_entry($ldap, $result) {}
function ldap_next_entry($ldap, $entry) {}
/**
* @param resource $ldap
+5 -2
View File
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 9d6315aeee2e3a1be51c05b65a960ed433bbe4ec */
* Stub hash: 9e097927708f5f1d0a2ed8267422e6095e8583b0 */
#if defined(HAVE_ORALDAP)
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0)
@@ -78,7 +78,10 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2)
ZEND_ARG_INFO(0, result)
ZEND_END_ARG_INFO()
#define arginfo_ldap_next_entry arginfo_ldap_first_entry
ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_entry, 0, 0, 2)
ZEND_ARG_INFO(0, ldap)
ZEND_ARG_INFO(0, entry)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_entries, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, ldap)
+14
View File
@@ -39,6 +39,18 @@ try {
echo $exception->getMessage() . "\n";
}
try {
ldap_search($link, [], []);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
ldap_search($link, "", []);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
?>
--EXPECTF--
Warning: ldap_search(): Search: No such object in %s on line %d
@@ -49,3 +61,5 @@ bool(false)
ldap_search(): Argument #1 ($ldap) cannot be empty
ldap_search(): Argument #2 ($base) must have the same number of elements as the links array
ldap_search(): Argument #3 ($filter) must have the same number of elements as the links array
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is a resource
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is a resource
+49 -1
View File
@@ -361,6 +361,54 @@ php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc)
return(NULL);
}
/* Check if there's been an external transport protocol with an encoding information */
if (enc == XML_CHAR_ENCODING_NONE) {
php_stream *s = (php_stream *) context;
if (Z_TYPE(s->wrapperdata) == IS_ARRAY) {
zval *header;
ZEND_HASH_FOREACH_VAL_IND(Z_ARRVAL(s->wrapperdata), header) {
const char buf[] = "Content-Type:";
if (Z_TYPE_P(header) == IS_STRING &&
!zend_binary_strncasecmp(Z_STRVAL_P(header), Z_STRLEN_P(header), buf, sizeof(buf)-1, sizeof(buf)-1)) {
char *needle = estrdup("charset=");
char *haystack = estrndup(Z_STRVAL_P(header), Z_STRLEN_P(header));
char *encoding = php_stristr(haystack, needle, Z_STRLEN_P(header), sizeof("charset=")-1);
if (encoding) {
char *end;
encoding += sizeof("charset=")-1;
if (*encoding == '"') {
encoding++;
}
end = strchr(encoding, ';');
if (end == NULL) {
end = encoding + strlen(encoding);
}
end--; /* end == encoding-1 isn't a buffer underrun */
while (*end == ' ' || *end == '\t') {
end--;
}
if (*end == '"') {
end--;
}
if (encoding >= end) continue;
*(end+1) = '\0';
enc = xmlParseCharEncoding(encoding);
if (enc <= XML_CHAR_ENCODING_NONE) {
enc = XML_CHAR_ENCODING_NONE;
}
}
efree(haystack);
efree(needle);
break; /* found content-type */
}
} ZEND_HASH_FOREACH_END();
}
}
/* Allocate the Input buffer front-end. */
ret = xmlAllocParserInputBuffer(enc);
if (ret != NULL) {
@@ -1110,7 +1158,7 @@ PHP_FUNCTION(libxml_set_external_entity_loader)
/* {{{ Common functions shared by extensions */
int php_libxml_xmlCheckUTF8(const unsigned char *s)
{
int i;
size_t i;
unsigned char c;
for (i = 0; (c = s[i++]);) {
+38
View File
@@ -0,0 +1,38 @@
--TEST--
Bug #51903 (simplexml_load_file() doesn't use HTTP headers)
--SKIPIF--
<?php
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
if (@!include "./ext/standard/tests/http/server.inc") die('skip server.inc not available');
http_server_skipif();
?>
--FILE--
<?php
require "./ext/standard/tests/http/server.inc";
$responses = [
"data://text/plain,HTTP/1.1 200 OK\r\n"
. "Content-Type: text/xml; charset=ISO-8859-1\r\n\r\n"
. "<?xml version=\"1.0\"?>\n"
. "<root>\xE4\xF6\xFC</root>\n",
"data://text/plain,HTTP/1.1 200 OK\r\n"
. "Content-Type: text/xml; charset=ISO-8859-1; foo=bar\r\n\r\n"
. "<?xml version=\"1.0\"?>\n"
. "<root>\xE4\xF6\xFC</root>\n",
"data://text/plain,HTTP/1.1 200 OK\r\n"
. "Content-Type: text/xml; charset=\"ISO-8859-1\" ; foo=bar\r\n\r\n"
. "<?xml version=\"1.0\"?>\n"
. "<root>\xE4\xF6\xFC</root>\n",
];
['pid' => $pid, 'uri' => $uri] = http_server($responses);
for ($i = 0; $i < count($responses); $i++) {
$sxe = simplexml_load_file($uri);
echo "$sxe\n";
}
http_server_kill($pid);
?>
--EXPECT--
äöü
äöü
äöü
+4
View File
@@ -2451,6 +2451,7 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
}
/* convert value */
ZEND_ASSERT(entry);
try_again:
switch(Z_TYPE_P(entry)) {
case IS_STRING:
cval = php_mb_convert_encoding(
@@ -2475,6 +2476,9 @@ MBSTRING_API HashTable *php_mb_convert_encoding_recursive(HashTable *input, cons
ZVAL_EMPTY_ARRAY(&entry_tmp);
}
break;
case IS_REFERENCE:
entry = Z_REFVAL_P(entry);
goto try_again;
case IS_OBJECT:
default:
if (key) {
+85
View File
@@ -0,0 +1,85 @@
--TEST--
Bug #81011 (mb_convert_encoding removes references from arrays)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die("skip mbstring extension not available");
?>
--FILE--
<?php
$array = [
'ads' => [
123 => ['name' => 'this', 'id' => 444],
234 => ['name' => 'that', 'id' => 555],
],
'other' => ['one', 'two']
];
// we modify array elements using reference
foreach( $array['ads'] as &$ad ){
$ad['premium'] = (int)($ad['id'] == 555);
}
var_dump($array);
var_dump(mb_convert_encoding($array, 'UTF-8', 'UTF-8'));
?>
--EXPECT--
array(2) {
["ads"]=>
array(2) {
[123]=>
array(3) {
["name"]=>
string(4) "this"
["id"]=>
int(444)
["premium"]=>
int(0)
}
[234]=>
&array(3) {
["name"]=>
string(4) "that"
["id"]=>
int(555)
["premium"]=>
int(1)
}
}
["other"]=>
array(2) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
}
}
array(2) {
["ads"]=>
array(2) {
[123]=>
array(3) {
["name"]=>
string(4) "this"
["id"]=>
int(444)
["premium"]=>
int(0)
}
[234]=>
array(3) {
["name"]=>
string(4) "that"
["id"]=>
int(555)
["premium"]=>
int(1)
}
}
["other"]=>
array(2) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
}
}
+1 -1
View File
@@ -113,7 +113,7 @@ class mysqli
public function get_warnings() {}
/**
* @return mysqli|false
* @return null|false
*/
public function init() {}
+1 -1
View File
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 36c7ee22aa4c5bb5e0174031a3defcaaadde0dbd */
* Stub hash: c2ab263780902447855ecb0d8a9e3432577a32d1 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mysqli_affected_rows, 0, 1, MAY_BE_LONG|MAY_BE_STRING)
ZEND_ARG_OBJ_INFO(0, mysql, mysqli, 0)
+38
View File
@@ -0,0 +1,38 @@
--TEST--
Bug #80837 Calling stmt_store_result after fetch doesn't throw an error
--SKIPIF--
<?php
require_once 'skipif.inc';
require_once 'skipifconnectfailure.inc';
if (!defined('MYSQLI_STORE_RESULT_COPY_DATA')) die('skip requires mysqlnd');
?>
--FILE--
<?php
require_once "connect.inc";
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
$mysqli->query('DROP TABLE IF EXISTS test');
$mysqli->query('CREATE TABLE test (b int)');
$mysqli->query('INSERT INTO test VALUES (1),(2),(3)');
$statement = $mysqli->prepare("SELECT b FROM test");
$statement->execute();
$statement->bind_result($name);
$statement->fetch();
try {
$statement->store_result();
} catch (mysqli_sql_exception $e) {
echo $e->getMessage();
}
$mysqli->close();
?>
--CLEAN--
<?php
require_once "clean_table.inc";
?>
--EXPECTF--
Commands out of sync; you can't run this command now
+2 -2
View File
@@ -101,8 +101,8 @@ max_execution_time=240
require_once('table.inc');
if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) {
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
printf("[001] Cannot connect to the server using host=%s, user=pamtest, passwd=pamtest dbname=%s, port=%s, socket=%s\n",
$host, $db, $port, $socket);
} else {
if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+1 -1
View File
@@ -89,7 +89,7 @@ MYSQLND_METHOD(mysqlnd_stmt, store_result)(MYSQLND_STMT * const s)
/* Nothing to store for UPSERT/LOAD DATA*/
if (!mysqlnd_stmt_check_state(stmt)) {
SET_CLIENT_ERROR(conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
SET_CLIENT_ERROR(stmt->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE, mysqlnd_out_of_sync);
DBG_RETURN(NULL);
}
+6 -3
View File
@@ -22,8 +22,11 @@ function oci_bind_by_name($statement, string $param, mixed &$var, int $max_lengt
*/
function ocibindbyname($statement, string $param, mixed &$var, int $max_length = -1, int $type = 0): bool {}
/** @param resource $statement */
function oci_bind_array_by_name($statement, string $param, mixed &$var, int $max_array_length, int $max_item_length = -1, int $type = SQLT_AFC): bool {}
/**
* @param resource $statement
* @param array $var
*/
function oci_bind_array_by_name($statement, string $param, &$var, int $max_array_length, int $max_item_length = -1, int $type = SQLT_AFC): bool {}
function oci_free_descriptor(OCILob $lob): bool {}
@@ -247,7 +250,7 @@ function oci_fetch_all($statement, &$output, int $offset = 0, int $limit = -1, i
function ocifetchstatement($statement, &$output, int $offset = 0, int $limit = -1, int $flags = 0): int {}
/** @param resource $statement */
function oci_fetch_object($statement, int $mode = PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS): stdClass|null|false {}
function oci_fetch_object($statement, int $mode = PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS): stdClass|false {}
/** @param resource $statement */
function oci_fetch_row($statement): array|false {}
+3 -3
View File
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: e7a7a9402b2668136f9f47d6e547e3af46a78a50 */
* Stub hash: 7355ccbef6b490db7ddec94d485fbfb4597c3150 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_define_by_name, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
@@ -23,7 +23,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_oci_bind_array_by_name, 0, 4, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO(0, param, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(1, var, IS_MIXED, 0)
ZEND_ARG_INFO(1, var)
ZEND_ARG_TYPE_INFO(0, max_array_length, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max_item_length, IS_LONG, 0, "-1")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_LONG, 0, "SQLT_AFC")
@@ -221,7 +221,7 @@ ZEND_END_ARG_INFO()
#define arginfo_ocifetchstatement arginfo_oci_fetch_all
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_fetch_object, 0, 1, stdClass, MAY_BE_NULL|MAY_BE_FALSE)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_oci_fetch_object, 0, 1, stdClass, MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PHP_OCI_ASSOC | PHP_OCI_RETURN_NULLS")
ZEND_END_ARG_INFO()
+36 -1
View File
@@ -1447,6 +1447,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
} else if (result->values[i].vallen == SQL_NULL_DATA) {
ZVAL_NULL(&tmp);
break;
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
ZVAL_FALSE(&tmp);
} else {
ZVAL_STRINGL(&tmp, buf, result->values[i].vallen);
}
@@ -1456,6 +1459,10 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
if (result->values[i].vallen == SQL_NULL_DATA) {
ZVAL_NULL(&tmp);
break;
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
ZVAL_FALSE(&tmp);
break;
}
ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen);
break;
@@ -1600,6 +1607,9 @@ PHP_FUNCTION(odbc_fetch_into)
} else if (result->values[i].vallen == SQL_NULL_DATA) {
ZVAL_NULL(&tmp);
break;
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
ZVAL_FALSE(&tmp);
} else {
ZVAL_STRINGL(&tmp, buf, result->values[i].vallen);
}
@@ -1609,6 +1619,10 @@ PHP_FUNCTION(odbc_fetch_into)
if (result->values[i].vallen == SQL_NULL_DATA) {
ZVAL_NULL(&tmp);
break;
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", i + 1);
ZVAL_FALSE(&tmp);
break;
}
ZVAL_STRINGL(&tmp, result->values[i].value, result->values[i].vallen);
break;
@@ -1836,6 +1850,10 @@ PHP_FUNCTION(odbc_result)
} else if (result->values[field_ind].vallen == SQL_NULL_DATA) {
zend_string_efree(field_str);
RETURN_NULL();
} else if (result->values[field_ind].vallen == SQL_NO_TOTAL) {
zend_string_efree(field_str);
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", field_ind + 1);
RETURN_FALSE;
}
/* Reduce fieldlen by 1 if we have char data. One day we might
have binary strings... */
@@ -1859,6 +1877,9 @@ PHP_FUNCTION(odbc_result)
default:
if (result->values[field_ind].vallen == SQL_NULL_DATA) {
RETURN_NULL();
} else if (result->values[field_ind].vallen == SQL_NO_TOTAL) {
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", field_ind + 1);
RETURN_FALSE;
} else {
RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen);
}
@@ -1890,6 +1911,10 @@ PHP_FUNCTION(odbc_result)
if (result->values[field_ind].vallen == SQL_NULL_DATA) {
efree(field);
RETURN_NULL();
} else if (result->values[field_ind].vallen == SQL_NO_TOTAL) {
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%d (driver cannot determine length)", field_ind + 1);
efree(field);
RETURN_FALSE;
}
/* chop the trailing \0 by outputting only 4095 bytes */
PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 : result->values[field_ind].vallen);
@@ -1994,7 +2019,14 @@ PHP_FUNCTION(odbc_result_all)
RETURN_FALSE;
}
if (rc == SQL_SUCCESS_WITH_INFO) {
PHPWRITE(buf, result->longreadlen);
if (result->values[i].vallen == SQL_NO_TOTAL) {
php_printf("</td></tr></table>");
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%zu (driver cannot determine length)", i + 1);
efree(buf);
RETURN_FALSE;
} else {
PHPWRITE(buf, result->longreadlen);
}
} else if (rc != SQL_SUCCESS) {
php_printf("</td></tr></table>");
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%zu (retcode %u)", i + 1, rc);
@@ -2011,6 +2043,9 @@ PHP_FUNCTION(odbc_result_all)
default:
if (result->values[i].vallen == SQL_NULL_DATA) {
php_printf("<td>NULL</td>");
} else if (result->values[i].vallen == SQL_NO_TOTAL) {
php_error_docref(NULL, E_WARNING, "Cannot get data of column #%zu (driver cannot determine length)", i + 1);
php_printf("<td>FALSE</td>");
} else {
php_printf("<td>%s</td>", result->values[i].value);
}
+36 -10
View File
@@ -113,6 +113,41 @@ static uint32_t add_static_slot(HashTable *hash,
return ret;
}
static zend_string *create_str_cache_key(zval *literal, uint32_t flags)
{
ZEND_ASSERT(Z_TYPE_P(literal) == IS_STRING);
uint32_t num_related = LITERAL_NUM_RELATED(flags);
if (num_related == 1) {
return zend_string_copy(Z_STR_P(literal));
}
if ((flags & LITERAL_KIND_MASK) == LITERAL_VALUE) {
/* Don't merge LITERAL_VALUE that has related literals */
return NULL;
}
/* Concatenate all the related literals for the cache key. */
zend_string *key;
if (num_related == 2) {
ZEND_ASSERT(Z_TYPE_P(literal + 1) == IS_STRING);
key = zend_string_concat2(
Z_STRVAL_P(literal), Z_STRLEN_P(literal),
Z_STRVAL_P(literal + 1), Z_STRLEN_P(literal + 1));
} else if (num_related == 3) {
ZEND_ASSERT(Z_TYPE_P(literal + 1) == IS_STRING && Z_TYPE_P(literal + 2) == IS_STRING);
key = zend_string_concat3(
Z_STRVAL_P(literal), Z_STRLEN_P(literal),
Z_STRVAL_P(literal + 1), Z_STRLEN_P(literal + 1),
Z_STRVAL_P(literal + 2), Z_STRLEN_P(literal + 2));
} else {
ZEND_ASSERT(0 && "Currently not needed");
}
/* Add a bias to the hash so we can distinguish keys
* that would otherwise be the same after concatenation. */
ZSTR_H(key) = zend_string_hash_val(key) + num_related - 1;
return key;
}
void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx *ctx)
{
zend_op *opline, *end;
@@ -407,16 +442,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
}
break;
case IS_STRING: {
if (LITERAL_NUM_RELATED(info[i].flags) == 1) {
key = zend_string_copy(Z_STR(op_array->literals[i]));
} else if ((info[i].flags & LITERAL_KIND_MASK) != LITERAL_VALUE) {
key = zend_string_init(Z_STRVAL(op_array->literals[i]), Z_STRLEN(op_array->literals[i]), 0);
ZSTR_H(key) = ZSTR_HASH(Z_STR(op_array->literals[i])) +
LITERAL_NUM_RELATED(info[i].flags) - 1;
} else {
/* Don't merge LITERAL_VALUE that has related literals */
key = NULL;
}
key = create_str_cache_key(&op_array->literals[i], info[i].flags);
if (key && (pos = zend_hash_find(&hash, key)) != NULL &&
Z_TYPE(op_array->literals[Z_LVAL_P(pos)]) == IS_STRING &&
LITERAL_NUM_RELATED(info[i].flags) == LITERAL_NUM_RELATED(info[Z_LVAL_P(pos)].flags) &&
+19 -6
View File
@@ -373,6 +373,10 @@ static zend_bool try_remove_var_def(context *ctx, int free_var, int use_chain, z
return 0;
}
static zend_always_inline zend_bool may_be_refcounted(uint32_t type) {
return (type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) != 0;
}
/* Returns whether the instruction has been DCEd */
static zend_bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) {
zend_ssa *ssa = ctx->ssa;
@@ -384,17 +388,15 @@ static zend_bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) {
}
/* We mark FREEs as dead, but they're only really dead if the destroyed var is dead */
if (opline->opcode == ZEND_FREE
&& (ssa->var_info[ssa_op->op1_use].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF))
if (opline->opcode == ZEND_FREE && may_be_refcounted(ssa->var_info[ssa_op->op1_use].type)
&& !is_var_dead(ctx, ssa_op->op1_use)) {
return 0;
}
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR))&& !is_var_dead(ctx, ssa_op->op1_use)) {
if (!try_remove_var_def(ctx, ssa_op->op1_use, ssa_op->op1_use_chain, opline)) {
if (ssa->var_info[ssa_op->op1_use].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)
&& opline->opcode != ZEND_CASE
&& opline->opcode != ZEND_CASE_STRICT) {
if (may_be_refcounted(ssa->var_info[ssa_op->op1_use].type)
&& opline->opcode != ZEND_CASE && opline->opcode != ZEND_CASE_STRICT) {
free_var = ssa_op->op1_use;
free_var_type = opline->op1_type;
}
@@ -402,7 +404,7 @@ static zend_bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) {
}
if ((opline->op2_type & (IS_VAR|IS_TMP_VAR)) && !is_var_dead(ctx, ssa_op->op2_use)) {
if (!try_remove_var_def(ctx, ssa_op->op2_use, ssa_op->op2_use_chain, opline)) {
if (ssa->var_info[ssa_op->op2_use].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
if (may_be_refcounted(ssa->var_info[ssa_op->op2_use].type)) {
if (free_var >= 0) {
// TODO: We can't free two vars. Keep instruction alive.
zend_bitset_excl(ctx->instr_dead, opline - ctx->op_array->opcodes);
@@ -509,6 +511,17 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reor
ctx.phi_dead = alloca(sizeof(zend_ulong) * ctx.phi_worklist_len);
memset(ctx.phi_dead, 0xff, sizeof(zend_ulong) * ctx.phi_worklist_len);
/* Mark non-CV phis as live. Even if the result is unused, we generally cannot remove one
* of the producing instructions, as it combines producing the result with control flow.
* This can be made more precise if there are any cases where this is not the case. */
FOREACH_PHI(phi) {
if (phi->var >= op_array->last_var
&& may_be_refcounted(ssa->var_info[phi->ssa_var].type)) {
zend_bitset_excl(ctx.phi_dead, phi->ssa_var);
add_phi_sources_to_worklists(&ctx, phi, 0);
}
} FOREACH_PHI_END();
/* Mark reacable instruction without side effects as dead */
int b = ssa->cfg.blocks_count;
while (b > 0) {
+1 -1
View File
@@ -1983,7 +1983,7 @@ static void sccp_mark_feasible_successors(
scdf_mark_edge_feasible(scdf, block_num, target);
return;
}
s = 0;
s = block->successors_count - 1;
break;
}
default:
+6 -9
View File
@@ -212,7 +212,7 @@ static const func_info_t func_infos[] = {
F1("base64_decode", MAY_BE_FALSE | MAY_BE_STRING),
F1("base64_encode", MAY_BE_STRING),
F1("password_hash", MAY_BE_STRING),
F1("password_get_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("password_get_info", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("convert_uuencode", MAY_BE_STRING),
F1("convert_uudecode", MAY_BE_FALSE | MAY_BE_STRING),
F1("pow", MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_OBJECT),
@@ -382,7 +382,6 @@ static const func_info_t func_infos[] = {
F1("array_count_values", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
F1("array_column", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_reverse", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_reduce", UNKNOWN_INFO),
F1("array_flip", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
F1("array_change_key_case", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
FN("array_rand", MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
@@ -404,8 +403,6 @@ static const func_info_t func_infos[] = {
F1("array_filter", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_chunk", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("array_combine", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_ARRAY_OF_ANY),
F1("pos", UNKNOWN_INFO),
F1("assert_options", MAY_BE_NULL | MAY_BE_LONG | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_OBJECT | MAY_BE_OBJECT),
F1("str_rot13", MAY_BE_STRING),
F1("stream_get_filters", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
F1("stream_bucket_make_writeable", MAY_BE_NULL | MAY_BE_OBJECT),
@@ -418,7 +415,7 @@ static const func_info_t func_infos[] = {
F1("strftime", MAY_BE_FALSE | MAY_BE_STRING),
F1("gmstrftime", MAY_BE_FALSE | MAY_BE_STRING),
F1("localtime", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG),
F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
F1("getdate", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_STRING),
F1("date_create", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_immutable", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("date_create_from_format", MAY_BE_FALSE | MAY_BE_OBJECT),
@@ -461,7 +458,7 @@ static const func_info_t func_infos[] = {
F1("mysqli_query", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_OBJECT),
F1("mysqli_get_charset", MAY_BE_NULL | MAY_BE_OBJECT),
F1("mysqli_fetch_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("mysqli_fetch_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("mysqli_fetch_assoc", MAY_BE_NULL | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("mysqli_fetch_all", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("mysqli_fetch_object", MAY_BE_NULL | MAY_BE_OBJECT),
F1("mysqli_affected_rows", MAY_BE_LONG | MAY_BE_STRING),
@@ -686,7 +683,7 @@ static const func_info_t func_infos[] = {
F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/pgsql */
F1("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pg_pconnect", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_dbname", MAY_BE_STRING),
F1("pg_last_error", MAY_BE_STRING),
@@ -707,7 +704,7 @@ static const func_info_t func_infos[] = {
F1("pg_field_type_oid", MAY_BE_LONG | MAY_BE_STRING),
F1("pg_fetch_result", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_fetch_row", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
F1("pg_fetch_assoc", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
F1("pg_fetch_assoc", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
F1("pg_fetch_array", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
F1("pg_fetch_object", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_fetch_all", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),
@@ -755,7 +752,7 @@ static const func_info_t func_infos[] = {
FN("filter_input", UNKNOWN_INFO),
FN("filter_var", UNKNOWN_INFO),
F1("filter_input_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("filter_var_array", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF),
F1("filter_list", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
/* ext/gettext */
+15 -4
View File
@@ -1941,6 +1941,18 @@ static void add_usages(const zend_op_array *op_array, zend_ssa *ssa, zend_bitset
if (op->op2_def >= 0) {
zend_bitset_incl(worklist, op->op2_def);
}
} else if (use + 1 < op_array->last
&& op_array->opcodes[use + 1].opcode == ZEND_OP_DATA) {
op++;
if (op->result_def >= 0) {
zend_bitset_incl(worklist, op->result_def);
}
if (op->op1_def >= 0) {
zend_bitset_incl(worklist, op->op1_def);
}
if (op->op2_def >= 0) {
zend_bitset_incl(worklist, op->op2_def);
}
}
use = zend_ssa_next_use(ssa->ops, var, use);
} while (use >= 0);
@@ -2316,10 +2328,6 @@ static uint32_t zend_fetch_prop_type(const zend_script *script, zend_property_in
}
if (prop_info && ZEND_TYPE_IS_SET(prop_info->type)) {
uint32_t type = zend_convert_type_declaration_mask(ZEND_TYPE_PURE_MASK(prop_info->type));
if (type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
type |= MAY_BE_RC1 | MAY_BE_RCN;
}
if (ZEND_TYPE_HAS_CLASS(prop_info->type)) {
type |= MAY_BE_OBJECT;
if (pce) {
@@ -2332,6 +2340,9 @@ static uint32_t zend_fetch_prop_type(const zend_script *script, zend_property_in
}
}
}
if (type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE)) {
type |= MAY_BE_RC1 | MAY_BE_RCN;
}
return type;
}
return MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF | MAY_BE_RC1 | MAY_BE_RCN;
+8
View File
@@ -285,6 +285,14 @@ static void place_essa_pis(
default:
continue;
}
/* The following patterns all inspect the opline directly before the JMPZ opcode.
* Make sure that it is part of the same block, otherwise it might not be a dominating
* assignment. */
if (blocks[j].len == 1) {
continue;
}
if (opline->op1_type == IS_TMP_VAR &&
((opline-1)->opcode == ZEND_IS_EQUAL ||
(opline-1)->opcode == ZEND_IS_NOT_EQUAL ||
Loaded 100 of 266 files, more files were not shown because too many files have changed in this diff. Show more