Compare commits

..
367 Commits
Author SHA1 Message Date
Christoph M. Becker 98c8ad9218 7.3.29 is next 2021-04-27 16:55:20 +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 60a68a45c3 Add missing NEWS entry for #80710 2021-04-27 13:38:39 +02: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 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
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
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
Nikita Popov 06c9633b43 Fix newly introduced compiler warning
(cherry picked from commit ab8177de2c)
2021-02-03 12:42:28 +01:00
Christoph M. Becker 039ca4e219 7.3.28 is next 2021-02-02 17:01:55 +01:00
Christoph M. Becker 57257a4335 Revert "Updated to version 2021.1 (2021a)"
This reverts commit 491488d217, since
PHP-7.3 is in security mode, and this does not look security related.
2021-02-01 13:41:32 +01:00
Stanislav Malyshev 3c939e3f69 Fix bug #80672 - Null Dereference in SoapClient 2021-01-31 21:15:23 -08:00
Stanislav Malyshev 9c673083cd Rm unneeded function 2021-01-27 00:13:43 -08:00
Christoph M. Becker 4a89e726bd Alternative fix for bug 77423
That bug report originally was about `parse_url()` misbehaving, but the
security aspect was actually only regarding `FILTER_VALIDATE_URL`.
Since the changes to `parse_url_ex()` apparently affect userland code
which is relying on the sloppy URL parsing[1], this alternative
restores the old parsing behavior, but ensures that the userinfo is
checked for correctness for `FILTER_VALIDATE_URL`.

[1] <https://github.com/php/php-src/commit/5174de7cd33c3d4fa591c9c93859ff9989b07e8c#commitcomment-45967652>
2021-01-26 22:54:58 -08:00
Derick Rethans 491488d217 Updated to version 2021.1 (2021a) 2021-01-25 10:44:04 +00:00
Stanislav Malyshev 65d7ade684 [ci skip] Fix order 2021-01-04 01:45:15 -08:00
Stanislav Malyshev 8967e66559 [ci skip] Unpdate NEWS 2021-01-04 01:43:45 -08:00
Stanislav Malyshev 128fca4037 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77423: parse_url() will deliver a wrong host to user
2021-01-01 21:06:07 -08:00
Christoph M. Becker 2d3d72412a Fix #77423: parse_url() will deliver a wrong host to user
To avoid that `parse_url()` returns an erroneous host, which would be
valid for `FILTER_VALIDATE_URL`, we make sure that only userinfo which
is valid according to RFC 3986 is treated as such.

For consistency with the existing url parsing code, we use ctype
functions, although that is not necessarily correct.
2021-01-01 20:08:01 -08:00
Christoph M. Becker 40d9e3ab86 7.3.27 is next 2020-12-15 11:28:01 +01:00
Daniel Black 0697a64f7e Fix mysqli_expire_password test for mariadb
In MariaDB-10.4.3 EXPIRE passwords where supported for
MariaDB. This only behaves like MySQL when the system
variable disconnect_on_expired_passwords=1.

MariaDB if there was no password it could not be considered
expired. So the test is adjusted to use actual passwords.
(MariaDB commit a94b20a8e0d9e64eeaabdaaa7a3e03fcdb8a686e)

The error codes produced my MariaDB are different
however still conforming to the SQL specification.

Closes GH-6480.
2020-12-03 10:56:00 +01:00
Nikita Popov d6fcaf5da4 Fixed bug #80457
On x32 sizeof(size_t) != sizeof(zend_long), so we need to be
careful with sign extension here.

Patch by bruno dot premont at restena dot lu.
2020-12-02 11:26:10 +01:00
Jakub Zelenka 685708160e Fix test for bug62890 to not depend on system cert store 2020-11-27 16:32:43 +00:00
Daniel Black 4a10037cb4 Fix mysqli_get_client_stats test
MySQL removed RENAME DATABASE in 18300001c1dbbfddf9a0adcbaeea68956102bdd0
(Sept 2007, 5.1.23). As this briefest existance is very insignificant lets remove it.

It also breaks when testing against MariaDB.

As the alternate path in this test covers all supported MySQL and MariaDB
versions and a signifant portion of unsupported versions lets keep it simple.

Closes GH-6459.
2020-11-27 11:43:34 +01:00
Christoph M. Becker b5ce6df0da 7.3.26 is next 2020-11-10 11:08:16 +01:00
Alexander M. Turek 8eaaabdd58 Fixed bug #80310: Support for icu4c 68.1.
On stable versions, bring back the TRUE/FALSE defines by defining
_U_DEFINE_TRUE_AND_FALSE.

Closes GH-6397.
2020-11-09 14:31:29 +01:00
Christoph M. Becker 2cab085bb3 Fix #80266: parse_url silently drops port number 0
As of commit 81b2f3e[1], `parse_url()` accepts URLs with a zero port,
but does not report that port, what is wrong in hindsight.

Since the port number is stored as `unsigned short` there is no way to
distinguish between port zero and no port.  For BC reasons, we thus
introduce `parse_url_ex2()` which accepts an output parameter that
allows that distinction, and use the new function to fix the behavior.

The introduction of `parse_url_ex2()` has been suggested by Nikita.

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

Closes GH-6399.
2020-11-04 14:53:19 +01:00
Nikita Popov 00ba784a2c Fix another implicit function declaration in configure
As mentioned on bug #80171. This one is in libtool.m4, might get
lost on libtool updates.
2020-11-03 10:38:16 +01:00
Christoph M. Becker 9690ded288 Fix #70461: disable md5 code when it is not supported in net-snmp
Patch contributed by Alexander Bergmann.

Closes GH-6389.
2020-11-02 11:36:26 +01:00
Christoph M. Becker ee3227af48 Fix format specifier
In this function, `i` is of type `size_t`.
2020-10-29 13:08:16 +01:00
Christoph M. Becker c21e901ba7 Fix #44618: Fetching may rely on uninitialized data
Unless `SQLGetData()` returns `SQL_SUCCESS` or `SQL_SUCCESS_WITH_INFO`,
the `StrLen_or_IndPtr` output argument is not guaranteed to be properly
set.  Thus we handle retrieval failure other than `SQL_ERROR` by
yielding `false` for those column values and raising a warning.

Closes GH-6281.
2020-10-29 11:59:12 +01:00
Nikita Popov 7817fc07e1 Deny cloning of fileinfo objects
Using a cloned finfo object will crash.
2020-10-26 16:50:20 +01:00
Christoph M. Becker be6d72b3a4 Revert "Fix out-of-bounds write"
This reverts commit bf6873a18e.

CVE-2020-26159 is bogus; the "bug" was apparently a false positive
reported by Coverity, and the "fix" apparently wrong, see
<https://github.com/kkos/oniguruma/issues/221>.

Closes GH-6357.
2020-10-26 15:40:12 +01:00
Christoph M. Becker 6d2bc72530 Fix #80268: loadHTML() truncates at NUL bytes
libxml2 has no particular issues parsing HTML strings with NUL bytes;
these just cause truncation of the current text content, but parsing
continues generally.  Since `::loadHTMLFile()` already supports NUL
bytes, `::loadHTML()` should as well.

Note that this is different from XML, which does not allow any NUL
bytes.

Closes GH-6368.
2020-10-26 13:08:05 +01:00
Nikita Popov 824cbc2781 Declare may_retry_reparse_point on windows only 2020-10-26 12:40:45 +01:00
Christoph M. Becker 7424bfc7ac Fix #62474: com_event_sink crashes on certain arguments
We have to make sure that the variant is of type `VT_DISPATCH` before
we access it as such.

Closes GH-6372.
2020-10-26 11:48:57 +01:00
Christoph M. Becker 848e24f24d Fix #80258: Windows Deduplication Enabled, randon permission errors
A recent bug fix regarding symlinks claimed:

> After resolving reparse points, the path still may be a reparse
> point; in that case we have to resolve that reparse point as well.

While that is basically correct, some reparse points may point to
inaccessible system folders (e.g. `IO_REPARSE_TAG_DEDUP` points to
"\System Volume Information").  Since we don't know details about
arbitrary reparse points, and are mainly interested in nested symlinks,
we take a step back, and only resolve `IO_REPARSE_TAG_SYMLINK` for now.

Close GH-6354.
2020-10-26 11:21:14 +01:00
Christoph M. Becker 2be27074b6 Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
`ADD_EXTENSION_DEP()` relies on the `PHP_<extname>` config variables to
be set to `"yes"`, and since the standard and date extension are always
enabled, we define the respective variables uncoditionally.

Closes GH-6383.
2020-10-26 11:03:05 +01:00
George Peter Banyard 12a09183b3 Fix bug 76618
Apply patch which was attached to the bug in July 2018
2020-10-22 17:01:48 +01:00
Nikita Popov d4bf0799b8 Don't crash on uninitialized tidy object
"Uninitialized" here means that the object was created ordinarily
-- no constructor skipping involved. Most tidy methods seem to
handle this fine, but these three need to be guarded.
2020-10-22 16:04:22 +02:00
Derick Rethans d4200ba6cf Updated to version 2020.4 (2020d) 2020-10-22 10:12:24 +01:00
Christoph M. Becker 315b95b065 Fix #80242: imap_mail_compose() segfaults for multipart with rfc822
libc-client expects `TYPEMESSAGE` with an explicit subtype of `RFC822`
to have a `nested.msg` (otherwise there will be a segfault during
free), but not to have any `contents.text.data` (this will leak
otherwise).

Closes GH-6345.
2020-10-20 18:58:45 +02:00
Christoph M. Becker de58fb34c9 Add char* cast to avoid compiler warnings
In libc-client 2007f `data` is declared as `unsigned char *`; there may
be variants which declare it as `void *`, but in any case picky
compilers may warn about a pointer type mismatch in the conditional
(and error with `-W-error`), so we're adding a `char *` cast for good
measure.
2020-10-20 16:29:42 +02:00
Christoph M. Becker 7f3bdda29b Properly fix #80220
The original fix for that bug[1] broke the formerly working composition
of message/rfc822 messages, which results in a segfault when freeing
the message body now.  While `imap_mail_compose()` does not really
support composition of meaningful message/rfc822 messages (although
libc-client appears to support that), some code may still use this to
compose partial messages, and using string manipulation to create the
final message.

The point is that libc-client expects `TYPEMESSAGE` with an explicit
subtype of `RFC822` to have a `nested.msg` (otherwise there will be a
segfault during free), but not to have any `contents.text.data` (this
will leak otherwise).

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

Closes GH-6343.
2020-10-20 13:32:53 +02:00
Derick Rethans 7b5f232b03 Updated to version 2020.3 (2020c) 2020-10-19 09:31:02 +01:00
Christoph M. Becker 4b9db65f68 Fix broken fix for #80239
No idea why that `git am` failed that badly.
2020-10-15 13:18:34 +02:00
Christoph M. Becker 5941b30bb8 Fix #80239: imap_rfc822_write_address() leaks memory
We have to free the address when we're finished with it.
2020-10-15 12:54:53 +02:00
Nikita Popov a29016d70d Fix leak in gmp_export() 2020-10-15 10:16:22 +02:00
Christoph M. Becker db8bf0a9e0 Fix #64076: imap_sort() does not return FALSE on failure
If unsupported `$search_criteria` are passed to `imap_sort()`, the
function returns an empty array, but there is also an error on the
libc-client error stack ("Unknown search criterion: UNSUPPORTED
(errflg=2)").  If, on the other hand, unsupported `$criteria` or
unsupported `$flags` are passed, the function returns `false`.  We
solve this inconsistency by returning `false` for unsupported
`$search_criteria` as well.

Closes GH-6332.
2020-10-13 19:37:05 +02:00
Christoph M. Becker 2d01a89ad1 7.3.25 is next 2020-10-13 09:52:46 +02:00
Christoph M. Becker 8488c34fc6 Fix #80226: imap_sort() leaks sortpgm memory
We need to free what we have allocated.

Closes GH-6327.
2020-10-12 23:16:31 +02:00
Christoph M. Becker 73e43b6e19 Fix #80216: imap_mail_compose() does not validate types/encodings
We need to check whether the given `type`s and `encoding`s are within
bounds to avoid segfaults and out-of-bound reads.

Closes GH-6323.
2020-10-12 16:27:49 +02:00
Christoph M. Becker c1962e900a Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
We have to clean up even on failure.

Closes GH-6322.
2020-10-12 15:08:30 +02:00
Christoph M. Becker 0d022ddf03 Fix #80220: imap_mail_compose() may leak memory
Unless `topbod` is of `TYPEMULTIPART`, `mail_free_body()` does not free
the `nested.part`; while we could do this ourselves, instead we just
ignore additional bodies in this case, i.e. we don't attach them in the
first place.

Closes GH-6321.
2020-10-12 13:31:30 +02:00
Nikita Popov 3c4dd73c02 Detect self-addition of array more accurately
While the zvals may be different, they may still point to the
same array.

Fixes oss-fuzz #26245.
2020-10-12 11:24:31 +02:00
Nikita Popov e304468e57 Deindirect source elements in zend_hash_merge
If the RHS has INDIRECT elements, we do not those to be added to
the LHS verbatim. As we're using UPDATE_INDIRECT, we might even
create a nested INDIRECT that way.

This is a side-quest of oss-fuzz #26245.
2020-10-12 11:24:27 +02:00
Derick Rethans 1ed5a2a54d Fixed test for bug #48097 due to confirmed data changes in timelib 2020-10-11 14:53:52 +01:00
Christoph M. Becker 62a2387a8d Fix #80215: imap_mail_compose() may modify by-val parameters
We separate the input arrays and all sub-arrays to avoid modification
of the passed parameters.

This should be rewritten to use `zend_string`s for the "master" branch.

Closes GH-6316.
2020-10-10 23:25:06 +02:00
Christoph M. Becker 8bee0fbd37 Fix #80213: imap_mail_compose() segfaults on certain $bodies
We have to cater to non-associative arrays where the key may be `NULL`;
we just skip these elements.

Closes GH-6315.
2020-10-10 19:17:13 +02:00
Petr Sumbera 07a4185df1 Make iconv errno support test pass on Solaris.
Closes GH-6291.
2020-10-09 15:24:36 +02:00
Nikita Popov 5018581410 XFAIL test broken by timelib update
I was expecting this to get fixed quickly, but it didn't.
XFAIL for now.
2020-10-09 14:04:47 +02:00
Derick Rethans 14d231bd16 Updated to version 2020.2 (2020b) 2020-10-08 15:19:46 +01:00
Derick Rethans 90a5d7c2ad Updated to version 2020.2 (2020b) 2020-10-08 15:05:38 +01:00
Christoph M. Becker 1895bf7b94 Fix too strict imap test expectations 2020-10-08 12:06:54 +02:00
Christoph M. Becker e68acd031d Fix #77040: tidyNode::isHtml() is completely broken
The documentation of `tidyNode::isHtml()` states that this method
"checks if a node is part of a HTML document".  That is, of course,
nonsense, since a tidyNode is "an HTML node in an HTML file, as
detected by tidy."

What this method is actually supposed to do is to check whether a node
is an element (unless it is the root element).  This has been broken by
commit d8eeb8e[1], which assumed that `enum TidyNodeType` would
represent flags of a bitmask, what it does not.

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

Closes GH-6290.
2020-10-07 17:43:56 +02:00
Christoph M. Becker e857dfa7cc Fix #80185: jdtounix() fails after 2037
There is no such thing as the "end of the unix epoch", and if it was,
it would certainly not be 2037-10-11T02:00:00.  There is, however,
potential integer overflow which we need to avoid.

Closes GH-6288.
2020-10-07 13:23:50 +02:00
Christoph M. Becker 69ba81d183 Fix #46050: odbc_next_result corrupts prepared resource
When resetting the result's values, we also have to reset its numcols.
2020-10-05 17:46:37 +02:00
Nikita Popov aa405b7da2 Fix -Wimplicit-function-declaration in configure
As this is an error with xcode 12, see bug #80171.
2020-10-05 10:43:58 +02:00
K.Kosako bf6873a18e Fix out-of-bounds write
Fixes CVE-2020-26159.

Backported from <https://github.com/kkos/oniguruma/commit/cbe9f8bd9cfc6c3c87a60fbae58fa1a85db59df0>.
2020-10-02 15:02:35 +02:00
Matteo Beccati 1666cfcca0 [ci skip] moved soap fix to 7.3.23
When committing I didn't notice that version had been just bumped
2020-10-02 09:32:52 +02:00
Dmitry Stogov 773f980e00 Backport of a partial fix for bug Bug #76982 (memory leak declaring closure in included file). 2020-10-01 13:18:21 +03:00
Remi Collet 5733f11ee9 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump version to 7.2.35-dev
2020-09-30 07:42:14 +02:00
George Peter Banyard 1616363850 Fixed incorrect error message 2020-09-30 08:37:16 +03:00
Remi Collet 662083fc4f bump version to 7.2.35-dev 2020-09-30 07:36:59 +02:00
George Peter Banyard 3f5c47af3b Fixed incorrect logical condition 2020-09-30 08:29:00 +03:00
Stanislav Malyshev ae95d06f68 [ci skip] Add 7.3.23 security fixes to NEWS 2020-09-29 10:09:33 -07:00
Christoph M. Becker b5cb999e7f [ci skip] Fix version 2020-09-29 12:10:51 +02:00
Christoph M. Becker bf5f07cc8b Fix #80152: odbc_execute() moves internal pointer of $params
As least intrusive fix, we separate the passed array argument.

Closes GH-6219.
2020-09-29 11:34:48 +02:00
Christoph M. Becker df5efa2fcd Fix #80150: Failure to fetch error message
In case of statement related errors, we need to pass the respective
statement handle to `SQLError()`.

Closes GH-6217.
2020-09-29 11:02:51 +02:00
Matthias Karbe f5afd0a827 Fix bug #80137
Skip getprotobyname() and getprotobynumber() tests on *nix if there
is no /etc/protocols file.

Closes GH-6193.
2020-09-29 10:58:00 +02:00
Matthias Karbe 2899137391 Fix bug #80138
Skip getservbyname() and getservbyport() tests on *nix if there is
no /etc/services file.

Closes GH-6191.
2020-09-29 10:57:20 +02:00
Remi Collet 035ad0aed5 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  [ci skip] typo
  Update NEWS & UPGRADING
  Do not decode cookie names anymore
  Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV)
2020-09-29 08:50:14 +02:00
Remi Collet af500b8685 [ci skip] typo 2020-09-29 08:49:56 +02:00
Stanislav Malyshev 95e1a415a5 Do not decode cookie names anymore 2020-09-28 21:43:11 -07:00
Stanislav Malyshev 2f5cb702ff Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV) 2020-09-28 21:43:11 -07:00
Stanislav Malyshev 311922ddbe Update UPGRADING 2020-09-28 21:38:58 -07:00
Stanislav Malyshev 7bc112a142 Update NEWS & UPGRADING 2020-09-28 21:38:43 -07:00
Christoph M. Becker 6acfb79276 Fix #67465: NULL Pointer dereference in odbc_handle_preparer
We have to initialize `stmt->driver_data` before we use it.

Closes GH-6225.
2020-09-28 22:57:01 +02:00
Stanislav Malyshev 6559fe9126 Do not decode cookie names anymore 2020-09-26 23:47:04 -07:00
Stanislav Malyshev 0216630ea2 Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV) 2020-09-26 23:46:53 -07:00
George Peter Banyard 4dfbf07644 Fix logic error in PDO 2020-09-25 16:28:48 +01:00
Christoph M. Becker a49555a9e1 Fix #80147: BINARY strings may not be properly zero-terminated
We have to manually ensure that all strings fetched from a data source
are zero-terminated.

Closes GH-6213.
2020-09-25 13:51:18 +02:00
Christoph M. Becker e74f89d95a Use proper skipif section
The ODBC tests have to be skipped if no connection to the server can be
established.
2020-09-24 17:12:18 +02:00
Christoph M. Becker 610e7d2c77 Fix #78470: odbc_specialcolumns() no longer accepts $nullable
It is mandatory to pass either `SQL_NO_NULLS` or `SQL_NULLABLE` as
tenth parameter to `SQLSpecialColumns()`; otherwise the function call
fails.  Therefore the user must be allowed to pass the desired value
as parameter to `odbc_specialcolumns()` again.

Closes GH-6200.
2020-09-24 12:15:59 +02:00
Christoph M. Becker 2576c57a51 Fix #76735: Incorrect message in fopen on invalid mode
We have to log errors in `stream_opener` callbacks to the wrapper's
error log, because otherwise we may pick up an unrelated `errno` or a
most generic message.

Closes GH-6187.
2020-09-23 10:54:06 +02:00
Christoph M. Becker 9439d65f0d Fix #77493: curl_basic_009 fails with newer curl versions
libcurl 7.62.0 introduced a maximum protocol length of 8, so this test
case failed with `CURLE_URL_MALFORMAT`.  While this is lifted to 40 as
of libcurl 7.65.0, and this test case has already been fixed with
commit e27301c[1], we restore the original intention to check for a
`CURLE_UNSUPPORTED_PROTOCOL ` error.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=e27301c7b37f6a1643a0dc1966919bd62a32bc74>
2020-09-23 10:42:48 +02:00
Christoph M. Becker 5ed0602ec6 Fix #76943: Inconsistent stream_wrapper_restore() errors
If restoring of any not registered built-in wrapper is requested, the
function is supposed to fail with a warning, so we have to check this
condition first.

Furthermore, to be able to detect whether a built-in wrapper has been
changed, it is not sufficient to check whether *any* userland wrapper
has been registered, but rather whether the specific wrapper has been
modified.

Closes GH-6183.
2020-09-22 16:11:35 +02:00
Christoph M. Becker 4000780b3d Fix #79423: copy command is limited to size of file it can copy
Passing `NULL` as `lpFileSizeHigh` to `GetFileSize()` gives wrong
results for files larger than 0xFFFFFFFF bytes.  We fix this by using
`GetFileSizeEx()`, and let the mapping fail, if the file size is too
large for the architecture.

Closes GH-5319.
2020-09-22 13:15:07 +02:00
Christoph M. Becker 730fdc77a7 Fix memory leak in php_imap_mutf7()
We have to free the string which has been allocated by libc-client.
2020-09-21 11:25:46 +02:00
Christoph M. Beckerandtwosee 81b2f3e5d9 Fix #80114: parse_url does not accept URLs with port 0
URIs with a 0 port are generally valid, so `parse_url()` should
recognize such URIs, but still report the port as missing.

Co-authored-by: twosee <twose@qq.com>

Closes GH-6152.
2020-09-20 15:34:45 +02:00
Bob Weinand a7544411df Fix mysqli build with mysqlnd and without PDO 2020-09-20 10:02:09 +02:00
Daniel Black 740f0f6165 Fix #78179: mysqli/mysqlnd transaction extensions
MariaDB versioning created a mess with regarding testing
features based on version. We sidestep the problem here
by assuming the extensions are present, and if a syntax
error occurs with a SQL mode TRANS_START_READ_WRITE |
TRANS_START_READ_ONLY enabled, then output the same
warning as before.
2020-09-18 15:29:44 +02:00
Nikita Popov 70cba36fc9 Support NO_BACKSLASH_ESCAPES with newer libmysqlclient
Requires the use of mysql_real_escape_string_quote().
2020-09-18 15:24:57 +02:00
Nikita Popov 77f43e48ff Use MyISAM engine for new test
Travis on 7.3 is showing this error:

> The size of BLOB/TEXT data inserted in one transaction is greater
> than 10% of redo log size. Increase the redo log size using
> innodb_log_file_size.

Force MyISAM engine to avoid this.
2020-09-18 14:49:43 +02:00
Nikita Popov ecd9c42f9e Fix bug #80107: Handling of large compressed packets
There's two layers of packet splitting going on. First, packets
need to be split into having a payload of exactly 2^24-1 bytes or
being the last packet. If the split packet has size between 2^24-5
and 2^24-1 bytes, the compressed packets also needs to be split,
though the choice of split doesn't matter here. I'm splitting off
the first 8192 bytes, as that's what I observe libmysqlclient to be
doing.
2020-09-18 12:55:44 +02:00
Máté Kocsis c7ceebc42c Bug #80107 Add test for mysqli_query() fails for ~16 MB long query when compression is enabled 2020-09-18 12:42:08 +02:00
Nikita Popov c3944c4c4f Fix mysqli_release_savepoint() on mysqlnd
mysqli_release_savepoint() was not actually releasing a savepoint...
2020-09-17 15:59:09 +02:00
Christoph M. Becker efdbc3688b Fix #80115: mysqlnd.debug doesn't recognize absolute paths with slashes 2020-09-17 12:37:02 +02:00
Daniel Black 1aab7db6c8 pdo_mysql/mysqli (native) libmysqlclient_r no-longer used
The mysqlclient_r library exists in mysql-5.6 for compatibility only.

Later versions have it removed.
2020-09-17 11:27:31 +02:00
Daniel Black c9abb0c0ac mysql: native mysql-8.0 uses _Bool
MySQL-8.0 removes option MYSQLI_OPT_SSL_VERIFY_SERVER_CERT
2020-09-17 11:27:31 +02:00
Daniel Black 202a0697f3 mysqli: use native api
Tested with:
* mysql-5.6.49-linux-glibc2.12-x86_64
* mysql-5.7.31-linux-glibc2.12-x86_64
* mysql-8.0.21-linux-glibc2.17-x86_64
* mariadb-10.5.6

configure --with-mysqli=/usr/local/$version/bin/mysql_config   --with-pdo-mysql=/usr/local/$version

MySQL-8.0 removed my_bool
Some options where deprecated in mysql-8.0

MY_CHARSET_INFO used with exposed api mysql_get_character_set_info
rather than internal structures.
2020-09-17 11:27:31 +02:00
Gabríel Arthúr Pétursson efc52f1754 ext/soap: Compare Set-Cookie header case-insensitively
Closes GH-6143.
2020-09-17 10:31:06 +02:00
Nikita Popov a4f806aa79 Fixed bug #80083
Add db2_execute() to the list of functions accessing the local
scope. Ideally the API wouldn't do that, but it seems most
pragmatic to address this on the opcache side at this point.
2020-09-17 10:12:10 +02:00
Christoph M. Becker edddddcea8 7.3.24 is next 2020-09-15 10:51:41 +02:00
Christoph M. Becker 4e198c0064 Avoid segfault if module/extension version is not defined 2020-09-14 22:34:10 +02:00
Christoph M. Becker dfb3a79914 Fix #80067: Omitting the port in bindto setting errors
A recent commit[1] which fixed a memory leak introduced a regression
regarding the formerly liberal handling of IP addresses to bind to.  We
fix this by reverting that commit, and fix the memory leak where it
actually occurs.  In other words, this fix is less intrusive than the
former fix.

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

Closes GH-6104.
2020-09-11 14:44:12 +02:00
Sammy Kaye Powers 2d4aa1ef3d Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
Modules may have changed after restart which can cause dangling pointers from custom opcode handlers in the second-level cache files. This fix includes the installed module names and versions in the accel_system_id hash as entropy. Closes GH-5836
2020-09-09 12:08:19 -07:00
Christoph M. Becker 5dcb8f2f1c Fix #72941: Modifying bucket->data by-ref has no effect any longer
To match the PHP 5 behavior, we have to explicitly cater to `buffer` or
`data` being references.

Closes GH-6096.
2020-09-08 18:06:40 +02:00
Nikita Popov 07cb665515 Fixed bug #80077
Quoting from the bug report:

> The domain names passed to getmxrr() do not contain a trailing dot.
> DNS lookups which do not find records will (depending on the local
> resolver config) try again by adding the local domain to the end of
> the searched host/domain. In many environments there's an mx record
> for any subdomain of the local domain and the MX query will return
> a hit. But the test expects no hit. So the test fails when checking
> that "qa.php.net" does not have an MX record in DNS. In our local
> environment the resolver falls back to also check qa.php.net.kippdata.de
> which does have an MX record. Using "qa.php.net." instead of "qa.php.net"
> should fix this for everyone.
2020-09-08 10:00:49 +02:00
Nikita Popov e8d36ce762 Avoid duplicate octal warning during heredoc scan ahead 2020-09-04 10:58:51 +02:00
Nikita Popov 46a49be6c8 Fixed bug #80049
Type checking may convert to refcounted values, so force freeing
of extra args.
2020-09-03 17:12:40 +02:00
Christoph M. Becker 1848ccdae2 Fix #80048: Bug #69100 has not been fixed for Windows
We fix the erroneous length calculation on Windows, too.

Closes GH-6067.
2020-09-03 15:43:19 +02:00
Christoph M. Becker c70a938f28 Skip test if A: drive exists
Otherwise the test case will fail for a very different reason.
2020-09-03 10:29:38 +02:00
Nikita Popov 573ad182d2 Handle memory limit error during string reallocation correctly
Do not decrement the refcount before allocating the new string,
as the allocation operation may bail out and cause a use-after-free
lateron. We can only decrement the refcount once the allocation
has succeeded.

Fixes oss-fuzz #25384.
2020-09-03 09:49:29 +02:00
Nikita Popov 54dbd3eccc Fix binary-safety of parse_url
php_parse_url() is intended to support strings that are not zero
terminated. We can't use strcspn in the implementation.

As we have two uses of strcspn, add a helper.
2020-09-02 16:45:25 +02:00
Nikita Popov 2e9e706a82 Fix throwing of yield from related exceptions into generator
Use the general zend_generator_throw_exception() helper for this.
Otherwise we don't handle the off-by-one opline correctly (should
we maybe just stop doing that?)

This is a followup to ad750c3bb6,
which fixed a different yield from exception handling problem that
happened to show up in the same test case from oss-fuzz #25321.
Now both issues should be fixed.
2020-09-02 10:52:55 +02:00
Nikita Popov a07c1f56aa Fix infinite loop on string offset during by-ref list assign
There is a deeper underlying issue here, in that the opcodes violate
VM write-fetch safety, but let's fix the infinite loop first.

This fixes oss-fuzz #25352.
2020-09-02 10:16:05 +02:00
Nikita Popov cd2afd99b1 Fix leak on assign concat of array and empty string 2020-08-31 17:05:31 +02:00
Derick Rethans 488e53c18b Fixed test case 2020-08-31 12:31:23 +01:00
Derick Rethans 778902db63 Update timelib to 2018.04 2020-08-31 11:41:41 +01:00
Matteo Beccati 44ade0e875 Fix #80027 Terrible performance using $query->fetch on queries with many bind parameters
Added new flags that allow skipping param_evt(s) that are not used by drivers,
in a backwards and forward compatible manner. Updated the pgsql, mysql, sqlite
and oci drivers to properly use the new flags. I've left out pdo_dblib, which
doesn't have a param_hook, and pdo_firebird, which seems to be using
PARAM_EVT_NORMALIZE in a wrong context (param type vs event type).
2020-08-31 11:03:03 +02:00
Nikita Popov ad750c3bb6 Fix handling of exception if valid() during yield from
Fixes oss-fuzz #25296.
2020-08-31 10:51:31 +02:00
Nikita Popov 376bbbdf3b Make MAX_IFD_NESTING_LEVEL an actual nesting level
Currently we only ever increment ifd_nesting_level, so this ends up
being a limit on the total number of IFD tags and we regularly get
bug reports of it being exceeded. I think the intention behind this
limit was to prevent recursion stack overflow, and for that we only
need to check actual recursive usage. I've implemented that here,
and dropped the nesting limit down to a smaller value
(which still passes our tests).

However, it seems that we do also need to have a total limit on
the number of tags, as we don't catch some instances of infinite
looping otherwise. Add this as a separate limit with a higher
value, that should hopefully be sufficient.

This is expected to fix a number of bugs:

https://bugs.php.net/bug.php?id=78083
https://bugs.php.net/bug.php?id=78701
https://bugs.php.net/bug.php?id=79907
https://bugs.php.net/bug.php?id=80016
2020-08-31 09:28:59 +02:00
twosee e948188832 Improve error_handing replacement functions
We explicitly skip calls to user_error_handler in EH_THROW mode

Closes GH-6050.
2020-08-30 16:24:42 +08:00
Nikita Popov 62dce97973 Require non-negative length in stream_get_contents()
If the length is not -1, require it to be non-negative.

Using such lengths doesn't make sense (as only -1 is special-case
to read in chunks, anything else will end up doing a huge upfront
allocation) and can lead to string allocation overflow.

A similar check is already in place for file_get_contents(). That
one does not allow -1 (and uses null instead), but this function
is explicitly specified to accept -1, so stick to that behavior.
2020-08-27 15:50:49 +02:00
Christoph M. Becker 1b7ee6db88 Fix com_safearray_proxy related memory management issues 2020-08-26 15:39:32 +02:00
Christoph M. Becker 75ac3f1cba Separate COM::__construct()s $server_name array
This may otherwise be modified.
2020-08-26 15:00:02 +02:00
Christoph M. Becker 5ff15e2651 Fix #64130: COM obj parameters passed by reference are not updated
`ITypeInfo_GetIDsOfNames()` is supposed to fail with `E_NOTIMPL` for
out-of-process servers, thus we should not remove the already available
typeinfo of the object in this case.

We also properly free the `byref_vals`.
2020-08-26 14:50:04 +02:00
Nikita Popov d179e34e42 Fix memory leak when yielding from non-iterable 2020-08-26 11:32:01 +02:00
Christoph M. Becker 3324bb893e Avoid double-free
As of commit b2e3fd1[1] the `authid.User` is no longer newly allocated,
so we must not free it.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=b2e3fd1e691b1dc82aaaf4150461db97bd5acf4a>
2020-08-25 13:11:22 +02:00
Nikita Popov 063082043a Remove bogus REGISTER_LONG_CONSTANT
This shouldn't be in this function, probably a copy/paste mistake...
2020-08-25 12:35:38 +02:00
Christoph M. Becker 74de17f2ea Fix potential integer overflow detected by oss-fuzz
We port the respective fix from upstream[1].

[1] <https://github.com/libgd/libgd/commit/9ed642764cf0b4585d135eb738812a43265cb2d3>
2020-08-24 17:35:04 +02:00
Christoph M. Becker 844a2dd6ac Fix #79986: str_ireplace bug with diacritics characters
`tolower()` returns an `int`, so we must not convert to `char` which
may be `signed` and as such may be subject to overflow (actually,
implementation defined behavior).

Closes GH-6007
2020-08-24 11:08:48 +02:00
Christoph M. Becker fcd26ffcc3 Fix #80002: calc free space for new interned string is wrong
We need to calculate the free size in bytes.

Patch contributed by t-matsuno.

Closes GH-6024
2020-08-24 11:03:19 +02:00
Andy Postnikov b2a33ab06b Fix #80007: Potential type confusion in unixtojd() parameter parsing
Also it fixes test on 32-bit armv7 and x86
- Test unixtojd() function : error conditions [ext/calendar/tests/unixtojd_error1.phpt]

Closes GH-6033
2020-08-22 12:30:04 +02:00
Manuel Mausz 46d62e5464 Fix wrong datatype
ini_entry->modifiable is of type uint8_t and so should be the temp. variable. Especially important after 4b77a158.

Closes GH-6028
2020-08-21 15:28:12 +02:00
Matteo Beccati f7c43b8c72 Fix #47021: SoapClient stumbles over WSDL delivered with "Transfer-Encoding: chunked" 2020-08-18 18:10:39 +02:00
Christoph M. Becker ff14b7adad 7.3.23 is next 2020-08-18 09:55:37 +02:00
Christoph M. Becker 1ae80f8c92 Fix HTTP response status code 2020-08-18 08:33:45 +02:00
Nikita Popov f6d7af21a3 Null terminate the sodium_crypto_kx_keypair() result 2020-08-14 15:51:31 +02:00
Ahmed Abdou 2fe2e5b48f Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
PDO driver constructors are throwing PdoException without setting
errorInfo, so create a new reusable function that throws exceptions
for PDO and will also set the errorInfo. Use this function in
pdo_mysql, pdo_sqlite, and pdo_pgsql.
2020-08-11 17:12:48 +02:00
Nawarian 2fa4ca95db Fix bug #75785 by attempt switching endianness on Maker's Note
Different manufacturer models may come with a
different endianness (motorola/intel) format. In
order to avoid a big refactor and a gigantic lookup
table, this commit simply attempts to switch the
endianness and proceed when values are acceptable.

Closes GH-5849.
2020-08-11 16:26:34 +02:00
Christoph M. Becker dc108feab8 Fix #48585: com_load_typelib holds reference, fails on second call
Whether the type library is cached is actually irrelevant here; what
matters is that the symbols are imported, and since these are not
cached, we have to import them for every request.  And we cannot cache
the symbols, because the import depends on the current codepage, but
the codepage is a `PHP_INI_ALL` setting.
2020-08-11 11:26:50 +02:00
Nikita Popov 9d9dffe60a Fixed bug #79951
One branch did not release tmp_replace_entry_str.

Also reduce the scope of some variables.
2020-08-11 10:33:59 +02:00
George Wang 07cb2755be Make sure string is NUL byte terminated. 2020-08-10 19:11:03 -04:00
Nikita Popov 4723bd4ffa Check the correct list
This was supposed to check mx_list, not weight_list... oops.
2020-08-10 21:52:36 +02:00
Nikita Popov a06eed0c0e Fix bug #79944
Only return true from dns_get_mx if we actually found any MX record.
2020-08-10 20:42:50 +02:00
Christoph M. Becker 0af3f49312 Fix #79922: Crash after multiple calls to xml_parser_free()
We must not call `zend_list_delete()` in resource closer functions
exposed to userland, because decreasing the refcount there leads to
use-after-free scenarios.  In this case, commit 4a42fbb worked for
typical use-cases where `xml_parser_free()` has been called exactly
once for the resource, because there is an internal zval (`->index`)
referencing the same resource which already increased the refcount by
one.  However, when `xml_parser_free()` is called multiple times on the
same XML parser resource, the resource would be freed prematurely.

Instead we forcefully close the resource in `xml_parser_free()`.  We
also could decrease the refcount of the resource there, but that would
require to call `xml_parser_free()` which is somewhat uncommon, and
would be particularly bad wrt. PHP 8 where that function is a NOP, and
as such doesn't have to be called.  So we do no longer increase the
refcount of the resource when copying it to the internal zval, and let
the usualy refcounting semantics take care of the resource destruction.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=4a42fbbbc73aad7427aef5c89974d1833636e082>
2020-08-10 12:23:44 +02:00
Florian Engelhardt 5be670265b Fix bug #70574: Move files to proper locale dir
Closes GH-5940.
2020-08-07 14:37:27 +02:00
Pieter van den Ham 06ade15528 Fix #79934: CRLF-only line in heredoc causes parsing error
Fixes the function `next_newline()` in zend_language_scanner.l. The
function now correctly returns a newline_len of 2 for "\r\n".

Closes GH-5944.
2020-08-06 12:02:54 +02:00
Nikita Popov 6a1bd57df5 Fix memory leak on socket_sendmsg() / socket_recvmsg() error 2020-08-05 16:41:40 +02:00
Nikita Popov da786a22af Fixed bug #79930
We're inserting src_zval, so that's what we should addref.
2020-08-05 15:43:41 +02:00
David Carlier 12db8b90a7 Fix iov_base pointer type for illumos
These systems has two versions of the iovec interface dependent on
compiler flags passed, the legacy version causing little build issue.

Closes GH-5939.
2020-08-05 15:17:51 +02:00
Christoph M. Becker c4677af67e [ci skip] Fix 7.3.21 release date 2020-08-04 12:31:24 +02:00
Remi Collet 4221e000b1 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump version to 7.2.34-dev
  Update NEWS
2020-08-04 09:55:40 +02:00
Remi Collet 6b8ffdbdeb bump version to 7.2.34-dev 2020-08-04 09:55:29 +02:00
Graham Campbell f3a43e85e7 Removed space from bug55086.phpt
Closes GH-5923.
2020-08-03 15:14:15 +02:00
Santiago M. Mola fdf6b0fefe set -ex on travis/compile.sh
-e to fail early: ./configure may fail and further errors from make bury
the original problem in the logs.

-x for easier debugging
2020-08-03 14:48:00 +02:00
Christoph M. Becker 17d64af186 [ci skip] Add missing NEWS entries 2020-08-03 11:18:18 +02:00
Stanislav Malyshev 07aeb9171d Update NEWS 2020-08-03 01:14:38 -07:00
Stanislav Malyshev 5b29af5c78 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #79877: getimagesize function silently truncates after a null byte
  Fix #79797: Use of freed hash key in the phar_parse_zipfile function
2020-08-02 23:56:37 -07:00
Christoph M. Becker ff577b04c0 Fix #79877: getimagesize function silently truncates after a null byte
We have to check for NUL bytes if `getimagesize()` has been called.
2020-08-02 15:33:24 -07:00
Christoph M. Becker 7355ab8176 Fix #79797: Use of freed hash key in the phar_parse_zipfile function
We must not use heap memory after we freed it.
2020-08-02 15:31:29 -07:00
Christoph M. Becker 1e0bc6e30f Fix #79919: Stack use-after-scope in define()
Instead of the temporary `rv`, we use the `val_free` which is there for
this purpose.
2020-07-31 10:54:41 +02:00
Christoph M. Becker d95c53834c Amendment to OPcache base file removal
We fix the erroneous segment size.  We also keep the segment pointer at
the allocated address, but increase the position instead.
2020-07-29 18:44:08 +02:00
Nikita Popov 57ad5b3432 Consider op1 literal of FETCH_OBJ_R
FETCH_OBJ_R may have an op1 CONST operand, even though it will
always error. We should take this into account when compacting
literals.
2020-07-29 17:04:23 +02:00
Nikita Popov 99c48a2477 Fix test 2020-07-29 15:04:05 +02:00
Santiago M. Mola e767ca60a0 Fix #79895: support = in PHP_CHECK_GCC_ARG m4 macro
Closes GH-5890.
2020-07-29 12:36:52 +02:00
twosee 0b8c83f593 Handle bindto error
Closes GH-5903.
2020-07-29 17:46:27 +08:00
Christoph M. Becker 9a744c66e7 Fix #73060: php failed with error after temp folder cleaned up
Instead of storing the mapping base address and the address of
`execute_ex()` in a separate file in the temporary folder, we store
them right at the beginning of the memory mapping.
2020-07-29 10:07:23 +02:00
Christoph M. Becker c756f82c02 Fix #79806: realpath() erroneously resolves link to link
After resolving reparse points, the path still may be a reparse point;
in that case we have to resolve that reparse point as well.
2020-07-28 13:55:22 +02:00
Paweł Tomulik efe6d96b45 fix memory leaks in ext/ldap/ldap.c 2020-07-28 10:23:10 +02:00
Christoph M. Becker 1aeff522b8 Revert "Fix #79806: realpath() erroneously resolves link to link"
This reverts commit d5b59b4303.
2020-07-27 17:50:41 +02:00
Christoph M. Becker d5b59b4303 Fix #79806: realpath() erroneously resolves link to link
After resolving reparse points, the path still may be a reparse point;
in that case we have to resolve that reparse point as well.
2020-07-27 15:08:39 +02:00
Christoph M. Becker 6f18d7e2f9 Fix #77932: File extensions are case-sensitive
The file extension to mime type mapping *must* not depend on the file
extension's case for case-insensitive file systems, and *should* not
for case-sensitive file systems.
2020-07-27 11:52:18 +02:00
George Wang 874284d1c9 Merge branch 'PHP-7.2' into PHP-7.3 2020-07-23 15:36:35 -04:00
George Wang c39f5fe94e Security: update to LiteSpeed SAPI v7.7 to address an buffer overflow, and some log message tunings. 2020-07-23 15:35:32 -04:00
Christoph M. Becker 15efb96d4c Fix #79884: PHP_CONFIG_FILE_PATH is meaningless
It does not make sense to make assumptions about `PHP_CONFIG_FILE_PATH`
during build time, since that value is never used during run time on
Windows.  Since there is no `--with-config-file-path` on Windows
either, we define `PHP_CONFIG_FILE_PATH` as `""`.
2020-07-23 15:39:22 +02:00
Christoph M. Becker 6b99a8be4d Fix brittle test
This test fails occasionally due to timing issues, because the session
file may have been unlinked by the first `session_start()`'s GC.  We
adapt the test expectation to this reality.
2020-07-22 20:45:56 +02:00
Christoph M. Becker 2c0a6977dd 7.3 is now 7.3.22-dev 2020-07-21 09:18:07 +02:00
Christoph M. Becker b2e3fd1e69 Fix #63527: DCOM does not work with Username, Password parameter
We must not mix multibyte and wide character strings in the
`COAUTHIDENTITY` structure.  Using wide character strings throughout
would have the advantage that the remote connection can be established
regardless of the code page of the server, but that would more likely
break BC, so we just drop the wide character string conversion of the
username.
2020-07-20 14:43:29 +02:00
Andy Postnikov 2c57378bd3 Fix bug #78008: dns_check_record() always return true on Alpine
- free handle before return result
- cleaned up remaining usage of MAXPACKET
- update dns_get_mx() to use the same approach

Closes GH-5854.
2020-07-15 15:10:19 +02:00
Evgeny Stepanischev ce149b0cb8 Fixed bug #79849
Closes GH-5853.
2020-07-14 12:41:43 +02:00
twosee f0b2c2cb98 Fixed BC break of php_debug_zval_dump
It introduced by fixing bug #79830
2020-07-11 18:30:28 +08:00
twosee 56dec3cc73 Fixed bug #79830 introduced by fixing bug #79821
This also fixes memory error in debug_zval_dump and var_export.
2020-07-11 14:37:25 +08:00
twosee 150504e6b1 Fixed bug #79821
HashTable was reallocated (zend_hash_packed_grow) during php_var_dump, so we should call GC_ADDREF to make SEPARATE_ARRAY work.

Closes GH-5837.
2020-07-11 06:14:22 +08:00
Nikita Popov a72c53a070 Fixed bug #79817
Use *_IND macros in a few places in string.c.
2020-07-10 14:06:41 +02:00
Paweł Tomulik 23ef0a1285 Fix some memory bugs in ldap.c 2020-07-09 18:35:00 +02:00
XXiang 3d5de7d746 Fix bug #79787
Closes GH-5807.
2020-07-08 11:20:58 +02:00
Nikita Popov e6160e99d8 Report len as -1 instead of INT_MAX
Per docs it should be -1. And would be on 32-bit systems, but
not on 64-bit systems.

(cherry picked from commit 39111585a2)
2020-07-08 10:38:11 +02:00
Sara Golemon e54f18ae0f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Prep for 7.2.33
  Prep NEWS for 7.2.32 release
2020-07-07 19:33:48 +00:00
Sara Golemon c68d48de9e Prep for 7.2.33 2020-07-07 19:32:15 +00:00
Sara Golemon 9588c8474e Prep NEWS for 7.2.32 release 2020-07-07 19:31:05 +00:00
Christoph M. Becker f23bd48892 Don't use deprecated curly brace offset syntax
(cherry picked from commit 7ec3aa1871)

Better safe than sorry in case someone ever builds PHP 7.3 with a
future version of PHP SDK with bundled PHP 8.
2020-07-07 13:55:08 +02:00
Nikita Popov 64931fd3c4 Fixed bug #79792
We need to remove the iterators even if the array is empty (we
will not create one if the first place, but the array may become
empty after the fact).
2020-07-07 11:58:25 +02:00
Nikita Popov b765f96f5f Fixed bug #79778
In the interest of avoiding side-effects during dumping, I'm
replacing the value with a <constant ast> string instead of
performing an update constant operation.
2020-07-07 10:19:39 +02:00
Nikita Popov 187a72d563 Remove bogus generator iterator dtor
Fixes a use-after-free encountered in Symfony's SecurityBundle.
I don't have a reproducer for this, and believe the issue can only
occur if we leak an iterator (the leak is a separate issue).

We should not free the generator iterator here, because we do not
own it. The code that fetched the iterator is responsible for
releasing it. In the rare case where we do hit this code-path,
we cause a use-after-free.
2020-06-30 17:32:42 +02:00
Nikita Popov fc6f53d426 Fix leak when setting cyclic previous exception in finally
A curious exception handling pattern found in Symfony's HttpClient.
2020-06-30 12:24:32 +02:00
Christoph M. Becker 7f3bc64287 Fix #70362: Can't copy() large 'data://' with open_basedir
open_basedir is only relevant for plain files, so there is no need to
check it for other URL wrappers.
2020-06-30 10:46:53 +02:00
Christoph M. Becker a385cfa7ad Fix #63208: BSTR to PHP string conversion not binary safe
A `BSTR` is similar to a `zend_string`; it stores the length of the
string just before the actual string, and thus the string may contain
NUL bytes.  However, `php_com_olestring_to_string()` is supposed to
deal with arbitrary `OLECHAR*`s which may not be `BSTR`s, so we
introduce `php_com_bstr_to_string()` and use it for the only case where
we actually have to deal with `BSTR`s which may contain NUL bytes.

Contrary to `php_com_olestring_to_string()` we return a `zend_string`,
so we can save the re-allocation when converting to a `zval`.

We also cater to `php_com_string_to_olestring()` not being binary safe,
with basically the same fix we did for `php_com_olestring_to_string()`.
2020-06-29 19:05:02 +02:00
Christoph M. Becker 816b4c1235 Fix #79756: finfo_file crash (FILEINFO_MIME)
If `ctime` or `asctime` return `NULL`, we must not attempt to copy the
buffer, but rather return `NULL` as well.
2020-06-29 17:45:28 +02:00
Nikita Popov 43cd3f6814 Fixed bug #79741 2020-06-26 12:28:39 +02:00
Herbert256 4a26628b29 Fixed bug #79030 Use usec from apache request time
Don't unnecessarily truncate to milliseconds.

Closes GH-5760.
2020-06-24 14:41:50 +02:00
Christoph M. Becker e94126aac7 Fix #55857: ftp_size on large files
`atol()` returns a `long` which is not the same as `zend_long` on
LLP64; we use `ZEND_ATOL()` instead.

There is no need for a new test case, since filesize_large.phpt already
tests for that behavior; unfortunately, the FTP test suite relies on
`pcntl_fork()` and therefore cannot be run on Windows.
2020-06-23 15:57:24 +02:00
Christoph M. Becker 91982bad63 7.3 is now 7.3.21-dev 2020-06-23 10:29:42 +02:00
Böszörményi Zoltán 6aff9a50ca Fixed bug #79570
Use the same logic for getgrgid_r, getpwnam_r and getpwuid_r
as for getgrnam_r in #75696

Closes GH-5740.
2020-06-19 17:31:28 +02:00
Nikita Popov 32f377b0b9 Fixed bug #79710
Make sure we don't use zresource after the stream has been destroyed.
2020-06-19 10:46:26 +02:00
Christoph M. Becker 5621c5faf8 Fix #79687: Sony picture - PHP Warning - Make, Model, MakerNotes
Even if the length of a maker note does not match our expectations
(either because the maker note is corrupted, or because our
expectations do not quite match reality), there is no need to let
parsing fail; we can still go on parsing the other meta information.
2020-06-13 18:30:57 +02:00
Christoph M. Becker 86e1f0ea11 Fix #79676: imagescale adds black border with IMG_BICUBIC
We have to loop over all image pixels to avoid the black border.  This
is also done in external libgd in `_gdScaleOneAxis` and `_gdScalePass`.
2020-06-12 14:05:54 +02:00
Christoph M. Becker 7ac0fb5ae4 Fix possibly unsupported timercmp() usage
The `timercmp()` manpage[1] points out that some systems have a broken
implementation which does not support `>=`.  This is definitely the
case for the Windows SDK, which only supports `<` and `>`.

[1] <https://linux.die.net/man/3/timercmp>
2020-06-09 16:52:19 +02:00
Christoph M. Becker eadd980706 Fix #62890: default_socket_timeout=-1 causes connection to timeout
While unencrypted connections ignore negative timeouts, SSL/TLS
connections did not special case that, and so always failed due to
timeout.
2020-06-09 16:45:34 +02:00
Christoph M. Becker eac700b1e6 [ci skip] Update NEWS 2020-06-09 16:37:17 +02:00
Christoph M. Becker 12c59f6660 Fix #74267: segfault with streams and invalid data
If the current character is a line break character, it cannot be a tab
or space character, so we would always fail with an invalid sequence
error.  Obviously, these `scan_stat == 4` conditions are meant to be
exclusive.

Furthermore, if `in_pp == NULL || in_left_p == NULL` is true, we hit a
segfault if we are not returning right away.  Obviously, the additional
constraints don't make sense, so we remove them.
2020-06-08 23:19:43 +02:00
Christoph M. Becker ceae81665c Fix #73527: Invalid memory access in php_filter_strip 2020-06-04 13:37:11 +02:00
Christoph M. Becker b8e7b30b47 Fix #79668: get_defined_functions(true) may miss functions
Instead of some brittle and unefficient string matching, we can just
check for the function handler.
2020-06-04 08:45:27 +02:00
Christoph M. Becker 63bd8f38f4 Fix #79664: PDOStatement::getColumnMeta fails on empty result set
As its name suggests, `sqlite3_data_count` returns the number of
columns in the current row of the result set; we are interested in the
number of columns regardless of the current row, so we have to use
`sqlite3_column_count` instead.
2020-06-02 10:45:47 +02:00
Christoph M. Becker 923c45bdca Fix #79650: php-win.exe 100% cpu lockup
As of PHP 7.3.0, `sapi_cli_single_write()` is supposed to return `< 0`
on failure, but `fwrite()` returns a `size_t`, and signals error by
setting the stream's error indicator.  We have to cater to that.
2020-06-01 13:22:44 +02:00
Christoph M. Becker 744f9016c4 Fix PVS-Studio integration
Without this configuration option, PVS-Studio looks for preprocessed
files (*.i), but these do not exists.
2020-05-28 15:23:37 +02:00
Dmitry Stogov 1f521a0b23 Fixed possible usage of uninitialized value 2020-05-27 11:25:18 +03:00
Christoph M. Becker c249f593ef 7.3.20 will be next 2020-05-26 10:53:22 +02:00
Christoph M. Becker d4bd6fb491 Fix #79615: Wrong GIF header written in GD GIFEncode
The color resolution is expected in bits 4-6 of the packed fields byte
of the logical screen descriptor (byte 10 of the GIF data stream),
according to the specification[1], section 18.

[1] <https://www.w3.org/Graphics/GIF/spec-gif89a.txt>
2020-05-22 09:15:41 +02:00
Christoph M. Becker 85ac5643ff Fix INI setting member name
Since the member is not used in `OnUpdateEol()` that's not really an
issue, but still it's confusing to apparently have two INI settings
targeting the same member.
2020-05-19 15:59:21 +02:00
Derick Rethans 74a4a5ae55 Put Xdebug 3 into 'off' mode for run-tests.php 2020-05-18 13:49:12 +01:00
Christoph M. Becker d1cd489a53 Fix #79596: MySQL FLOAT truncates to int some locales
We must not do locale aware float to string conversion here; instead
we using our `snprintf()` implementation with the `F` specifier.
2020-05-15 09:09:41 +02:00
Christoph M. Becker 5bdb4ab786 Fix #79588: Boolean opcache settings ignore on/off values
We should display boolean INI settings as boolean.
2020-05-12 19:44:39 +02:00
Christoph M. Becker bdba0cd3d2 Fix #79489: .user.ini does not inherit
On Windows, PATH_TRANSLATED may contain backslashes as well as slashes,
so we must not only check for `DEFAULT_SLASH`.
2020-05-12 11:47:47 +02:00
Christoph M. Becker 85e241c35c [ci skip] Update NEWS 2020-05-12 11:16:55 +02:00
Remi Collet 8f8f32cfaf Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump version to 7.2.32-dev
  Update NEWS
2020-05-12 09:19:11 +02:00
Remi Collet 4cf8be71df bump version to 7.2.32-dev 2020-05-12 09:16:01 +02:00
Stanislav Malyshev b4afd21428 Update NEWS 2020-05-11 14:28:51 -07:00
Stanislav Malyshev f43041250f Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78876: Long variables cause OOM and temp files are not cleaned
  Fix #78875: Long filenames cause OOM and temp files are not cleaned
  Update NEWS for 7.2.31
  Update CREDITS for PHP 7.2.30
  Update NEWS for PHP 7.2.30
2020-05-11 14:20:41 -07:00
Christoph M. Becker 3c8582ca4b Fix #78876: Long variables cause OOM and temp files are not cleaned
We use the proper type for size calculations, which is `size_t`.
2020-05-11 13:48:40 -07:00
Christoph M. Becker 1c9bd513ac Fix #78875: Long filenames cause OOM and temp files are not cleaned
We must not cast `size_t` to `int` (unless the `size_t` value is
guaranteed to be less than or equal to `INT_MAX`).  In this case we can
declare `array_len` as `size_t` in the first place.
2020-05-11 13:47:38 -07:00
Indrek Ardel 517431892b Fix default sendmail path when not found during build
Closes GH-5548.
2020-05-11 10:45:23 +02:00
Christoph M. Becker f33cf52faf Fix #79566: Private SHM is not private on Windows
We map the POSIX semantics of `IPC_PRIVATE` by creating unnamed file
mapping objects on Windows.  While that is not particularly useful for
ext/shmop, which is the only bundled extension which uses `shmget()`,
it may be useful for external extensions.
2020-05-05 11:38:29 +02:00
Christoph M. Becker c40a494406 Fix #79561: dns_get_record() fails with DNS_ALL
Since Windows has its own definitions of the `PHP_DNS_*` macros, we
have to use these when registering the PHP constants.
2020-05-04 22:59:38 +02:00
Nikita Popov 7c1316ec6a Fixed bug #79535
We did not allocate a cache slot for FETCH_CLASS. This is already
fixed on newer PHP versions.
2020-05-04 14:51:18 +02:00
Christoph M. Becker d950969e59 Add basic sapi_windows_cp_conv() test
This function is lacking any tests so far.
2020-05-04 11:50:03 +02:00
Christoph M. Becker 54148fd686 Fix #79528: Different object of the same xml between 7.4.5 and 7.4.4
Revert "Fix #61597: SXE properties may lack attributes and content"

This reverts commit 7c081db885.
2020-05-01 12:37:39 +02:00
Christoph M. Becker 6998cc5029 Bump version 2020-04-28 09:10:50 +02:00
Christoph M. Becker 29968d8f99 Fix #79470: PHP incompatible with 3rd party file system on demand
We add support for Activision HSM (`IO_REPARSE_TAG_ACTIVISION_HSM`) and
VFS for Git (`IO_REPARSE_TAG_PROJFS`).  The latter fixes bug #78784.
2020-04-27 09:30:57 +02:00
Derick Rethans b962d2e36f Updated to version 2020.1 (2020a) 2020-04-24 12:31:30 +01:00
Graham Campbell 51fb8398e2 Add additional preg_match test case
(cherry picked from commit a1a044dcc7
on author's explicit request)
2020-04-23 17:35:09 +02:00
Christoph M. Becker ccca2c448d Fix #79503: Memory leak on duplicate metadata
Duplicate metadata can only happen if someone tampers with the phar, so
we can and should treat that as error.
2020-04-22 15:07:46 +02:00
Christoph M. Becker fa10abd6d7 Fix #79491: Search for .user.ini extends up to root dir
The `start` parameter of `php_cgi_ini_activate_user_config` is supposed
to hold the byte offset of the doc root in the given `path`.  However,
the current expression which fixes a potential type incompatibility
will ever only evaluate to zero or one, because it uses the *logical*
and operator (`&&`).  Furthermore we notice that subtracting one from
`doc_root_len` is not necessary, so there is even no need for the
`start` parameter at all.
2020-04-20 10:56:36 +02:00
Nikita Popov f62571c121 Apply doc root fix for FPM
This is the change from GH-5417 but for FPM. This was stripping the
last character from the doc_root. Given how it is used, this should
be harmless, but let's make it less confusing...
2020-04-20 10:47:54 +02:00
Joe Cai 94e09bfe55 Fix #79497: Fix php_openssl_subtract_timeval()
I stumbled upon this while debugging a strange issue with
stream_socket_client() where it randomly throws out errors when
the connection timeout is set to below 1s. The logic to calculate
time difference in php_openssl_subtract_timeval() is wrong when
a.tv_usec < b.tv_usec, causing connection errors before the timeout
is reached.
2020-04-20 10:25:54 +02:00
Dmitry Stogov d31ccb5fc8 zend_timeout() may access EX(opline) 2020-04-17 14:55:14 +03:00
guirish a1c1736bfb Fix MySQL local infile / attr handling on big endian systems
Make sure pointer types match what is used by libmysql everywhere.

Closes GH-5380.
2020-04-16 11:22:17 +02:00
Nikita Popov 79a36ff7f3 Fixed bug #79477
Make sure to deindirect properties when creating array.
2020-04-15 11:21:05 +02:00
Christoph M. Becker c4cdf1ae12 Add missing CVE 2020-04-14 18:18:18 +02:00
Sara Golemon bef96b9d2c Update NEWS for 7.2.31 2020-04-14 15:38:55 +00:00
Sara Golemon cf083535f8 Update CREDITS for PHP 7.2.30 2020-04-14 15:16:26 +00:00
Sara Golemon bd49622a9a Update NEWS for PHP 7.2.30 2020-04-14 15:16:26 +00:00
Sara Golemon 2814850fd9 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #79468
  NEWS
2020-04-14 10:31:35 -04:00
dinosaur 13842eda37 Fixed bug #79468
Close the stream filter resources when removing them from the stream.
2020-04-14 10:27:28 -04:00
Sara Golemon 6df761b7ff NEWS 2020-04-14 10:25:37 -04:00
Nikita Popov b56fb9019e Don't leak peername if accept fails
Even if the accept fails, the peername may be populated.
2020-04-14 16:07:39 +02:00
Christoph M. Becker a1b46fc152 Fix test cases 2020-04-14 13:58:48 +02:00
dinosaur 95eaccd0bb Fixed bug #79468
Close the stream filter resources when removing them from the stream.
2020-04-14 11:59:51 +02:00
Christoph M. Becker 8967588702 Add NEWS entries [ci skip] 2020-04-14 08:54:00 +02:00
Stanislav Malyshev d539e61c30 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-13 21:09:08 -07:00
Stanislav Malyshev 9d6bf8221b Fix bug #79465 - use unsigneds as indexes. 2020-04-13 21:08:37 -07:00
Stanislav Malyshev 14fcc81394 Fix bug #79330 - make all execution modes consistent in rejecting \0 2020-04-13 21:08:30 -07:00
Christoph M. Becker 7e91fcd7f9 Fix memory leak introduced by fixing bug #78221
We have to free the retrieved text content; to keep the code readable,
we extract a helper function to check for empty nodes.  Unfortunately,
we cannot use xmlIsBlankNode(), because that also recognizes whitespace
only text content.

We also make sure to properly handle NULL returns from
xmlNodeGetContent().
2020-04-08 10:35:54 +02:00
George Peter Banyard a0df5f3b54 Revert "Went to fast and forgot to update tests"
This reverts commit 656eac74fa.
2020-04-07 22:24:40 +02:00
George Peter Banyard 6031b08240 Revert "Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails"
This commit brings some substantial changes in behaviour due to the weird implementation.
This will be fixed in master due to BC concerns.

This reverts commit 1333b46d6d.
2020-04-07 22:23:24 +02:00
Christoph M. Becker efec22b7be Fix #78221: DOMNode::normalize() doesn't remove empty text nodes
If a text node is not followed by another text node, we remove it, if
its textContent is empty.
2020-04-07 13:04:14 +02:00
George Peter Banyard 656eac74fa Went to fast and forgot to update tests
However due to the really lax conversion to integer all strings pass as 0
2020-04-03 22:03:00 +02:00
George Peter Banyard 1333b46d6d Fix Bug #79448 0 is a valid Unicode codepoint, but mb_substitute_character(0) fails 2020-04-03 21:18:45 +02:00
Qianqian Bu ee21657a6a Fix incorrect free for last_message
In commit a7305eb539 the last_message
field of the connection object was changed to be always non-persistent.
But there is a place on change_user path that still treats it
depending on conn->persistent flag. This will cause PHP crash after
com_change_user success when there is last_message set
2020-04-03 10:05:16 +02:00
Nikita Popov cf68bc413b Fixed bug #79434 2020-04-02 16:34:03 +02:00
Nikita Popov 14b770d407 Fix literal compaction collision between string and double
For the sake of simplicity I'm using a separate hashtable, rather
than trying to do hash perturabation on the double strings.
2020-04-01 14:20:59 +02:00
Christoph M. Becker cc3af6fdea Add NEWS entryc [ci skip] 2020-04-01 09:26:20 +02:00
George Peter Banyard 18dc9044f5 Fix bug 79441 2020-04-01 04:29:20 +02:00
Christoph M. Becker 33226c3a17 Next is 7.3.18 2020-03-31 10:22:55 +02:00
Christoph M. Becker b510250b8e Fix #79413: session_create_id() fails for active sessions
The comment on `PS_VALIDATE_SID_FUNC(files)` is very clear that the
function is supposed to return `SUCCESS` if the session already exists.
So to detect a collision, we have to check for `SUCCESS`, not
`FAILURE`.

We also fix the wrong condition in session_regenerate_id() as well.
2020-03-31 08:38:23 +02:00
Christoph M. Becker a681b12820 Fix #79427: Integer Overflow in shmop_open()
If `shm.shm_segsz > ZEND_LONG_MAX` the assignment to `shmop->size` a
few lines below would overflow, so we catch that early and bail out if
necessary.
2020-03-30 08:56:49 +02:00
Max Rees 04920645f1 Fix #79424 ext/zip: don't use gl_pathc after call to globfree
This breaks on Linux with the musl libc, since it zeroes out gl_pathc during
globfree.
2020-03-29 14:22:31 +02:00
Lukas Berger 7f9b534e3a Add missing 'skip' to bug79332.phpt skip message
The skip message must start with the word 'skip', otherwise the test will not be skipped.

*Before:*
Running selected tests.
TEST 1/1 [ext/com_dotnet/tests/bug79332.phpt]
========DIFF========
001+ Fatal error: Uncaught Error: Class 'COMPersistHelper' not found in /srv/php/ext/com_dotnet/tests/bug79332.php:2
001- A com_exception has been thrown
002+ Stack trace:
003+ #0 {main}
004+   thrown in /srv/php/ext/com_dotnet/tests/bug79332.php on line 2
========DONE========
FAIL Bug #79332 (php_istreams are never freed) [ext/com_dotnet/tests/bug79332.phpt]

*After:*
Running selected tests.
SKIP Bug #79332 (php_istreams are never freed) [ext/com_dotnet/tests/bug79332.phpt] reason: com_dotnet extension not available
2020-03-26 23:14:10 +01:00
Dmitry Stogov 65120cfc09 Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script). 2020-03-25 17:31:06 +03:00
Christian Schneider c0840fec9c Fix bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without newline)
Closes GH-5292.
2020-03-25 10:50:35 +01:00
Nikita Popov 2e8db5d6be Add test file
Forgot the git add again...
2020-03-23 17:13:57 +01:00
Nikita Popov 34f1266a9c Handle NULL caller_call_opline
This can happen if there is an EXIT in the call arguments, in which
case the DO_CALL opcode may be eliminated as unreachable.
2020-03-23 17:12:01 +01:00
Christoph M. Becker ba404f21e4 Fix test for Windows
Windows filenames may very well contain a colon, so we adjust the test
accordingly.
2020-03-23 16:22:45 +01:00
Christoph M. Becker 32a2644305 Fix #79200: Some iconv functions cut Windows-1258
To cater to potentially state-dependent encodings, we have to reset the
conversion descriptor into its initial shift state to properly finish
the conversion.  Furthermore, state-dependent encodings may not show
progress when comparing `in_left` before and after the conversion; we
rather have to see whether `out_left` has decreased.  Also we have to
cater to the fact that the final potentially state resetting call does
not signal failure, but we still have to break respective loops
afterwards.
2020-03-23 14:12:37 +01:00
Christoph M. Becker 47c745555c Fix #79393: Null coalescing operator failing with SplFixedArray
We favor the KISS principle over optimization[1] – SPL is already
special enough.

[1] <https://github.com/php/php-src/pull/2489/commits/352f3d4476a79bb86136b431719df7394e5a8d4e#r112498098>ff
2020-03-23 13:29:25 +01:00
Remi Collet 51c57a9c67 NEWS 2020-03-20 11:16:08 +01:00
Remi Collet 8aab43c85d Fix Bug #79296 ZipArchive::open fails on empty file 2020-03-20 11:14:58 +01:00
Nate Brunette d70058a139 Fix #79396: DateTime hour incorrect during DST jump forward
When you attempt to set the time to a non-existent time occuring during
a DST jump forward, the hour does not move forward correctly.
2020-03-19 08:50:34 +01:00
Nikita Popov c00cce3229 Clarify session.cookie_samesite="None" 2020-03-18 15:59:30 +01:00
Remi Collet b114e3d953 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump verison to 7.2.30-dev
2020-03-17 11:28:47 +01:00
Remi Collet 3072b77c21 bump verison to 7.2.30-dev 2020-03-17 11:28:34 +01:00
Christoph M. Becker 9b8aa105ed Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix NEWS
2020-03-17 11:09:55 +01:00
Christoph M. Becker 6a4fff4682 Fix NEWS 2020-03-17 11:06:45 +01:00
Christoph M. Becker 3588b6bba6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  [ci skip] Update NEWS
  Fix test
  Fix bug #79329 - get_headers should not accept \0
  Fixed bug #79282
2020-03-17 10:56:47 +01:00
Stanislav Malyshev e71fa03107 [ci skip] Update NEWS 2020-03-16 22:40:00 -07:00
Stanislav Malyshev 62e7b80267 Fix test 2020-03-16 22:40:00 -07:00
Stanislav Malyshev 69fdc14152 Fix bug #79329 - get_headers should not accept \0 2020-03-16 22:40:00 -07:00
Stanislav Malyshev 25238bdf60 Fixed bug #79282 2020-03-16 22:40:00 -07:00
Christoph M. Becker 1fdffd1c55 Fix #79371: mb_strtolower (UTF-32LE): stack-buffer-overflow
We make sure that negative values are properly compared.
2020-03-16 22:40:00 -07:00
Stanislav Malyshev c8d21d7728 [ci skip] Update NEWS 2020-03-15 19:38:31 -07:00
Stanislav Malyshev 2c081b7e26 Fix test 2020-03-15 17:55:28 -07:00
Stanislav Malyshev 0d139c5b94 Fix bug #79329 - get_headers should not accept \0 2020-03-15 17:30:44 -07:00
Stanislav Malyshev 41f66e2a2c Fixed bug #79282 2020-03-15 17:26:00 -07:00
Jacob Dreesen 68e2da6362 Fix typo in php.ini comment 2020-03-15 15:00:05 +01:00
Christoph M. Becker 2b5fc8e325 Fix #79199: curl_copy_handle() memory leak
`curl_copy_handle()` already registers a new resource, so we must not
increase the refcount of the original resource.
2020-03-12 11:23:53 +01:00
Christoph M. Becker 7c081db885 Fix #61597: SXE properties may lack attributes and content
We must not treat a node as string if it has attributes, unless it is
an entity declaration which is always treated as string by simplexml.
2020-03-12 10:52:28 +01:00
Christoph M. BeckerandNikita Popov 53797c206a Fix #78210: Invalid pointer address
This is actually about three distinct issues:

* If an empty string is passed as $address to `stream_socket_sendto()`,
  the `sa` is not initialized, so we must not pass it as `addr` to
  `php_stream_xport_sendto()`.

* On POSIX, `recvfrom()` truncates messages which are too long to fit
  into the specified buffer (unless `MSG_PEEK` is given), discards the
  excessive bytes, and returns the buffer length.  On Windows, the same
  happens, but `recvfrom()` returns `SOCKET_ERROR` with the error code
  `WSAEMSGSIZE`.  We have to catch this for best POSIX compatibility.

* In `php_network_parse_network_address_with_port()`, we have to zero
  `in6` (not only its alias `sa`) to properly support IPv6.

Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2020-03-11 11:30:15 +01:00
Christoph M. Becker 2462f2dab1 Fix #79364: When copy empty array, next key is unspecified
We must not forget to keep the `nNextFreeElement` when duplicating
empty arrays.
2020-03-11 08:54:05 +01:00
Christoph M. Becker d5e206620b Enclose INI values containing {TMP} in quotes
At least on Windows, the temporary directory may contain tilde signs,
which would result in an INI parse error.
2020-03-09 22:49:08 +01:00
Christoph M. Becker dc4f42508d Skip test on Windows if privileges are insufficient 2020-03-06 16:38:49 +01:00
Christoph M. Becker b84277297a Fix #75673: SplStack::unserialize() behavior
Even though `SplStack::unserialize()` is not supposed to be called on
an already constructed instance, it is probably better if the method
clears the stack before actually unserializing.
2020-03-06 09:09:49 +01:00
Christoph M. Becker 9dda3b9eb2 Next is 7.3.17 2020-03-03 10:19:31 +01:00
Christoph M. Becker f15ab32af8 Update libmagic.patch
Some commits missed to update the patch file, so we're catching up on
this.

To generally make this easier, we back-port generate_patch.sh from
PHP-7.4, where we now also generate magic.h from magic.h.in.
2020-03-02 15:03:45 +01:00
Christoph M. Becker 53140e5c56 Fix #79333: com_print_typeinfo() leaks memory
We have to free the `ansiname`s, regardless of whether they have been
put into the hashtable or not.

Since bug79299.phpt already shows the leak when run with a leak
checker, there is no need for another regression test.
2020-03-02 11:36:30 +01:00
Christoph M. Becker 2adf1c4d23 Fix #79332: php_istreams are never freed
Releasing the `com_dotnet_istream_wrapper` in `istream_destructor()` is
pointless, since `istream_destructor()` is only called when the
resource is going to be released.  This recursion is not a real issue,
though, since the resource is never exposed to userland, and has at
most refcount 1, so due to well defined unsigned integer underflow, it
never is released twice.  However, returning early in this case causes
a memory leak which needs to be fixed.
2020-03-02 10:45:37 +01:00
Nikita Popov 6c48da9a50 Fixed bug #79062
Back up the doc comment when performing heredoc scanahead.
2020-02-28 17:06:05 +01:00
Christoph M. Becker 6adb885966 Fix #79311: enchant_dict_suggest() fails on big endian architecture
For obvious reasons, we must not assign a `size_t` value to an `int`
variable using memcpy().  However, there is actually no need for the
intermediate `n_sugg_st` here, if we use the proper types in the first
place.

A regression test is not necessary, because dict_suggest.phpt already
exhibits the erroneous behavior on big endian architectures.
2020-02-28 15:43:44 +01:00
Remi Collet d31fc591e0 Fix #79315 ZipArchive::addFile doesn't honor start/length parameters 2020-02-28 10:29:50 +01:00
Dmitry Stogov 5b51b633e2 Fixed incorrect overflow detection 2020-02-27 23:37:41 +03:00
Christoph M. Becker 49762c84e0 Add upgrading node regarding fix for bug #79271
Cf. <https://github.com/php/php-src/pull/5180#issuecomment-590259750>ff.
2020-02-27 10:33:20 +01:00
Dmitry Stogov 45b4368d5c Fixed incorrect behavior of internal memory debugger 2020-02-27 12:27:22 +03:00
Christoph M. Becker 8654c32b58 Fix #64032: mysqli reports different client_version
While `mysqli_get_client_version()` calls `mysql_get_client_version()`
to retrieve the client version, `mysql::$client_version` is initialized
to `MYSQL_VERSION_ID`.  Both should match though, and since the former
is the more useful information, we fix `mysql::$client_version`.

We do not add a regression test, because it would usually succeed
anyway, and we already have several tests with respective `assert()`s.
2020-02-27 09:35:04 +01:00
Mark Plomer 8c6a7c3326 Fix #63206: Fully support error/exception_handler stacking, even with null or inside the handler
Always push the current user_error/exception_handler to the stack,
even when it is empty, so restore_error_handler() always works as
expected.

The user_error_handler is especially temporarily empty when we are inside
the error handler, which caused inconsistent behaviour before.
2020-02-25 12:43:42 +01:00
Nikita Popov 56cdbe63c2 Don't treat any WS as start of header
Check that the header occurs after \n, not other whitespace
characters.
2020-02-24 10:20:33 +01:00
Nikita Popov 3d9c02364d Reduce code duplication in HTTP header checks 2020-02-24 10:03:05 +01:00
Miguel Xavier Penha Neto d0d60503b5 Fixes #79265: Improper injection of Host header when using fopen for http requests
Check all occurrences of the string "host:" (and other headers),
not just the first one.
2020-02-24 09:50:32 +01:00
Christoph M. Becker 9e6358af36 Fix #79299: com_print_typeinfo prints duplicate variables
`lastid` has to retain its value during the traversal, so we move it to
an outer scope.

Patch contributed by Litiano Moura.
2020-02-23 23:31:36 +01:00
Christoph M. Becker f133f0024e Fix #79294: ::columnType() may fail after SQLite3Stmt::reset()
The fix for feature request #53466 did not properly handle resetting of
the corresponding statement; the problem with this is that the
statement does not know about its result sets.  But even if we could
fix this, the `complete` handling still appears to be brittle, since
the `sqlite3_column_type()`docs[1] state:

| If the SQL statement does not currently point to a valid row, or if
| the column index is out of range, the result is undefined.

Fortunately, we can use `sqlite3_data_count()` instead, since[2]:

| If prepared statement P does not have results ready to return (via
| calls to the sqlite3_column() family of interfaces) then
| sqlite3_data_count(P) returns 0.

Thus, we guard `SQLite3::columnType()` with `sqlite3_data_count()`, and
completely drop updating the `php_sqlite3_result_object.complete`
field, but keep it for ABI BC purposes.

[1] <https://www.sqlite.org/c3ref/column_blob.html>
[2] <https://www.sqlite.org/c3ref/data_count.html>
2020-02-21 13:36:29 +01:00
Christoph M. Becker ad000a63e8 Add test for bug #78569 2020-02-21 10:31:26 +01:00
Christoph M. Becker ab5b6702d7 Fix NEWS [ci skip]
Cosmetics.
2020-02-20 10:55:17 +01:00
Christoph M. Becker 31dd45564c Remove extra tab in NEWS [ci skip] 2020-02-18 11:09:37 +01:00
Remi Collet 2aecf3aba9 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump version to 7.2.29
2020-02-18 11:00:49 +01:00
Remi Collet 63f6608f89 bump version to 7.2.29 2020-02-18 11:00:28 +01:00
Christoph M. Becker 08073b0658 Fix #79038: PDOStatement::nextRowset() leaks column values
Firstly, we must not rely on `stmt->column_count` when freeing the
driver specific column values, but rather store the column count in
the driver data.  Since the column count is a `short`, 16 bit are
sufficient, so we can store it in reserved bits of `pdo_odbc_stmt`.

Furthermore, we must not allocate new column value storage when the
statement is not executed, but rather when the column value storage has
not been allocated.

Finally, we have to introduce a driver specific `cursor_closer` to
avoid that `::closeCursor()` calls `odbc_stmt_next_rowset()` which then
frees the column value storage, because it may be still needed for
bound columns.
2020-02-17 22:53:02 +01:00
Christoph M. Becker 16c7c71693 Fix NEWS [ci skip] 2020-02-17 19:35:42 +01:00
Christoph M. Becker 788065fb8c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS [ci skip]
2020-02-17 19:23:31 +01:00
Christoph M. Becker 5009b9811d Update NEWS [ci skip] 2020-02-17 19:21:51 +01:00
Christoph M. Becker 2831334bd3 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Mark bug76348.phpt as online test
  Fix bug #79082 - Files added to tar with Phar::buildFromIterator have all-access permissions
  Fix bug #79221 - Null Pointer Dereference in PHP Session Upload Progress
2020-02-17 19:08:04 +01:00
Christoph M. Becker 7df594b943 Fix # 79171: heap-buffer-overflow in phar_extract_file
We must not access memory outside of the allocated buffer.
2020-02-17 00:20:04 -08:00
Stanislav Malyshev 6facfa59a5 Fix bug #79082 - Files added to tar with Phar::buildFromIterator have all-access permissions 2020-02-17 00:19:30 -08:00
Stanislav Malyshev 409965fe1c Fix bug #79221 - Null Pointer Dereference in PHP Session Upload Progress 2020-02-17 00:19:30 -08:00
Christoph M. Becker 0966941130 Fix #79271: DOMDocumentType::$childNodes is NULL
Dom level 2 core, DOM level 3 core and the DOM living standard agree
that `childNodes` always return a `NodeList`, and never `null`.
2020-02-17 09:07:54 +01:00
Nikita Popov 2826364298 Mark bug76348.phpt as online test 2020-02-16 22:40:25 -08:00
Stanislav Malyshev e5c95234d8 Fix bug #79082 - Files added to tar with Phar::buildFromIterator have all-access permissions 2020-02-16 22:38:38 -08:00
Stanislav Malyshev d76f7c6c63 Fix bug #79221 - Null Pointer Dereference in PHP Session Upload Progress 2020-02-15 20:52:19 -08:00
Christoph M. Becker 392dada1d6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix typo in recent bugfix
2020-02-14 09:22:51 +01:00
Christoph M. Becker 8308196c97 Fix typo in recent bugfix 2020-02-14 09:21:13 +01:00
Christoph M. Becker 8ebadd1128 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77569: Write Acess Violation in DomImplementation
2020-02-13 15:15:05 +01:00
Christoph M. Becker cec8b24c84 Fix #77569: Write Acess Violation in DomImplementation
We must not assume that the zval IS_STRING.
2020-02-13 15:13:26 +01:00
Christoph M. Becker 7b464ce6f3 Fix #79254: getenv() w/o arguments not showing changes
To be able to see changes done only with `SetEnvironmentVariable()`, we
have to use `GetEnvironmentStrings()` instead of `environ`, because the
latter sees only changes done with `putenv()`.

For best backward compatibility we're using `GetEnvironmentStringsA()`;
switching to the wide string version likely makes sense for master,
though.
2020-02-11 11:47:29 +01:00
Christoph M. Becker f649adedfe Fix #79248: Traversing empty VT_ARRAY throws com_exception
If the `VT_ARRAY` is empty, i.e. its upperbound is less than its lower
bound, we must not call `php_com_safearray_get_elem()`, because that
function throws in this case.
2020-02-08 17:05:29 +01:00
Christoph M. Becker 674d44ad7c Skip test case on x86 where it otherwise fails [ci skip]
`-2200000000` can't be converted to integer on x86, so the constructor
call would fail.
2020-02-07 21:09:35 +01:00
Christoph M. Becker b9738f5802 Fix #79242: COM error constants don't match com_exception codes
Because a `HRESULT` is a `LONG`[1], no special treatment is required on
x86 platforms to get appropriate values.  On x64 platforms we prefer
positive values, what we could accomplish by casting the `HRESULT`
value to `ULONG` and then to `zend_long`, but since the current
behavior is correct and the performance improvement is negligible, we
defer that to master.

[1] <https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#hresult>
2020-02-07 18:04:14 +01:00
Christoph M. Becker 5e2ea00b15 Fix #66322: COMPersistHelper::SaveToFile can save to wrong location
Saving under the given `filename` may also work, but since
`::LoadFromFile` uses the `fullpath` we follow suit.
2020-02-06 14:59:55 +01:00
Nikita Popov 13bfa9f5ac Fixed bug #79188 2020-02-05 11:18:46 +01:00
Christoph M. Becker e3632fdc0d Next is 7.3.16 2020-02-04 11:38:29 +01:00
367 changed files with 26980 additions and 25765 deletions

No files matched your search

+438 -3
View File
@@ -1,11 +1,446 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.29
29 Apr 2021, PHP 7.3.28
- Core:
. Fixed ./makedist wrt. to GH move. (cmb, Remi)
- Imap:
. Fixed bug #80710 (imap_mail_compose() header injection). (cmb, Stas)
04 Feb 2021, PHP 7.3.27
- SOAP:
. Fixed bug #80672 (Null Dereference in SoapClient). (CVE-2021-21702) (cmb, Stas)
07 Jan 2021, PHP 7.3.26
- Standard:
. Fixed bug #77423 (FILTER_VALIDATE_URL accepts URLs with invalid userinfo).
(CVE-2020-7071) (cmb)
. Fixed bug #80457 (stream_get_contents() fails with maxlength=-1 or default).
(bruno dot premont at restena dot lu)
26 Nov 2020, PHP 7.3.25
- Core:
. Fixed bug #80280 (ADD_EXTENSION_DEP() fails for ext/standard and ext/date).
(cmb)
. Fixed bug #80258 (Windows Deduplication Enabled, randon permission errors).
(cmb)
- COM:
. Fixed bug #62474 (com_event_sink crashes on certain arguments). (cmb)
- DOM:
. Fixed bug #80268 (loadHTML() truncates at NUL bytes). (cmb)
- IMAP:
. Fixed bug #64076 (imap_sort() does not return FALSE on failure). (cmb)
. Fixed bug #76618 (segfault on imap_reopen). (girgias)
. Fixed bug #80239 (imap_rfc822_write_address() leaks memory). (cmb)
. Fixed minor regression caused by fixing bug #80220. (cmb)
. Fixed bug #80242 (imap_mail_compose() segfaults for multipart with rfc822).
(cmb)
- Intl:
. Fixed bug #80310 (ext-intl with icu4c 68.1: use of undeclared identifier
'TRUE'). (Alexander M. Turek)
- ODBC:
. Fixed bug #44618 (Fetching may rely on uninitialized data). (cmb)
- SNMP:
. Fixed bug #70461 (disable md5 code when it is not supported in net-snmp).
(Alexander Bergmann, cmb)
- Standard:
. Fixed bug #80266 (parse_url silently drops port number 0). (cmb, Nikita)
29 Oct 2020, PHP 7.3.24
- Core:
. Fixed bug #79423 (copy command is limited to size of file it can copy).
(cmb)
- Calendar:
. Fixed bug #80185 (jdtounix() fails after 2037). (cmb)
- IMAP:
. Fixed bug #80213 (imap_mail_compose() segfaults on certain $bodies). (cmb)
. Fixed bug #80215 (imap_mail_compose() may modify by-val parameters). (cmb)
. Fixed bug #80220 (imap_mail_compose() may leak memory). (cmb)
. Fixed bug #80223 (imap_mail_compose() leaks envelope on malformed bodies).
(cmb)
. Fixed bug #80216 (imap_mail_compose() does not validate types/encodings).
(cmb)
. Fixed bug #80226 (imap_sort() leaks sortpgm memory). (cmb)
- MySQLnd:
. Fixed bug #80115 (mysqlnd.debug doesn't recognize absolute paths with
slashes). (cmb)
. Fixed bug #80107 (mysqli_query() fails for ~16 MB long query when
compression is enabled). (Nikita)
- ODBC:
. Fixed bug #78470 (odbc_specialcolumns() no longer accepts $nullable). (cmb)
. Fixed bug #80147 (BINARY strings may not be properly zero-terminated).
(cmb)
. Fixed bug #80150 (Failure to fetch error message). (cmb)
. Fixed bug #80152 (odbc_execute() moves internal pointer of $params). (cmb)
. Fixed bug #46050 (odbc_next_result corrupts prepared resource). (cmb)
- OPcache:
. Fixed bug #80083 (Optimizer pass 6 removes variables used for ibm_db2 data
binding). (Nikita)
- PDO_ODBC:
. Fixed bug #67465 (NULL Pointer dereference in odbc_handle_preparer). (cmb)
- Standard:
. Fixed bug #80114 (parse_url does not accept URLs with port 0). (cmb, twosee)
. Fixed bug #76943 (Inconsistent stream_wrapper_restore() errors). (cmb)
. Fixed bug #76735 (Incorrect message in fopen on invalid mode). (cmb)
- Tidy:
. Fixed bug #77040 (tidyNode::isHtml() is completely broken). (cmb)
01 Oct 2020, PHP 7.3.23
- Core:
. Fixed bug #80048 (Bug #69100 has not been fixed for Windows). (cmb)
. Fixed bug #80049 (Memleak when coercing integers to string via variadic
argument). (Nikita)
. Fixed bug #79699 (PHP parses encoded cookie names so malicious `__Host-`
cookies can be sent). (CVE-2020-7070) (Stas)
- Calendar:
. Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
(Andy Postnikov)
- COM:
. Fixed bug #64130 (COM obj parameters passed by reference are not updated).
(cmb)
- OPcache:
. Fixed bug #80002 (calc free space for new interned string is wrong).
(t-matsuno)
. Fixed bug #79825 (opcache.file_cache causes SIGSEGV when custom opcode
handlers changed). (SammyK)
- OpenSSL:
. Fixed bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12
bytes IV). (CVE-2020-7069) (Jakub Zelenka)
- PDO:
. Fixed bug #80027 (Terrible performance using $query->fetch on queries with
many bind parameters). (Matteo)
- SOAP:
. Fixed bug #47021 (SoapClient stumbles over WSDL delivered with
"Transfer-Encoding: chunked"). (Matteo)
- Standard:
. Fixed bug #79986 (str_ireplace bug with diacritics characters). (cmb)
. Fixed bug #80077 (getmxrr test bug). (Rainer Jung)
. Fixed bug #72941 (Modifying bucket->data by-ref has no effect any longer).
(cmb)
. Fixed bug #80067 (Omitting the port in bindto setting errors). (cmb)
03 Sep 2020, PHP 7.3.22
- Core:
. Fixed bug #79884 (PHP_CONFIG_FILE_PATH is meaningless). (cmb)
. Fixed bug #77932 (File extensions are case-sensitive). (cmb)
. Fixed bug #79806 (realpath() erroneously resolves link to link). (cmb)
. Fixed bug #79895 (PHP_CHECK_GCC_ARG does not allow flags with equal sign).
(Santiago M. Mola)
. Fixed bug #79919 (Stack use-after-scope in define()). (cmb)
. Fixed bug #79934 (CRLF-only line in heredoc causes parsing error).
(Pieter van den Ham)
- COM:
. Fixed bug #48585 (com_load_typelib holds reference, fails on second call).
(cmb)
- Exif:
. Fixed bug #75785 (Many errors from exif_read_data).
(Níckolas Daniel da Silva)
- Gettext:
. Fixed bug #70574 (Tests fail due to relying on Linux fallback behavior for
gettext()). (Florian Engelhardt)
- LDAP:
. Fixed memory leaks. (ptomulik)
- OPcache:
. Fixed bug #73060 (php failed with error after temp folder cleaned up).
(cmb)
- PDO:
. Fixed bug #64705 (errorInfo property of PDOException is null when
PDO::__construct() fails). (Ahmed Abdou)
- Standard:
. Fixed bug #79930 (array_merge_recursive() crashes when called with array
with single reference). (Nikita)
. Fixed bug #79944 (getmxrr always returns true on Alpine linux). (Nikita)
. Fixed bug #79951 (Memory leak in str_replace of empty string). (Nikita)
- XML:
. Fixed bug #79922 (Crash after multiple calls to xml_parser_free()). (cmb)
06 Aug 2020, PHP 7.3.21
- Apache:
. Fixed bug #79030 (Upgrade apache2handler's php_apache_sapi_get_request_time
to return usec). (Herbert256)
- Core:
. Fixed bug #79877 (getimagesize function silently truncates after a null
byte) (cmb)
. Fixed bug #79778 (Assertion failure if dumping closure with unresolved
static variable). (Nikita)
. Fixed bug #79792 (HT iterators not removed if empty array is destroyed).
(Nikita)
- COM:
. Fixed bug #63208 (BSTR to PHP string conversion not binary safe). (cmb)
. Fixed bug #63527 (DCOM does not work with Username, Password parameter).
(cmb)
- Curl:
. Fixed bug #79741 (curl_setopt CURLOPT_POSTFIELDS asserts on object with
declared properties). (Nikita)
- Fileinfo:
. Fixed bug #79756 (finfo_file crash (FILEINFO_MIME)). (cmb)
- FTP:
. Fixed bug #55857 (ftp_size on large files). (cmb)
- Mbstring:
. Fixed bug #79787 (mb_strimwidth does not trim string). (XXiang)
- Phar:
. Fixed bug #79797 (Use of freed hash key in the phar_parse_zipfile
function). (CVE-2020-7068) (cmb)
- Standard:
. Fixed bug #70362 (Can't copy() large 'data://' with open_basedir). (cmb)
. Fixed bug #79817 (str_replace() does not handle INDIRECT elements). (Nikita)
. Fixed bug #78008 (dns_check_record() always return true on Alpine).
(Andy Postnikov)
09 Jul 2020, PHP 7.3.20
- Core:
. Fixed bug #79650 (php-win.exe 100% cpu lockup). (cmb)
. Fixed bug #79668 (get_defined_functions(true) may miss functions). (cmb,
Nikita)
. Fixed possibly unsupported timercmp() usage. (cmb)
- Exif:
. Fixed bug #79687 (Sony picture - PHP Warning - Make, Model, MakerNotes).
(cmb)
- Filter:
. Fixed bug #73527 (Invalid memory access in php_filter_strip). (cmb)
- GD:
. Fixed bug #79676 (imagescale adds black border with IMG_BICUBIC). (cmb)
- OpenSSL:
. Fixed bug #62890 (default_socket_timeout=-1 causes connection to timeout).
(cmb)
- PDO SQLite:
. Fixed bug #79664 (PDOStatement::getColumnMeta fails on empty result set).
(cmb)
- SPL:
. Fixed bug #79710 (Reproducible segfault in error_handler during GC
involved an SplFileObject). (Nikita)
- Standard:
. Fixed bug #74267 (segfault with streams and invalid data). (cmb)
. Fixed bug #79579 (ZTS build of PHP 7.3.17 doesn't handle ERANGE for
posix_getgrgid and others). (Böszörményi Zoltán)
11 Jun 2020, PHP 7.3.19
- Core:
. Fixed bug #79566 (Private SHM is not private on Windows). (cmb)
. Fixed bug #79489 (.user.ini does not inherit). (cmb)
- GD:
. Fixed bug #79615 (Wrong GIF header written in GD GIFEncode). (sageptr, cmb)
- MySQLnd:
. Fixed bug #79596 (MySQL FLOAT truncates to int some locales). (cmb)
- Opcache:
. Fixed bug #79535 (PHP crashes with specific opcache.optimization_level).
(Nikita)
. Fixed bug #79588 (Boolean opcache settings ignore on/off values). (cmb)
- Standard:
. Fixed bug #79561 (dns_get_record() fails with DNS_ALL). (cmb)
14 May 2020, PHP 7.3.18
- Core:
. Fixed bug #78875 (Long filenames cause OOM and temp files are not cleaned).
(CVE-2019-11048) (cmb)
. Fixed bug #78876 (Long variables in multipart/form-data cause OOM and temp
files are not cleaned). (CVE-2019-11048) (cmb)
. Fixed bug #79434 (PHP 7.3 and PHP-7.4 crash with NULL-pointer dereference
on !CS constant). (Nikita)
. Fixed bug #79477 (casting object into array creates references). (Nikita)
. Fixed bug #79470 (PHP incompatible with 3rd party file system on demand).
(cmb)
. Fixed bug #78784 (Unable to interact with files inside a VFS for Git
repository). (cmb)
- DOM:
. Fixed bug #78221 (DOMNode::normalize() doesn't remove empty text nodes).
(cmb)
- FCGI:
. Fixed bug #79491 (Search for .user.ini extends up to root dir). (cmb)
- MBString:
. Fixed bug #79441 (Segfault in mb_chr() if internal encoding is unsupported).
(Girgias)
- OpenSSL:
. Fixed bug #79497 (stream_socket_client() throws an unknown error sometimes
with <1s timeout). (Joe Cai)
- Phar:
. Fix bug #79503 (Memory leak on duplicate metadata). (cmb)
- SimpleXML:
. Fixed bug #79528 (Different object of the same xml between 7.4.5 and
7.4.4). (cmb)
- Standard:
. Fixed bug #79468 (SIGSEGV when closing stream handle with a stream filter
appended). (dinosaur)
16 Apr 2020, PHP 7.3.17
- Core:
. Fixed bug #79364 (When copy empty array, next key is unspecified). (cmb)
. Fixed bug #78210 (Invalid pointer address). (cmb, Nikita)
- CURL:
. Fixed bug #79199 (curl_copy_handle() memory leak). (cmb)
- Date:
. Fixed bug #79396 (DateTime hour incorrect during DST jump forward). (Nate
Brunette)
- Iconv:
. Fixed bug #79200 (Some iconv functions cut Windows-1258). (cmb)
- OPcache:
. Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
(Dmitry)
- Session:
. Fixed bug #79413 (session_create_id() fails for active sessions). (cmb)
- Shmop:
. Fixed bug #79427 (Integer Overflow in shmop_open()). (cmb)
- SimpleXML:
. Fixed bug #61597 (SXE properties may lack attributes and content). (cmb)
- Spl:
. Fixed bug #75673 (SplStack::unserialize() behavior). (cmb)
. Fixed bug #79393 (Null coalescing operator failing with SplFixedArray).
(cmb)
- Standard:
. Fixed bug #79330 (shell_exec() silently truncates after a null byte). (stas)
. Fixed bug #79465 (OOB Read in urldecode()). (CVE-2020-7067) (stas)
. Fixed bug #79410 (system() swallows last chunk if it is exactly 4095 bytes
without newline). (Christian Schneider)
- Zip:
. Fixed Bug #79296 (ZipArchive::open fails on empty file). (Remi)
. Fixed bug #79424 (php_zip_glob uses gl_pathc after call to globfree).
(Max Rees)
19 Mar 2020, PHP 7.3.16
- Core:
. Fixed bug #63206 (restore_error_handler does not restore previous errors
mask). (Mark Plomer)
- COM:
. Fixed bug #66322 (COMPersistHelper::SaveToFile can save to wrong location).
(cmb)
. Fixed bug #79242 (COM error constants don't match com_exception codes on
x86). (cmb)
. Fixed bug #79248 (Traversing empty VT_ARRAY throws com_exception). (cmb)
. Fixed bug #79299 (com_print_typeinfo prints duplicate variables). (Litiano
Moura)
. Fixed bug #79332 (php_istreams are never freed). (cmb)
. Fixed bug #79333 (com_print_typeinfo() leaks memory). (cmb)
- DOM:
. Fixed bug #77569: (Write Access Violation in DomImplementation). (Nikita,
cmb)
. Fixed bug #79271 (DOMDocumentType::$childNodes is NULL). (cmb)
- Enchant:
. Fixed bug #79311 (enchant_dict_suggest() fails on big endian architecture).
(cmb)
- EXIF:
. Fixed bug #79282 (Use-of-uninitialized-value in exif). (CVE-2020-7064)
(Nikita)
- MBstring:
. Fixed bug #79371 (mb_strtolower (UTF-32LE): stack-buffer-overflow at
php_unicode_tolower_full). (CVE-2020-7065) (cmb)
- MySQLi:
. Fixed bug #64032 (mysqli reports different client_version). (cmb)
- PCRE:
. Fixed bug #79188 (Memory corruption in preg_replace/preg_replace_callback
and unicode). (Nikita)
- PDO_ODBC:
. Fixed bug #79038 (PDOStatement::nextRowset() leaks column values). (cmb)
- Reflection:
. Fixed bug #79062 (Property with heredoc default value returns false for
getDocComment). (Nikita)
- SQLite3:
. Fixed bug #79294 (::columnType() may fail after SQLite3Stmt::reset()). (cmb)
- Standard:
. Fixed bug #79329 (get_headers() silently truncates after a null byte).
(CVE-2020-7066) (cmb)
. Fixed bug #79254 (getenv() w/o arguments not showing changes). (cmb)
. Fixed bug #79265 (Improper injection of Host header when using fopen for
http requests). (Miguel Xavier Penha Neto)
20 Feb 2020, PHP 7.3.15
- Core:
. Fixed bug #71876 (Memory corruption htmlspecialchars(): charset `*' not
supported). (Nikita)
. Fixed bug ##79146 (cscript can fail to run on some systems). (clarodeus)
. Fixed bug #79146 (cscript can fail to run on some systems). (clarodeus)
. Fixed bug #78323 (Code 0 is returned on invalid options). (Ivan Mikheykin)
. Fixed bug #76047 (Use-after-free when accessing already destructed
backtrace arguments). (Nikita)
@@ -14,7 +449,7 @@ PHP NEWS
. Fixed bug #79078 (Hypothetical use-after-free in curl_multi_add_handle()).
(cmb)
-Intl:
- Intl:
. Fixed bug #79212 (NumberFormatter::format() may detect wrong type). (cmb)
- Libxml:
@@ -35,7 +470,7 @@ PHP NEWS
. Fixed bug #79082 (Files added to tar with Phar::buildFromIterator have
all-access permissions). (CVE-2020-7063) (stas)
. Fixed bug #79171 (heap-buffer-overflow in phar_extract_file).
(CVE- 2020-7061) (cmb)
(CVE-2020-7061) (cmb)
. Fixed bug #76584 (PharFileInfo::decompress not working). (cmb)
- Reflection:
+9 -7
View File
@@ -616,14 +616,16 @@ TSRM_API int shmget(key_t key, size_t size, int flags)
{/*{{{*/
shm_pair *shm;
char shm_segment[26], shm_info[29];
HANDLE shm_handle, info_handle;
HANDLE shm_handle = NULL, info_handle = NULL;
BOOL created = FALSE;
snprintf(shm_segment, sizeof(shm_segment), "TSRM_SHM_SEGMENT:%d", key);
snprintf(shm_info, sizeof(shm_info), "TSRM_SHM_DESCRIPTOR:%d", key);
if (key != IPC_PRIVATE) {
snprintf(shm_segment, sizeof(shm_segment), "TSRM_SHM_SEGMENT:%d", key);
snprintf(shm_info, sizeof(shm_info), "TSRM_SHM_DESCRIPTOR:%d", key);
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
shm_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_segment);
info_handle = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, shm_info);
}
if (!shm_handle && !info_handle) {
if (flags & IPC_CREAT) {
@@ -634,8 +636,8 @@ TSRM_API int shmget(key_t key, size_t size, int flags)
DWORD high = 0;
DWORD low = size;
#endif
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, high, low, shm_segment);
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), shm_info);
shm_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, high, low, key == IPC_PRIVATE ? NULL : shm_segment);
info_handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(shm->descriptor), key == IPC_PRIVATE ? NULL : shm_info);
created = TRUE;
}
if (!shm_handle || !info_handle) {
+11
View File
@@ -112,6 +112,12 @@ BCMath:
. bcmul() and bcpow() now return numbers with the requested scale. Formerly,
the returned numbers may have omitted trailing decimal zeroes.
DOM:
. As of PHP 7.3.16, the value of the $childNodes property of DOMDocument,
DOMNode, DOMProcessingInstruction, DOMComment, DOMText, DOMCdataSection and
DOMNotation is now an empty DOMNodeList instead of NULL, according to the
W3C and WHATWG standards and the PHP manual.
IMAP:
rsh/ssh logins are disabled by default. Use imap.enable_insecure_rsh if you want
to enable them. Note that the IMAP library does not filter mailbox names before
@@ -145,6 +151,11 @@ Reflection:
. Reflection export to string now uses `int` and `bool` instead of `integer`
and `boolean`.
- SAPI:
. Starting with 7.3.23, incoming cookie names are not url-decoded. This was never
required by the standard, outgoing cookie names aren't encoded and this leads
to security issues (CVE-2020-7070).
SPL:
. If an SPL autoloader throws an exception, following autoloaders will not be
executed. Previously all autoloaders were executed and exceptions were
+5 -4
View File
@@ -116,16 +116,16 @@ int main()
double d = (double) LONG_MIN * LONG_MIN + 2e9;
if ((long) d == 2e9 && (long) -d == -2e9) {
exit(0);
return 0;
}
} else if (sizeof(long) == 8) {
double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */
if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */
exit(0);
return 0;
}
}
exit(1);
return 1;
}
]])], [
AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits])
@@ -249,7 +249,7 @@ int main()
fprintf(fp, "%d %d\n", ZEND_MM_ALIGNMENT, zeros);
fclose(fp);
exit(0);
return 0;
}
]])], [
LIBZEND_MM_ALIGN=`cat conftest.zend | cut -d ' ' -f 1`
@@ -318,6 +318,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <sys/mman.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#ifndef MAP_ANON
# ifdef MAP_ANONYMOUS
# define MAP_ANON MAP_ANONYMOUS
+4 -1
View File
@@ -63,7 +63,10 @@ dnl Check for broken sprintf()
dnl
AC_DEFUN([AC_ZEND_BROKEN_SPRINTF],[
AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }]])],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
int main() {char buf[20]; return sprintf(buf,"testing 123")!=11; }
]])],[
ac_cv_broken_sprintf=no
],[
ac_cv_broken_sprintf=yes
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Array addition should not add INDIRECT elements
--FILE--
<?php
$x = 1;
$ary = ['y' => 1];
$ary += $GLOBALS;
var_dump($ary['x']);
$x = 2;
var_dump($ary['x']);
?>
--EXPECT--
int(1)
int(1)
+10
View File
@@ -0,0 +1,10 @@
--TEST--
Add $GLOBALS to itself
--FILE--
<?php
$GLOBALS += $GLOBALS;
$x = $GLOBALS + $GLOBALS;
?>
===DONE===
--EXPECT--
===DONE===
@@ -0,0 +1,13 @@
--TEST--
Assign concat of array and empty string
--FILE--
<?php
$a = [0];
$a .= '';
var_dump($a);
?>
--EXPECTF--
Notice: Array to string conversion in %s on line %d
string(5) "Array"
+1 -1
View File
@@ -26,7 +26,7 @@ namespace N2 {
echo $a->hello(), PHP_EOL;
echo $a->foo(), PHP_EOL;
try {
} catch(namespace \Foo $e)
} catch(namespace\Foo $e)
{
}
}
+29
View File
@@ -0,0 +1,29 @@
--TEST--
Bug #63206 Fully support error_handler stacking, even inside the error_handler
--FILE--
<?php
set_error_handler(function() {
echo 'First handler' . PHP_EOL;
});
set_error_handler(function() {
echo 'Second handler' . PHP_EOL;
set_error_handler(function() {
echo 'Internal handler' . PHP_EOL;
});
$triggerInternalNotice++; // warnings while handling the error should go into internal handler
restore_error_handler();
});
$triggerNotice1++;
$triggerNotice2++;
?>
--EXPECTF--
Second handler
Internal handler
Second handler
Internal handler
+26
View File
@@ -0,0 +1,26 @@
--TEST--
Bug #63206 Fully support error_handler stacking, even with null
--FILE--
<?php
set_error_handler(function() {
echo 'First handler' . PHP_EOL;
});
set_error_handler(function() {
echo 'Second handler' . PHP_EOL;
});
set_error_handler(null);
set_error_handler(function() {
echo 'Fourth handler' . PHP_EOL;
});
restore_error_handler();
restore_error_handler();
$triggerNotice++;
?>
--EXPECTF--
Second handler
+26
View File
@@ -0,0 +1,26 @@
--TEST--
Bug #63206 Fully support exception_handler stacking, even with null
--FILE--
<?php
set_exception_handler(function() {
echo 'First handler' . PHP_EOL;
});
set_exception_handler(function() {
echo 'Second handler' . PHP_EOL;
});
set_exception_handler(null);
set_exception_handler(function() {
echo 'Fourth handler' . PHP_EOL;
});
restore_exception_handler();
restore_exception_handler();
throw new Exception();
?>
--EXPECTF--
Second handler
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #79364 (When copy empty array, next key is unspecified)
--FILE--
<?php
$a = [1, 2];
unset($a[1], $a[0]);
$b = $a;
$a[] = 3;
$b[] = 4;
var_dump($a, $b);
?>
--EXPECT--
array(1) {
[2]=>
int(3)
}
array(1) {
[2]=>
int(4)
}
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #79477: casting object into array creates references
--FILE--
<?php
class Test {
public $prop = 'default value';
}
$obj = new Test;
$obj->{1} = null;
$arr = (array) $obj;
$arr['prop'] = 'new value';
echo $obj->prop, "\n";
?>
--EXPECT--
default value
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #79668 (get_defined_functions(true) may miss functions)
--INI--
disable_functions=sha1_file,password_hash
--FILE--
<?php
$df = get_defined_functions(true);
foreach (['sha1', 'sha1_file', 'hash', 'password_hash'] as $funcname) {
var_dump(in_array($funcname, $df['internal'], true));
}
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)
+26
View File
@@ -0,0 +1,26 @@
--TEST--
Bug #79778: Assertion failure if dumping closure with unresolved static variable
--FILE--
<?php
$closure1 = function() {
static $var = CONST_REF;
};
var_dump($closure1);
print_r($closure1);
?>
--EXPECT--
object(Closure)#1 (1) {
["static"]=>
array(1) {
["var"]=>
string(14) "<constant ast>"
}
}
Closure Object
(
[static] => Array
(
[var] => <constant ast>
)
)
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #79792: HT iterators not removed if empty array is destroyed
--FILE--
<?php
$a = [42];
foreach ($a as &$c) {
// Make the array empty.
unset($a[0]);
// Destroy the array.
$a = null;
}
?>
===DONE===
--EXPECTF--
Warning: Invalid argument supplied for foreach() in %s on line %d
===DONE===
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #79919 (Stack use-after-scope in define())
--SKIPIF--
<?php
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
?>
--FILE--
<?php
$b = error_log(0);
$b = simplexml_load_string('<xml/>', null, $b);
define(0, $b);
?>
--EXPECT--
0
+29
View File
@@ -0,0 +1,29 @@
--TEST--
Bug #79934: CRLF-only line in heredoc causes parsing error
--DESCRIPTION--
This test covers different variations of whitespace-only lines in heredoc strings.
These whitespace-only lines should be ignored when stripping indentation.
--FILE--
<?php
// lines with only CRLF should not cause a parse error
eval("\$s1 = <<<HEREDOC\r\n a\r\n\r\n b\r\n HEREDOC;");
var_dump(addcslashes($s1, "\r\n"));
// lines with only a LF should not cause a parse error
eval("\$s2 = <<<HEREDOC\n a\n\n b\n HEREDOC;");
var_dump(addcslashes($s2, "\n"));
// lines with only a CR should not cause a parse error
eval("\$s3 = <<<HEREDOC\r a\r\r b\r HEREDOC;");
var_dump(addcslashes($s3, "\r"));
// lines with only whitespace should not cause a parse error
eval("\$s4 = <<<HEREDOC\r a\r\n \r\n b\r HEREDOC;");
var_dump(addcslashes($s4, "\n\r"));
?>
--EXPECT--
string(10) "a\r\n\r\nb"
string(6) "a\n\nb"
string(6) "a\r\rb"
string(10) "a\r\n\r\nb"
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #80049: Memleak when coercing integers to string via variadic argument
--FILE--
<?php
function coerceToString(string ...$strings) {
var_dump($strings);
}
coerceToString(...[123]);
?>
--EXPECT--
array(1) {
[0]=>
string(3) "123"
}
@@ -9,6 +9,7 @@ namespace {
var_dump(FOO); // Ok
var_dump(foo); // Deprecated
var_dump(\foo); // Deprecated
var_dump(NS\FOO); // Ok
var_dump(ns\FOO); // Ok
@@ -72,10 +73,13 @@ int(42)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 8
int(42)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 9
int(42)
int(24)
int(24)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 12
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 13
int(24)
bool(true)
bool(true)
@@ -84,24 +88,24 @@ bool(true)
bool(true)
int(42)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 21
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 22
int(42)
int(24)
int(24)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 24
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 25
int(24)
int(24)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 29
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 30
int(24)
int(24)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 34
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 35
int(24)
int(42)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 39
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 40
int(42)
bool(true)
bool(true)
@@ -110,18 +114,18 @@ bool(true)
bool(true)
int(42)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 48
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 49
int(42)
int(24)
int(24)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 51
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 52
int(24)
int(42)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 55
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 56
int(42)
int(43)
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 59
Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 60
int(43)
@@ -0,0 +1,20 @@
--TEST--
Leak when setting recursive previous exception in finally handling
--FILE--
<?php
try {
try {
throw new Exception("Test");
} catch (Exception $e) {
throw $e;
} finally {
throw $e;
}
} catch (Exception $e2) {
echo $e2->getMessage(), "\n";
}
?>
--EXPECT--
Test
@@ -0,0 +1,18 @@
--TEST--
Yield from non-iterable
--FILE--
<?php
function gen() {
yield from new stdClass;
}
try {
gen()->current();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Can use "yield from" only with arrays and Traversables
@@ -0,0 +1,30 @@
--TEST--
Exception from valid() during yield from
--FILE--
<?php
class FooBar implements Iterator {
function rewind() {}
function current() {}
function key() {}
function next() {}
function valid() {
throw new Exception("Exception from valid()");
}
}
function gen() {
try {
// the fact that the yield from result is used is relevant.
var_dump(yield from new FooBar);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
}
$x = gen();
$x->current();
?>
--EXPECT--
Exception from valid()
@@ -0,0 +1,16 @@
--TEST--
String offset error during list() by-ref assignment
--FILE--
<?php
$a = [0];
$v = 'b';
$i = 0;
list(&$a[$i++]) = $v;
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
@@ -6,6 +6,7 @@ No warnings should be thrown during heredoc scan-ahead
<<<TEST
${x}
\400
${"\400"}
${/*}
TEST;
@@ -15,6 +16,8 @@ Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
Warning: Unterminated comment starting line %d in %s on line %d
Parse error: syntax error, unexpected end of file in %s on line %d
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
#define ZEND_VERSION "3.3.15"
#define ZEND_VERSION "3.3.29-dev"
#define ZEND_ENGINE_3
+4 -41
View File
@@ -4230,7 +4230,7 @@ ZEND_API void zend_save_error_handling(zend_error_handling *current) /* {{{ */
{
current->handling = EG(error_handling);
current->exception = EG(exception_class);
ZVAL_COPY(&current->user_handler, &EG(user_error_handler));
ZVAL_UNDEF(&current->user_handler);
}
/* }}} */
@@ -4238,54 +4238,17 @@ ZEND_API void zend_replace_error_handling(zend_error_handling_t error_handling,
{
if (current) {
zend_save_error_handling(current);
if (error_handling != EH_NORMAL && Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_error_handler));
ZVAL_UNDEF(&EG(user_error_handler));
}
}
ZEND_ASSERT(error_handling == EH_THROW || exception_class == NULL);
EG(error_handling) = error_handling;
EG(exception_class) = error_handling == EH_THROW ? exception_class : NULL;
}
/* }}} */
static int same_zval(zval *zv1, zval *zv2) /* {{{ */
{
if (Z_TYPE_P(zv1) != Z_TYPE_P(zv2)) {
return 0;
}
switch (Z_TYPE_P(zv1)) {
case IS_UNDEF:
case IS_NULL:
case IS_FALSE:
case IS_TRUE:
return 1;
case IS_LONG:
return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
case IS_DOUBLE:
return Z_LVAL_P(zv1) == Z_LVAL_P(zv2);
case IS_STRING:
case IS_ARRAY:
case IS_OBJECT:
case IS_RESOURCE:
return Z_COUNTED_P(zv1) == Z_COUNTED_P(zv2);
default:
return 0;
}
EG(exception_class) = exception_class;
}
/* }}} */
ZEND_API void zend_restore_error_handling(zend_error_handling *saved) /* {{{ */
{
EG(error_handling) = saved->handling;
EG(exception_class) = saved->handling == EH_THROW ? saved->exception : NULL;
if (Z_TYPE(saved->user_handler) != IS_UNDEF
&& !same_zval(&saved->user_handler, &EG(user_error_handler))) {
zval_ptr_dtor(&EG(user_error_handler));
ZVAL_COPY_VALUE(&EG(user_error_handler), &saved->user_handler);
} else if (Z_TYPE(saved->user_handler)) {
zval_ptr_dtor(&saved->user_handler);
}
ZVAL_UNDEF(&saved->user_handler);
EG(exception_class) = saved->exception;
}
/* }}} */
+1
View File
@@ -2103,6 +2103,7 @@ static zend_long zend_mm_find_leaks(zend_mm_heap *heap, zend_mm_chunk *p, uint32
}
}
p = p->next;
i = ZEND_MM_FIRST_PAGE;
} while (p != heap->main_chunk);
return count;
}
+9 -18
View File
@@ -882,9 +882,7 @@ repeat:
case IS_OBJECT:
if (Z_TYPE(val_free) == IS_UNDEF) {
if (Z_OBJ_HT_P(val)->get) {
zval rv;
val = Z_OBJ_HT_P(val)->get(val, &rv);
ZVAL_COPY_VALUE(&val_free, val);
val = Z_OBJ_HT_P(val)->get(val, &val_free);
goto repeat;
} else if (Z_OBJ_HT_P(val)->cast_object) {
if (Z_OBJ_HT_P(val)->cast_object(val, &val_free, IS_STRING) == SUCCESS) {
@@ -1665,11 +1663,11 @@ ZEND_FUNCTION(set_error_handler)
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
ZVAL_COPY(return_value, &EG(user_error_handler));
zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting));
zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler));
}
zend_stack_push(&EG(user_error_handlers_error_reporting), &EG(user_error_handler_error_reporting));
zend_stack_push(&EG(user_error_handlers), &EG(user_error_handler));
if (Z_TYPE_P(error_handler) == IS_NULL) { /* unset user-defined handler */
ZVAL_UNDEF(&EG(user_error_handler));
return;
@@ -1732,10 +1730,10 @@ ZEND_FUNCTION(set_exception_handler)
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
ZVAL_COPY(return_value, &EG(user_exception_handler));
zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler));
}
zend_stack_push(&EG(user_exception_handlers), &EG(user_exception_handler));
if (Z_TYPE_P(exception_handler) == IS_NULL) { /* unset user-defined handler */
ZVAL_UNDEF(&EG(user_exception_handler));
return;
@@ -1847,16 +1845,9 @@ static int copy_function_name(zval *zv, int num_args, va_list args, zend_hash_ke
return 0;
}
if (func->type == ZEND_INTERNAL_FUNCTION) {
char *disable_functions = INI_STR("disable_functions");
if ((*exclude_disabled == 1) && (disable_functions != NULL)) {
if (strstr(disable_functions, func->common.function_name->val) == NULL) {
add_next_index_str(internal_ar, zend_string_copy(hash_key->key));
}
} else {
add_next_index_str(internal_ar, zend_string_copy(hash_key->key));
}
if (func->type == ZEND_INTERNAL_FUNCTION
&& (!*exclude_disabled || func->internal_function.handler != ZEND_FN(display_disabled_function))) {
add_next_index_str(internal_ar, zend_string_copy(hash_key->key));
} else if (func->type == ZEND_USER_FUNCTION) {
add_next_index_str(user_ar, zend_string_copy(hash_key->key));
}
+11 -1
View File
@@ -506,9 +506,16 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{
debug_info = zend_new_array(8);
if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) {
zval *var;
HashTable *static_variables = closure->func.op_array.static_variables;
ZVAL_ARR(&val, zend_array_dup(static_variables));
zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_STATIC), &val);
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(val), var) {
if (Z_TYPE_P(var) == IS_CONSTANT_AST) {
zval_ptr_dtor(var);
ZVAL_STRING(var, "<constant ast>");
}
} ZEND_HASH_FOREACH_END();
}
if (Z_TYPE(closure->this_ptr) != IS_UNDEF) {
@@ -659,6 +666,7 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
if (func->type == ZEND_USER_FUNCTION) {
memcpy(&closure->func, func, sizeof(zend_op_array));
closure->func.common.fn_flags |= ZEND_ACC_CLOSURE;
closure->func.common.fn_flags &= ~ZEND_ACC_IMMUTABLE;
if (closure->func.op_array.static_variables) {
closure->func.op_array.static_variables =
zend_array_dup(closure->func.op_array.static_variables);
@@ -669,7 +677,9 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent
|| func->common.scope != scope
|| (func->common.fn_flags & ZEND_ACC_NO_RT_ARENA)
) {
if (!func->op_array.run_time_cache && (func->common.fn_flags & ZEND_ACC_CLOSURE)) {
if (!func->op_array.run_time_cache
&& (func->common.fn_flags & ZEND_ACC_CLOSURE)
&& !(func->common.fn_flags & ZEND_ACC_IMMUTABLE)) {
/* If a real closure is used for the first time, we create a shared runtime cache
* and remember which scope it is for. */
func->common.scope = scope;
+7 -1
View File
@@ -76,9 +76,15 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo
zval pv, zv, rv;
zend_class_entry *base_ce;
if (exception == add_previous || !add_previous || !exception) {
if (!exception || !add_previous) {
return;
}
if (exception == add_previous) {
OBJ_RELEASE(add_previous);
return;
}
ZVAL_OBJ(&pv, add_previous);
if (!instanceof_function(Z_OBJCE(pv), zend_ce_throwable)) {
zend_error_noreturn(E_CORE_ERROR, "Previous exception must implement Throwable");
+9 -4
View File
@@ -1329,6 +1329,7 @@ static zend_never_inline ZEND_COLD void zend_wrong_string_offset(EXECUTE_DATA_D)
msg = "Cannot create references to/from string offsets";
break;
}
opline++;
}
break;
EMPTY_SWITCH_DEFAULT_CASE();
@@ -3364,11 +3365,15 @@ static zend_always_inline int _zend_quick_get_constant(
is_deprecated = !zend_string_equals(c->name, Z_STR_P(access_key));
} else {
check_short_name:
ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name));
ZEND_ASSERT(ns_sep);
/* Namespaces are always case-insensitive. Only compare shortname. */
shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1;
shortname_len = ZSTR_LEN(c->name) - shortname_offset;
ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name));
if (ns_sep) {
shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1;
shortname_len = ZSTR_LEN(c->name) - shortname_offset;
} else {
shortname_offset = 0;
shortname_len = ZSTR_LEN(c->name);
}
is_deprecated = memcmp(ZSTR_VAL(c->name) + shortname_offset, Z_STRVAL_P(orig_key - 1) + shortname_offset, shortname_len) != 0;
}
+4 -5
View File
@@ -253,10 +253,6 @@ static void zend_generator_free_storage(zend_object *object) /* {{{ */
}
zend_object_std_dtor(&generator->std);
if (generator->iterator) {
zend_iterator_dtor(generator->iterator);
}
}
/* }}} */
@@ -713,6 +709,9 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
}
if (iter->funcs->valid(iter) == FAILURE) {
if (UNEXPECTED(EG(exception) != NULL)) {
goto exception;
}
/* reached end of iteration */
goto failure;
}
@@ -741,7 +740,7 @@ static int zend_generator_get_next_delegated_value(zend_generator *generator) /*
return SUCCESS;
exception:
zend_rethrow_exception(generator->execute_data);
zend_generator_throw_exception(generator, NULL);
failure:
zval_ptr_dtor(&generator->values);
+21 -17
View File
@@ -1504,11 +1504,11 @@ ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
}
} while (++p != end);
}
zend_hash_iterators_remove(ht);
SET_INCONSISTENT(HT_DESTROYED);
} else if (EXPECTED(!(HT_FLAGS(ht) & HASH_FLAG_INITIALIZED))) {
goto free_ht;
}
zend_hash_iterators_remove(ht);
SET_INCONSISTENT(HT_DESTROYED);
efree(HT_GET_DATA_ADDR(ht));
free_ht:
FREE_HASHTABLE(ht);
@@ -1934,7 +1934,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
target->nTableMask = HT_MIN_MASK;
target->nNumUsed = 0;
target->nNumOfElements = 0;
target->nNextFreeElement = 0;
target->nNextFreeElement = source->nNextFreeElement;
target->nInternalPointer = 0;
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
} else if (GC_FLAGS(source) & IS_ARRAY_IMMUTABLE) {
@@ -1999,7 +1999,7 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
{
uint32_t idx;
Bucket *p;
zval *t;
zval *t, *s;
IS_CONSISTENT(source);
IS_CONSISTENT(target);
@@ -2008,18 +2008,20 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
if (overwrite) {
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
continue;
s = &p->val;
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
s = Z_INDIRECT_P(s);
}
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
continue;
}
if (p->key) {
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_UPDATE | HASH_UPDATE_INDIRECT);
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_UPDATE | HASH_UPDATE_INDIRECT);
if (pCopyConstructor) {
pCopyConstructor(t);
}
} else {
t = zend_hash_index_update(target, p->h, &p->val);
t = zend_hash_index_update(target, p->h, s);
if (pCopyConstructor) {
pCopyConstructor(t);
}
@@ -2028,18 +2030,20 @@ ZEND_API void ZEND_FASTCALL zend_hash_merge(HashTable *target, HashTable *source
} else {
for (idx = 0; idx < source->nNumUsed; idx++) {
p = source->arData + idx;
if (UNEXPECTED(Z_TYPE(p->val) == IS_UNDEF)) continue;
if (UNEXPECTED(Z_TYPE(p->val) == IS_INDIRECT) &&
UNEXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) == IS_UNDEF)) {
continue;
s = &p->val;
if (UNEXPECTED(Z_TYPE_P(s) == IS_INDIRECT)) {
s = Z_INDIRECT_P(s);
}
if (UNEXPECTED(Z_TYPE_P(s) == IS_UNDEF)) {
continue;
}
if (p->key) {
t = _zend_hash_add_or_update_i(target, p->key, &p->val, HASH_ADD | HASH_UPDATE_INDIRECT);
t = _zend_hash_add_or_update_i(target, p->key, s, HASH_ADD | HASH_UPDATE_INDIRECT);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
} else {
t = zend_hash_index_add(target, p->h, &p->val);
t = zend_hash_index_add(target, p->h, s);
if (t && pCopyConstructor) {
pCopyConstructor(t);
}
@@ -2722,7 +2726,7 @@ convert:
{
HashTable *new_ht = zend_new_array(zend_hash_num_elements(ht));
ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, str_key, zv) {
ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, str_key, zv) {
do {
if (Z_OPT_REFCOUNTED_P(zv)) {
if (Z_ISREF_P(zv) && Z_REFCOUNT_P(zv) == 1) {
+1 -1
View File
@@ -334,7 +334,7 @@ ZEND_API int zend_alter_ini_entry_ex(zend_string *name, zend_string *new_value,
{
zend_ini_entry *ini_entry;
zend_string *duplicate;
zend_bool modifiable;
uint8_t modifiable;
zend_bool modified;
if ((ini_entry = zend_hash_find_ptr(EG(ini_directives), name)) == NULL) {
+124 -121
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 1.0.1 */
/* Generated by re2c 1.3 */
#line 1 "Zend/zend_language_scanner.l"
/*
+----------------------------------------------------------------------+
@@ -1069,8 +1069,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot
octal_buf[2] = *(++s);
}
}
if (octal_buf[2] &&
(octal_buf[0] > '3')) {
if (octal_buf[2] && (octal_buf[0] > '3') && !SCNG(heredoc_scan_ahead)) {
/* 3 octit values must not overflow 0xFF (\377) */
zend_error(E_COMPILE_WARNING, "Octal escape sequence overflow \\%s is greater than \\377", octal_buf);
}
@@ -1115,6 +1114,7 @@ static const char *next_newline(const char *str, const char *end, size_t *newlin
for (; str < end; str++) {
if (*str == '\r') {
*newline_len = str + 1 < end && *(str + 1) == '\n' ? 2 : 1;
return str;
} else if (*str == '\n') {
*newline_len = 1;
return str;
@@ -1454,7 +1454,7 @@ yy3:
++YYCURSOR;
YYDEBUG(4, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2765 "Zend/zend_language_scanner.l"
#line 2768 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
RETURN_TOKEN(END);
@@ -2269,7 +2269,7 @@ yy62:
++YYCURSOR;
YYDEBUG(63, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2412 "Zend/zend_language_scanner.l"
#line 2415 "Zend/zend_language_scanner.l"
{
BEGIN(ST_BACKQUOTE);
RETURN_TOKEN('`');
@@ -4730,6 +4730,7 @@ yy397:
if (is_heredoc && !SCNG(heredoc_scan_ahead)) {
zend_lex_state current_state;
zend_string *saved_doc_comment = CG(doc_comment);
int heredoc_nesting_level = 1;
int first_token = 0;
int error = 0;
@@ -4740,6 +4741,7 @@ yy397:
SCNG(heredoc_indentation) = 0;
SCNG(heredoc_indentation_uses_spaces) = 0;
LANG_SCNG(on_event) = NULL;
CG(doc_comment) = NULL;
zend_ptr_stack_reverse_apply(&current_state.heredoc_label_stack, copy_heredoc_label_stack);
@@ -4789,6 +4791,7 @@ yy397:
zend_restore_lexical_state(&current_state);
SCNG(heredoc_scan_ahead) = 0;
CG(increment_lineno) = 0;
CG(doc_comment) = saved_doc_comment;
if (PARSER_MODE() && error) {
RETURN_TOKEN(T_ERROR);
@@ -4797,7 +4800,7 @@ yy397:
RETURN_TOKEN(T_START_HEREDOC);
}
#line 4801 "Zend/zend_language_scanner.c"
#line 4804 "Zend/zend_language_scanner.c"
yy398:
YYDEBUG(398, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4821,7 +4824,7 @@ yy400:
{
RETURN_TOKEN(T_ARRAY);
}
#line 4825 "Zend/zend_language_scanner.c"
#line 4828 "Zend/zend_language_scanner.c"
yy402:
YYDEBUG(402, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4834,7 +4837,7 @@ yy402:
{
RETURN_TOKEN(T_BREAK);
}
#line 4838 "Zend/zend_language_scanner.c"
#line 4841 "Zend/zend_language_scanner.c"
yy404:
YYDEBUG(404, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4853,7 +4856,7 @@ yy405:
{
RETURN_TOKEN(T_CATCH);
}
#line 4857 "Zend/zend_language_scanner.c"
#line 4860 "Zend/zend_language_scanner.c"
yy407:
YYDEBUG(407, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4866,7 +4869,7 @@ yy407:
{
RETURN_TOKEN(T_CLASS);
}
#line 4870 "Zend/zend_language_scanner.c"
#line 4873 "Zend/zend_language_scanner.c"
yy409:
YYDEBUG(409, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4879,7 +4882,7 @@ yy409:
{
RETURN_TOKEN(T_CLONE);
}
#line 4883 "Zend/zend_language_scanner.c"
#line 4886 "Zend/zend_language_scanner.c"
yy411:
YYDEBUG(411, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4892,7 +4895,7 @@ yy411:
{
RETURN_TOKEN(T_CONST);
}
#line 4896 "Zend/zend_language_scanner.c"
#line 4899 "Zend/zend_language_scanner.c"
yy413:
YYDEBUG(413, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4929,7 +4932,7 @@ yy417:
{
RETURN_TOKEN(T_EMPTY);
}
#line 4933 "Zend/zend_language_scanner.c"
#line 4936 "Zend/zend_language_scanner.c"
yy419:
YYDEBUG(419, *YYCURSOR);
yych = *++YYCURSOR;
@@ -4954,7 +4957,7 @@ yy421:
{
RETURN_TOKEN(T_ENDIF);
}
#line 4958 "Zend/zend_language_scanner.c"
#line 4961 "Zend/zend_language_scanner.c"
yy423:
YYDEBUG(423, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5000,7 +5003,7 @@ yy427:
{
RETURN_TOKEN(T_FINAL);
}
#line 5004 "Zend/zend_language_scanner.c"
#line 5007 "Zend/zend_language_scanner.c"
yy428:
YYDEBUG(428, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5061,7 +5064,7 @@ yy436:
{
RETURN_TOKEN(T_ISSET);
}
#line 5065 "Zend/zend_language_scanner.c"
#line 5068 "Zend/zend_language_scanner.c"
yy438:
YYDEBUG(438, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5080,7 +5083,7 @@ yy439:
{
RETURN_TOKEN(T_PRINT);
}
#line 5084 "Zend/zend_language_scanner.c"
#line 5087 "Zend/zend_language_scanner.c"
yy441:
YYDEBUG(441, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5135,7 +5138,7 @@ yy448:
{
RETURN_TOKEN(T_THROW);
}
#line 5139 "Zend/zend_language_scanner.c"
#line 5142 "Zend/zend_language_scanner.c"
yy450:
YYDEBUG(450, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5148,7 +5151,7 @@ yy450:
{
RETURN_TOKEN(T_TRAIT);
}
#line 5152 "Zend/zend_language_scanner.c"
#line 5155 "Zend/zend_language_scanner.c"
yy452:
YYDEBUG(452, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5161,7 +5164,7 @@ yy452:
{
RETURN_TOKEN(T_UNSET);
}
#line 5165 "Zend/zend_language_scanner.c"
#line 5168 "Zend/zend_language_scanner.c"
yy454:
YYDEBUG(454, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5174,7 +5177,7 @@ yy454:
{
RETURN_TOKEN(T_WHILE);
}
#line 5178 "Zend/zend_language_scanner.c"
#line 5181 "Zend/zend_language_scanner.c"
yy456:
YYDEBUG(456, *YYCURSOR);
yyaccept = 6;
@@ -5196,7 +5199,7 @@ yy457:
{
RETURN_TOKEN(T_YIELD);
}
#line 5200 "Zend/zend_language_scanner.c"
#line 5203 "Zend/zend_language_scanner.c"
yy458:
YYDEBUG(458, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5292,7 +5295,7 @@ yy471:
{
RETURN_TOKEN(T_BOOL_CAST);
}
#line 5296 "Zend/zend_language_scanner.c"
#line 5299 "Zend/zend_language_scanner.c"
yy474:
YYDEBUG(474, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5326,7 +5329,7 @@ yy478:
{
RETURN_TOKEN(T_DOUBLE_CAST);
}
#line 5330 "Zend/zend_language_scanner.c"
#line 5333 "Zend/zend_language_scanner.c"
yy480:
YYDEBUG(480, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5395,7 +5398,7 @@ yy489:
{
RETURN_TOKEN(T_ELSEIF);
}
#line 5399 "Zend/zend_language_scanner.c"
#line 5402 "Zend/zend_language_scanner.c"
yy491:
YYDEBUG(491, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5429,7 +5432,7 @@ yy493:
{
RETURN_TOKEN(T_ENDFOR);
}
#line 5433 "Zend/zend_language_scanner.c"
#line 5436 "Zend/zend_language_scanner.c"
yy494:
YYDEBUG(494, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5478,7 +5481,7 @@ yy500:
{
RETURN_TOKEN(T_GLOBAL);
}
#line 5482 "Zend/zend_language_scanner.c"
#line 5485 "Zend/zend_language_scanner.c"
yy502:
YYDEBUG(502, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5539,7 +5542,7 @@ yy510:
{
RETURN_TOKEN(T_PUBLIC);
}
#line 5543 "Zend/zend_language_scanner.c"
#line 5546 "Zend/zend_language_scanner.c"
yy512:
YYDEBUG(512, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5558,7 +5561,7 @@ yy513:
{
RETURN_TOKEN(T_RETURN);
}
#line 5562 "Zend/zend_language_scanner.c"
#line 5565 "Zend/zend_language_scanner.c"
yy515:
YYDEBUG(515, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5571,7 +5574,7 @@ yy515:
{
RETURN_TOKEN(T_STATIC);
}
#line 5575 "Zend/zend_language_scanner.c"
#line 5578 "Zend/zend_language_scanner.c"
yy517:
YYDEBUG(517, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5584,7 +5587,7 @@ yy517:
{
RETURN_TOKEN(T_SWITCH);
}
#line 5588 "Zend/zend_language_scanner.c"
#line 5591 "Zend/zend_language_scanner.c"
yy519:
YYDEBUG(519, *YYCURSOR);
++YYCURSOR;
@@ -5668,7 +5671,7 @@ yy530:
{
RETURN_TOKEN(T_ARRAY_CAST);
}
#line 5672 "Zend/zend_language_scanner.c"
#line 5675 "Zend/zend_language_scanner.c"
yy532:
YYDEBUG(532, *YYCURSOR);
++YYCURSOR;
@@ -5718,7 +5721,7 @@ yy538:
{
RETURN_TOKEN(T_UNSET_CAST);
}
#line 5722 "Zend/zend_language_scanner.c"
#line 5725 "Zend/zend_language_scanner.c"
yy540:
YYDEBUG(540, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5749,7 +5752,7 @@ yy543:
{
RETURN_TOKEN(T_DECLARE);
}
#line 5753 "Zend/zend_language_scanner.c"
#line 5756 "Zend/zend_language_scanner.c"
yy545:
YYDEBUG(545, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5762,7 +5765,7 @@ yy545:
{
RETURN_TOKEN(T_DEFAULT);
}
#line 5766 "Zend/zend_language_scanner.c"
#line 5769 "Zend/zend_language_scanner.c"
yy547:
YYDEBUG(547, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5799,7 +5802,7 @@ yy551:
{
RETURN_TOKEN(T_EXTENDS);
}
#line 5803 "Zend/zend_language_scanner.c"
#line 5806 "Zend/zend_language_scanner.c"
yy553:
YYDEBUG(553, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5812,7 +5815,7 @@ yy553:
{
RETURN_TOKEN(T_FINALLY);
}
#line 5816 "Zend/zend_language_scanner.c"
#line 5819 "Zend/zend_language_scanner.c"
yy555:
YYDEBUG(555, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5825,7 +5828,7 @@ yy555:
{
RETURN_TOKEN(T_FOREACH);
}
#line 5829 "Zend/zend_language_scanner.c"
#line 5832 "Zend/zend_language_scanner.c"
yy557:
YYDEBUG(557, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5863,7 +5866,7 @@ yy560:
{
RETURN_TOKEN(T_INCLUDE);
}
#line 5867 "Zend/zend_language_scanner.c"
#line 5870 "Zend/zend_language_scanner.c"
yy561:
YYDEBUG(561, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5900,7 +5903,7 @@ yy565:
{
RETURN_TOKEN(T_PRIVATE);
}
#line 5904 "Zend/zend_language_scanner.c"
#line 5907 "Zend/zend_language_scanner.c"
yy567:
YYDEBUG(567, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5932,7 +5935,7 @@ yy569:
{
RETURN_TOKEN(T_REQUIRE);
}
#line 5936 "Zend/zend_language_scanner.c"
#line 5939 "Zend/zend_language_scanner.c"
yy570:
YYDEBUG(570, *YYCURSOR);
yych = *++YYCURSOR;
@@ -5956,7 +5959,7 @@ yy572:
{
RETURN_TOKEN(T_DIR);
}
#line 5960 "Zend/zend_language_scanner.c"
#line 5963 "Zend/zend_language_scanner.c"
yy574:
YYDEBUG(574, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6005,7 +6008,7 @@ yy581:
{
RETURN_TOKEN(T_STRING_CAST);
}
#line 6009 "Zend/zend_language_scanner.c"
#line 6012 "Zend/zend_language_scanner.c"
yy583:
YYDEBUG(583, *YYCURSOR);
++YYCURSOR;
@@ -6015,7 +6018,7 @@ yy583:
{
RETURN_TOKEN(T_OBJECT_CAST);
}
#line 6019 "Zend/zend_language_scanner.c"
#line 6022 "Zend/zend_language_scanner.c"
yy585:
YYDEBUG(585, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6028,7 +6031,7 @@ yy585:
{
RETURN_TOKEN(T_ABSTRACT);
}
#line 6032 "Zend/zend_language_scanner.c"
#line 6035 "Zend/zend_language_scanner.c"
yy587:
YYDEBUG(587, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6041,7 +6044,7 @@ yy587:
{
RETURN_TOKEN(T_CALLABLE);
}
#line 6045 "Zend/zend_language_scanner.c"
#line 6048 "Zend/zend_language_scanner.c"
yy589:
YYDEBUG(589, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6054,7 +6057,7 @@ yy589:
{
RETURN_TOKEN(T_CONTINUE);
}
#line 6058 "Zend/zend_language_scanner.c"
#line 6061 "Zend/zend_language_scanner.c"
yy591:
YYDEBUG(591, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6085,7 +6088,7 @@ yy594:
{
RETURN_TOKEN(T_ENDWHILE);
}
#line 6089 "Zend/zend_language_scanner.c"
#line 6092 "Zend/zend_language_scanner.c"
yy596:
YYDEBUG(596, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6098,7 +6101,7 @@ yy596:
{
RETURN_TOKEN(T_FUNCTION);
}
#line 6102 "Zend/zend_language_scanner.c"
#line 6105 "Zend/zend_language_scanner.c"
yy598:
YYDEBUG(598, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6170,7 +6173,7 @@ yy608:
{
RETURN_TOKEN(T_FILE);
}
#line 6174 "Zend/zend_language_scanner.c"
#line 6177 "Zend/zend_language_scanner.c"
yy610:
YYDEBUG(610, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6195,7 +6198,7 @@ yy612:
{
RETURN_TOKEN(T_LINE);
}
#line 6199 "Zend/zend_language_scanner.c"
#line 6202 "Zend/zend_language_scanner.c"
yy614:
YYDEBUG(614, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6236,7 +6239,7 @@ yy619:
{
RETURN_TOKEN(T_ENDSWITCH);
}
#line 6240 "Zend/zend_language_scanner.c"
#line 6243 "Zend/zend_language_scanner.c"
yy621:
YYDEBUG(621, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6267,7 +6270,7 @@ yy624:
{
RETURN_TOKEN(T_INSTEADOF);
}
#line 6271 "Zend/zend_language_scanner.c"
#line 6274 "Zend/zend_language_scanner.c"
yy626:
YYDEBUG(626, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6280,7 +6283,7 @@ yy626:
{
RETURN_TOKEN(T_INTERFACE);
}
#line 6284 "Zend/zend_language_scanner.c"
#line 6287 "Zend/zend_language_scanner.c"
yy628:
YYDEBUG(628, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6293,7 +6296,7 @@ yy628:
{
RETURN_TOKEN(T_NAMESPACE);
}
#line 6297 "Zend/zend_language_scanner.c"
#line 6300 "Zend/zend_language_scanner.c"
yy630:
YYDEBUG(630, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6306,7 +6309,7 @@ yy630:
{
RETURN_TOKEN(T_PROTECTED);
}
#line 6310 "Zend/zend_language_scanner.c"
#line 6313 "Zend/zend_language_scanner.c"
yy632:
YYDEBUG(632, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6331,7 +6334,7 @@ yy634:
{
RETURN_TOKEN(T_CLASS_C);
}
#line 6335 "Zend/zend_language_scanner.c"
#line 6338 "Zend/zend_language_scanner.c"
yy636:
YYDEBUG(636, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6367,7 +6370,7 @@ yy640:
{
RETURN_TOKEN(T_TRAIT_C);
}
#line 6371 "Zend/zend_language_scanner.c"
#line 6374 "Zend/zend_language_scanner.c"
yy642:
YYDEBUG(642, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6380,7 +6383,7 @@ yy642:
{
RETURN_TOKEN(T_ENDDECLARE);
}
#line 6384 "Zend/zend_language_scanner.c"
#line 6387 "Zend/zend_language_scanner.c"
yy644:
YYDEBUG(644, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6393,7 +6396,7 @@ yy644:
{
RETURN_TOKEN(T_ENDFOREACH);
}
#line 6397 "Zend/zend_language_scanner.c"
#line 6400 "Zend/zend_language_scanner.c"
yy646:
YYDEBUG(646, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6406,7 +6409,7 @@ yy646:
{
RETURN_TOKEN(T_IMPLEMENTS);
}
#line 6410 "Zend/zend_language_scanner.c"
#line 6413 "Zend/zend_language_scanner.c"
yy648:
YYDEBUG(648, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6425,7 +6428,7 @@ yy649:
{
RETURN_TOKEN(T_INSTANCEOF);
}
#line 6429 "Zend/zend_language_scanner.c"
#line 6432 "Zend/zend_language_scanner.c"
yy651:
YYDEBUG(651, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6477,7 +6480,7 @@ yy655:
{
RETURN_TOKEN(T_METHOD_C);
}
#line 6481 "Zend/zend_language_scanner.c"
#line 6484 "Zend/zend_language_scanner.c"
yy657:
YYDEBUG(657, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6507,7 +6510,7 @@ yy660:
HANDLE_NEWLINES(yytext, yyleng);
RETURN_TOKEN(T_YIELD_FROM);
}
#line 6511 "Zend/zend_language_scanner.c"
#line 6514 "Zend/zend_language_scanner.c"
yy662:
YYDEBUG(662, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6536,7 +6539,7 @@ yy665:
{
RETURN_TOKEN(T_INCLUDE_ONCE);
}
#line 6540 "Zend/zend_language_scanner.c"
#line 6543 "Zend/zend_language_scanner.c"
yy667:
YYDEBUG(667, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6549,7 +6552,7 @@ yy667:
{
RETURN_TOKEN(T_REQUIRE_ONCE);
}
#line 6553 "Zend/zend_language_scanner.c"
#line 6556 "Zend/zend_language_scanner.c"
yy669:
YYDEBUG(669, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6562,7 +6565,7 @@ yy669:
{
RETURN_TOKEN(T_FUNC_C);
}
#line 6566 "Zend/zend_language_scanner.c"
#line 6569 "Zend/zend_language_scanner.c"
yy671:
YYDEBUG(671, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6592,7 +6595,7 @@ yy674:
{
RETURN_TOKEN(T_NS_C);
}
#line 6596 "Zend/zend_language_scanner.c"
#line 6599 "Zend/zend_language_scanner.c"
yy676:
YYDEBUG(676, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6610,7 +6613,7 @@ yy677:
{
RETURN_TOKEN(T_HALT_COMPILER);
}
#line 6614 "Zend/zend_language_scanner.c"
#line 6617 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_LOOKING_FOR_PROPERTY:
@@ -6682,7 +6685,7 @@ yy682:
yy_pop_state();
goto restart;
}
#line 6686 "Zend/zend_language_scanner.c"
#line 6689 "Zend/zend_language_scanner.c"
yy683:
YYDEBUG(683, *YYCURSOR);
++YYCURSOR;
@@ -6698,7 +6701,7 @@ yy683:
{
goto return_whitespace;
}
#line 6702 "Zend/zend_language_scanner.c"
#line 6705 "Zend/zend_language_scanner.c"
yy686:
YYDEBUG(686, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6720,7 +6723,7 @@ yy687:
yy_pop_state();
RETURN_TOKEN_WITH_STR(T_STRING, 0);
}
#line 6724 "Zend/zend_language_scanner.c"
#line 6727 "Zend/zend_language_scanner.c"
yy690:
YYDEBUG(690, *YYCURSOR);
++YYCURSOR;
@@ -6730,7 +6733,7 @@ yy690:
{
RETURN_TOKEN(T_OBJECT_OPERATOR);
}
#line 6734 "Zend/zend_language_scanner.c"
#line 6737 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_BACKQUOTE:
@@ -6783,7 +6786,7 @@ yyc_ST_BACKQUOTE:
yy695:
YYDEBUG(695, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2504 "Zend/zend_language_scanner.l"
#line 2507 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
RETURN_TOKEN(END);
@@ -6828,7 +6831,7 @@ yy695:
RETURN_TOKEN(T_ERROR);
}
}
#line 6832 "Zend/zend_language_scanner.c"
#line 6835 "Zend/zend_language_scanner.c"
yy696:
YYDEBUG(696, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6852,12 +6855,12 @@ yy697:
++YYCURSOR;
YYDEBUG(698, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2444 "Zend/zend_language_scanner.l"
#line 2447 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
RETURN_TOKEN('`');
}
#line 6861 "Zend/zend_language_scanner.c"
#line 6864 "Zend/zend_language_scanner.c"
yy699:
YYDEBUG(699, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6882,7 +6885,7 @@ yy702:
{
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 6886 "Zend/zend_language_scanner.c"
#line 6889 "Zend/zend_language_scanner.c"
yy703:
YYDEBUG(703, *YYCURSOR);
++YYCURSOR;
@@ -6893,19 +6896,19 @@ yy703:
yy_push_state(ST_LOOKING_FOR_VARNAME);
RETURN_TOKEN(T_DOLLAR_OPEN_CURLY_BRACES);
}
#line 6897 "Zend/zend_language_scanner.c"
#line 6900 "Zend/zend_language_scanner.c"
yy705:
YYDEBUG(705, *YYCURSOR);
++YYCURSOR;
YYDEBUG(706, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2432 "Zend/zend_language_scanner.l"
#line 2435 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_IN_SCRIPTING);
yyless(1);
RETURN_TOKEN(T_CURLY_OPEN);
}
#line 6909 "Zend/zend_language_scanner.c"
#line 6912 "Zend/zend_language_scanner.c"
yy707:
YYDEBUG(707, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6925,7 +6928,7 @@ yy709:
yy_push_state(ST_VAR_OFFSET);
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 6929 "Zend/zend_language_scanner.c"
#line 6932 "Zend/zend_language_scanner.c"
yy711:
YYDEBUG(711, *YYCURSOR);
yych = *++YYCURSOR;
@@ -6949,7 +6952,7 @@ yy712:
yy_push_state(ST_LOOKING_FOR_PROPERTY);
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 6953 "Zend/zend_language_scanner.c"
#line 6956 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_DOUBLE_QUOTES:
@@ -7002,7 +7005,7 @@ yyc_ST_DOUBLE_QUOTES:
yy717:
YYDEBUG(717, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2450 "Zend/zend_language_scanner.l"
#line 2453 "Zend/zend_language_scanner.l"
{
if (GET_DOUBLE_QUOTES_SCANNED_LENGTH()) {
YYCURSOR += GET_DOUBLE_QUOTES_SCANNED_LENGTH() - 1;
@@ -7055,18 +7058,18 @@ double_quotes_scan_done:
RETURN_TOKEN(T_ERROR);
}
}
#line 7059 "Zend/zend_language_scanner.c"
#line 7062 "Zend/zend_language_scanner.c"
yy718:
YYDEBUG(718, *YYCURSOR);
++YYCURSOR;
YYDEBUG(719, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2439 "Zend/zend_language_scanner.l"
#line 2442 "Zend/zend_language_scanner.l"
{
BEGIN(ST_IN_SCRIPTING);
RETURN_TOKEN('"');
}
#line 7070 "Zend/zend_language_scanner.c"
#line 7073 "Zend/zend_language_scanner.c"
yy720:
YYDEBUG(720, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7109,7 +7112,7 @@ yy724:
{
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 7113 "Zend/zend_language_scanner.c"
#line 7116 "Zend/zend_language_scanner.c"
yy725:
YYDEBUG(725, *YYCURSOR);
++YYCURSOR;
@@ -7120,19 +7123,19 @@ yy725:
yy_push_state(ST_LOOKING_FOR_VARNAME);
RETURN_TOKEN(T_DOLLAR_OPEN_CURLY_BRACES);
}
#line 7124 "Zend/zend_language_scanner.c"
#line 7127 "Zend/zend_language_scanner.c"
yy727:
YYDEBUG(727, *YYCURSOR);
++YYCURSOR;
YYDEBUG(728, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2432 "Zend/zend_language_scanner.l"
#line 2435 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_IN_SCRIPTING);
yyless(1);
RETURN_TOKEN(T_CURLY_OPEN);
}
#line 7136 "Zend/zend_language_scanner.c"
#line 7139 "Zend/zend_language_scanner.c"
yy729:
YYDEBUG(729, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7152,7 +7155,7 @@ yy731:
yy_push_state(ST_VAR_OFFSET);
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 7156 "Zend/zend_language_scanner.c"
#line 7159 "Zend/zend_language_scanner.c"
yy733:
YYDEBUG(733, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7176,7 +7179,7 @@ yy734:
yy_push_state(ST_LOOKING_FOR_PROPERTY);
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 7180 "Zend/zend_language_scanner.c"
#line 7183 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_HEREDOC:
@@ -7225,7 +7228,7 @@ yyc_ST_HEREDOC:
yy739:
YYDEBUG(739, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2550 "Zend/zend_language_scanner.l"
#line 2553 "Zend/zend_language_scanner.l"
{
zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
int newline = 0, indentation = 0, spacing = 0;
@@ -7348,7 +7351,7 @@ heredoc_scan_done:
RETURN_TOKEN_WITH_VAL(T_ENCAPSED_AND_WHITESPACE);
}
#line 7352 "Zend/zend_language_scanner.c"
#line 7355 "Zend/zend_language_scanner.c"
yy740:
YYDEBUG(740, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7391,7 +7394,7 @@ yy744:
{
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 7395 "Zend/zend_language_scanner.c"
#line 7398 "Zend/zend_language_scanner.c"
yy745:
YYDEBUG(745, *YYCURSOR);
++YYCURSOR;
@@ -7402,19 +7405,19 @@ yy745:
yy_push_state(ST_LOOKING_FOR_VARNAME);
RETURN_TOKEN(T_DOLLAR_OPEN_CURLY_BRACES);
}
#line 7406 "Zend/zend_language_scanner.c"
#line 7409 "Zend/zend_language_scanner.c"
yy747:
YYDEBUG(747, *YYCURSOR);
++YYCURSOR;
YYDEBUG(748, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2432 "Zend/zend_language_scanner.l"
#line 2435 "Zend/zend_language_scanner.l"
{
yy_push_state(ST_IN_SCRIPTING);
yyless(1);
RETURN_TOKEN(T_CURLY_OPEN);
}
#line 7418 "Zend/zend_language_scanner.c"
#line 7421 "Zend/zend_language_scanner.c"
yy749:
YYDEBUG(749, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7434,7 +7437,7 @@ yy751:
yy_push_state(ST_VAR_OFFSET);
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 7438 "Zend/zend_language_scanner.c"
#line 7441 "Zend/zend_language_scanner.c"
yy753:
YYDEBUG(753, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7458,7 +7461,7 @@ yy754:
yy_push_state(ST_LOOKING_FOR_PROPERTY);
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 7462 "Zend/zend_language_scanner.c"
#line 7465 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_LOOKING_FOR_VARNAME:
@@ -7522,7 +7525,7 @@ yy759:
yy_push_state(ST_IN_SCRIPTING);
goto restart;
}
#line 7526 "Zend/zend_language_scanner.c"
#line 7529 "Zend/zend_language_scanner.c"
yy760:
YYDEBUG(760, *YYCURSOR);
yych = *(YYMARKER = ++YYCURSOR);
@@ -7576,7 +7579,7 @@ yy764:
yy_push_state(ST_IN_SCRIPTING);
RETURN_TOKEN_WITH_STR(T_STRING_VARNAME, 0);
}
#line 7580 "Zend/zend_language_scanner.c"
#line 7583 "Zend/zend_language_scanner.c"
}
/* *********************************** */
yyc_ST_VAR_OFFSET:
@@ -7665,7 +7668,7 @@ yy768:
++YYCURSOR;
YYDEBUG(769, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2765 "Zend/zend_language_scanner.l"
#line 2768 "Zend/zend_language_scanner.l"
{
if (YYCURSOR > YYLIMIT) {
RETURN_TOKEN(END);
@@ -7676,7 +7679,7 @@ yy768:
}
goto restart;
}
#line 7680 "Zend/zend_language_scanner.c"
#line 7683 "Zend/zend_language_scanner.c"
yy770:
YYDEBUG(770, *YYCURSOR);
++YYCURSOR;
@@ -7690,7 +7693,7 @@ yy770:
ZVAL_NULL(zendlval);
RETURN_TOKEN_WITH_VAL(T_ENCAPSED_AND_WHITESPACE);
}
#line 7694 "Zend/zend_language_scanner.c"
#line 7697 "Zend/zend_language_scanner.c"
yy772:
YYDEBUG(772, *YYCURSOR);
++YYCURSOR;
@@ -7702,7 +7705,7 @@ yy773:
/* Only '[' or '-' can be valid, but returning other tokens will allow a more explicit parse error */
RETURN_TOKEN(yytext[0]);
}
#line 7706 "Zend/zend_language_scanner.c"
#line 7709 "Zend/zend_language_scanner.c"
yy774:
YYDEBUG(774, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7753,7 +7756,7 @@ string:
}
RETURN_TOKEN_WITH_VAL(T_NUM_STRING);
}
#line 7757 "Zend/zend_language_scanner.c"
#line 7760 "Zend/zend_language_scanner.c"
yy777:
YYDEBUG(777, *YYCURSOR);
++YYCURSOR;
@@ -7779,7 +7782,7 @@ yy779:
{
RETURN_TOKEN_WITH_STR(T_STRING, 0);
}
#line 7783 "Zend/zend_language_scanner.c"
#line 7786 "Zend/zend_language_scanner.c"
yy782:
YYDEBUG(782, *YYCURSOR);
++YYCURSOR;
@@ -7790,7 +7793,7 @@ yy782:
yy_pop_state();
RETURN_TOKEN(']');
}
#line 7794 "Zend/zend_language_scanner.c"
#line 7797 "Zend/zend_language_scanner.c"
yy784:
YYDEBUG(784, *YYCURSOR);
++YYCURSOR;
@@ -7819,7 +7822,7 @@ yy786:
{
RETURN_TOKEN_WITH_STR(T_VARIABLE, 1);
}
#line 7823 "Zend/zend_language_scanner.c"
#line 7826 "Zend/zend_language_scanner.c"
yy787:
YYDEBUG(787, *YYCURSOR);
++YYCURSOR;
@@ -7840,7 +7843,7 @@ yy789:
}
RETURN_TOKEN_WITH_VAL(T_NUM_STRING);
}
#line 7844 "Zend/zend_language_scanner.c"
#line 7847 "Zend/zend_language_scanner.c"
yy790:
YYDEBUG(790, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7937,7 +7940,7 @@ inline_char_handler:
HANDLE_NEWLINES(yytext, yyleng);
RETURN_TOKEN_WITH_VAL(T_INLINE_HTML);
}
#line 7941 "Zend/zend_language_scanner.c"
#line 7944 "Zend/zend_language_scanner.c"
yy801:
YYDEBUG(801, *YYCURSOR);
yych = *++YYCURSOR;
@@ -7965,7 +7968,7 @@ yy803:
goto inline_char_handler;
}
}
#line 7969 "Zend/zend_language_scanner.c"
#line 7972 "Zend/zend_language_scanner.c"
yy804:
YYDEBUG(804, *YYCURSOR);
++YYCURSOR;
@@ -7979,7 +7982,7 @@ yy804:
}
RETURN_TOKEN(T_OPEN_TAG_WITH_ECHO);
}
#line 7983 "Zend/zend_language_scanner.c"
#line 7986 "Zend/zend_language_scanner.c"
yy806:
YYDEBUG(806, *YYCURSOR);
yych = *++YYCURSOR;
@@ -8019,7 +8022,7 @@ yy811:
}
RETURN_TOKEN(T_OPEN_TAG);
}
#line 8023 "Zend/zend_language_scanner.c"
#line 8026 "Zend/zend_language_scanner.c"
yy812:
YYDEBUG(812, *YYCURSOR);
yych = *++YYCURSOR;
@@ -8034,7 +8037,7 @@ yyc_ST_END_HEREDOC:
++YYCURSOR;
YYDEBUG(816, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2418 "Zend/zend_language_scanner.l"
#line 2421 "Zend/zend_language_scanner.l"
{
zend_heredoc_label *heredoc_label = zend_ptr_stack_pop(&SCNG(heredoc_label_stack));
@@ -8047,7 +8050,7 @@ yyc_ST_END_HEREDOC:
BEGIN(ST_IN_SCRIPTING);
RETURN_TOKEN(T_END_HEREDOC);
}
#line 8051 "Zend/zend_language_scanner.c"
#line 8054 "Zend/zend_language_scanner.c"
/* *********************************** */
yyc_ST_NOWDOC:
YYDEBUG(817, *YYCURSOR);
@@ -8057,7 +8060,7 @@ yyc_ST_NOWDOC:
++YYCURSOR;
YYDEBUG(820, *YYCURSOR);
yyleng = YYCURSOR - SCNG(yy_text);
#line 2674 "Zend/zend_language_scanner.l"
#line 2677 "Zend/zend_language_scanner.l"
{
zend_heredoc_label *heredoc_label = zend_ptr_stack_top(&SCNG(heredoc_label_stack));
int newline = 0, indentation = 0, spacing = -1;
@@ -8147,9 +8150,9 @@ nowdoc_scan_done:
HANDLE_NEWLINES(yytext, yyleng - newline);
RETURN_TOKEN_WITH_VAL(T_ENCAPSED_AND_WHITESPACE);
}
#line 8151 "Zend/zend_language_scanner.c"
#line 8154 "Zend/zend_language_scanner.c"
}
#line 2776 "Zend/zend_language_scanner.l"
#line 2779 "Zend/zend_language_scanner.l"
emit_token_with_str:
+5 -2
View File
@@ -1066,8 +1066,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot
octal_buf[2] = *(++s);
}
}
if (octal_buf[2] &&
(octal_buf[0] > '3')) {
if (octal_buf[2] && (octal_buf[0] > '3') && !SCNG(heredoc_scan_ahead)) {
/* 3 octit values must not overflow 0xFF (\377) */
zend_error(E_COMPILE_WARNING, "Octal escape sequence overflow \\%s is greater than \\377", octal_buf);
}
@@ -1112,6 +1111,7 @@ static const char *next_newline(const char *str, const char *end, size_t *newlin
for (; str < end; str++) {
if (*str == '\r') {
*newline_len = str + 1 < end && *(str + 1) == '\n' ? 2 : 1;
return str;
} else if (*str == '\n') {
*newline_len = 1;
return str;
@@ -2340,6 +2340,7 @@ skip_escape_conversion:
if (is_heredoc && !SCNG(heredoc_scan_ahead)) {
zend_lex_state current_state;
zend_string *saved_doc_comment = CG(doc_comment);
int heredoc_nesting_level = 1;
int first_token = 0;
int error = 0;
@@ -2350,6 +2351,7 @@ skip_escape_conversion:
SCNG(heredoc_indentation) = 0;
SCNG(heredoc_indentation_uses_spaces) = 0;
LANG_SCNG(on_event) = NULL;
CG(doc_comment) = NULL;
zend_ptr_stack_reverse_apply(&current_state.heredoc_label_stack, copy_heredoc_label_stack);
@@ -2399,6 +2401,7 @@ skip_escape_conversion:
zend_restore_lexical_state(&current_state);
SCNG(heredoc_scan_ahead) = 0;
CG(increment_lineno) = 0;
CG(doc_comment) = saved_doc_comment;
if (PARSER_MODE() && error) {
RETURN_TOKEN(T_ERROR);
+1 -2
View File
@@ -1,5 +1,4 @@
/* Generated by re2c 1.0.1 */
#line 3 "Zend/zend_language_scanner_defs.h"
/* Generated by re2c 1.3 */
enum YYCONDTYPE {
yycST_IN_SCRIPTING,
+4 -1
View File
@@ -903,7 +903,7 @@ try_again:
static zend_never_inline void ZEND_FASTCALL add_function_array(zval *result, zval *op1, zval *op2) /* {{{ */
{
if ((result == op1) && (result == op2)) {
if (result == op1 && Z_ARR_P(op1) == Z_ARR_P(op2)) {
/* $a += $a */
return;
}
@@ -1836,6 +1836,9 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) /
}
} else if (UNEXPECTED(Z_STRLEN_P(op2) == 0)) {
if (EXPECTED(result != op1)) {
if (result == orig_op1) {
i_zval_ptr_dtor(result ZEND_FILE_LINE_CC);
}
ZVAL_COPY(result, op1);
}
} else {
+12 -8
View File
@@ -186,12 +186,13 @@ static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_
ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_alloc(len, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN(len, ZSTR_LEN(s)) + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
@@ -206,12 +207,13 @@ static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t
ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_alloc(len, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), ZSTR_LEN(s) + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
@@ -226,12 +228,13 @@ static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size
ZSTR_LEN(ret) = len;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_alloc(len, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), len + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
@@ -245,12 +248,13 @@ static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s,
ZSTR_LEN(ret) = (n * m) + l;
zend_string_forget_hash_val(ret);
return ret;
} else {
GC_DELREF(s);
}
}
ret = zend_string_safe_alloc(n, m, l, persistent);
memcpy(ZSTR_VAL(ret), ZSTR_VAL(s), MIN((n * m) + l, ZSTR_LEN(s)) + 1);
if (!ZSTR_IS_INTERNED(s)) {
GC_DELREF(s);
}
return ret;
}
+33 -3
View File
@@ -55,6 +55,14 @@
#define IO_REPARSE_TAG_ONEDRIVE (0x80000021L)
#endif
# ifndef IO_REPARSE_TAG_ACTIVISION_HSM
# define IO_REPARSE_TAG_ACTIVISION_HSM (0x00000047L)
# endif
# ifndef IO_REPARSE_TAG_PROJFS
# define IO_REPARSE_TAG_PROJFS (0x9000001CL)
# endif
# ifndef VOLUME_NAME_NT
# define VOLUME_NAME_NT 0x2
# endif
@@ -739,6 +747,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
HANDLE hFind = INVALID_HANDLE_VALUE;
ALLOCA_FLAG(use_heap_large)
wchar_t *pathw = NULL;
int may_retry_reparse_point;
#define FREE_PATHW() \
do { free(pathw); } while(0);
@@ -837,6 +846,8 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
}
#ifdef ZEND_WIN32
retry_reparse_point:
may_retry_reparse_point = 0;
if (save) {
pathw = php_win32_ioutil_any_to_w(path);
if (!pathw) {
@@ -859,7 +870,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
tmp = do_alloca(len+1, use_heap);
memcpy(tmp, path, len+1);
retry:
retry_reparse_tag_cloud:
if(save &&
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@@ -920,7 +931,7 @@ retry:
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
CloseHandle(hLink);
(*ll)--;
goto retry;
goto retry_reparse_tag_cloud;
}
free_alloca(tmp, use_heap);
CloseHandle(hLink);
@@ -931,6 +942,7 @@ retry:
CloseHandle(hLink);
if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
may_retry_reparse_point = 1;
reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget;
isabsolute = (pbuffer->SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0;
#if VIRTUAL_CWD_DEBUG
@@ -1002,7 +1014,9 @@ retry:
else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP ||
/* Starting with 1709. */
(pbuffer->ReparseTag & ~IO_REPARSE_TAG_CLOUD_MASK) == IO_REPARSE_TAG_CLOUD ||
IO_REPARSE_TAG_ONEDRIVE == pbuffer->ReparseTag) {
IO_REPARSE_TAG_ONEDRIVE == pbuffer->ReparseTag ||
IO_REPARSE_TAG_ACTIVISION_HSM == pbuffer->ReparseTag ||
IO_REPARSE_TAG_PROJFS == pbuffer->ReparseTag) {
isabsolute = 1;
substitutename = malloc((len + 1) * sizeof(char));
if (!substitutename) {
@@ -1065,6 +1079,22 @@ retry:
free_alloca(pbuffer, use_heap_large);
free(substitutename);
if (may_retry_reparse_point) {
DWORD attrs;
FREE_PATHW()
pathw = php_win32_ioutil_any_to_w(path);
if (!pathw) {
return (size_t)-1;
}
attrs = GetFileAttributesW(pathw);
if (!isVolume && attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_REPARSE_POINT)) {
free_alloca(tmp, use_heap);
FREE_PATHW()
goto retry_reparse_point;
}
}
if(isabsolute == 1) {
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
/* use_realpath is 0 in the call below coz path is absolute*/
+3 -10
View File
@@ -4819,6 +4819,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, NUM, UNUSED|CACHE_SLOT)
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
do {
zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
@@ -7096,15 +7097,6 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
ZEND_ASSERT(zfunc != NULL && Z_FUNC_P(zfunc)->type == ZEND_USER_FUNCTION);
fbc = Z_PTR_P(zfunc);
if (fbc->common.fn_flags & ZEND_ACC_IMMUTABLE) {
zend_function *new_func = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
memcpy(new_func, fbc, sizeof(zend_op_array));
new_func->common.fn_flags &= ~ZEND_ACC_IMMUTABLE;
Z_PTR_P(zfunc) = fbc = new_func;
}
if (Z_TYPE(EX(This)) == IS_OBJECT) {
called_scope = Z_OBJCE(EX(This));
if (UNEXPECTED((Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC) ||
@@ -7371,6 +7363,7 @@ ZEND_VM_HANDLER(142, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
FREE_OP1();
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
@@ -8879,10 +8872,10 @@ ZEND_VM_DEFINE_OP(137, ZEND_OP_DATA);
ZEND_VM_HELPER(zend_interrupt_helper, ANY, ANY)
{
EG(vm_interrupt) = 0;
SAVE_OPLINE();
if (EG(timed_out)) {
zend_timeout(0);
} else if (zend_interrupt_function) {
SAVE_OPLINE();
zend_interrupt_function(execute_data);
ZEND_VM_ENTER();
}
+6 -10
View File
@@ -2054,10 +2054,10 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_FORWARD_SPEC_H
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_interrupt_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
{
EG(vm_interrupt) = 0;
SAVE_OPLINE();
if (EG(timed_out)) {
zend_timeout(0);
} else if (zend_interrupt_function) {
SAVE_OPLINE();
zend_interrupt_function(execute_data);
ZEND_VM_ENTER();
}
@@ -2375,6 +2375,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_UNUSED_HAND
ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
ZEND_ADD_CALL_FLAG(execute_data, ZEND_CALL_FREE_EXTRA_ARGS);
do {
zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
@@ -3707,6 +3708,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
@@ -9207,15 +9209,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_C
zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
ZEND_ASSERT(zfunc != NULL && Z_FUNC_P(zfunc)->type == ZEND_USER_FUNCTION);
fbc = Z_PTR_P(zfunc);
if (fbc->common.fn_flags & ZEND_ACC_IMMUTABLE) {
zend_function *new_func = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
memcpy(new_func, fbc, sizeof(zend_op_array));
new_func->common.fn_flags &= ~ZEND_ACC_IMMUTABLE;
Z_PTR_P(zfunc) = fbc = new_func;
}
if (Z_TYPE(EX(This)) == IS_OBJECT) {
called_scope = Z_OBJCE(EX(This));
if (UNEXPECTED((Z_FUNC_P(zfunc)->common.fn_flags & ZEND_ACC_STATIC) ||
@@ -18346,6 +18339,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
zval_ptr_dtor_nogc(free_op1);
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
@@ -21672,6 +21666,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
zval_ptr_dtor_nogc(free_op1);
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
@@ -37896,6 +37891,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
}
} else {
zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
UNDEF_RESULT();
HANDLE_EXCEPTION();
}
+25 -21
View File
@@ -329,8 +329,8 @@ dnl
dnl PHP_CHECK_GCC_ARG(arg, action-if-found, action-if-not-found)
dnl
AC_DEFUN([PHP_CHECK_GCC_ARG],[
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z-,a-z_)
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z-,a-z_), [
gcc_arg_name=[ac_cv_gcc_arg]translit($1,A-Z=-,a-z__)
AC_CACHE_CHECK([whether $CC supports $1], [ac_cv_gcc_arg]translit($1,A-Z=-,a-z__), [
echo 'void somefunc() { };' > conftest.c
cmd='$CC $1 -c conftest.c'
if eval $cmd 2>&1 | $EGREP -e $1 >/dev/null ; then
@@ -1209,14 +1209,14 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
#include <unistd.h>
#include <errno.h>
$1
main() {
int main() {
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
if (fd < 0) exit(1);
if (pwrite(fd, "text", 4, 0) != 4) exit(1);
if (fd < 0) return 1;
if (pwrite(fd, "text", 4, 0) != 4) return 1;
/* Linux glibc breakage until 2.2.5 */
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) exit(1);
exit(0);
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1;
return 0;
}
]])],[
@@ -1239,14 +1239,14 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
#include <unistd.h>
#include <errno.h>
$1
main() {
int main() {
char buf[3];
int fd = open("conftest_in", O_RDONLY);
if (fd < 0) exit(1);
if (pread(fd, buf, 2, 0) != 2) exit(1);
if (fd < 0) return 1;
if (pread(fd, buf, 2, 0) != 2) return 1;
/* Linux glibc breakage until 2.2.5 */
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) exit(1);
exit(0);
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1;
return 0;
}
]])],[
ac_cv_pread=yes
@@ -1347,25 +1347,26 @@ AC_DEFUN([PHP_READDIR_R_TYPE],[
#define _REENTRANT
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
main() {
int main() {
DIR *dir;
char entry[sizeof(struct dirent)+PATH_MAX];
struct dirent *pentry = (struct dirent *) &entry;
dir = opendir("/");
if (!dir)
exit(1);
return 1;
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0) {
close(dir);
exit(0);
return 0;
}
close(dir);
exit(1);
return 1;
}
]])],[
ac_cv_what_readdir_r=POSIX
@@ -1693,6 +1694,7 @@ AC_DEFUN([PHP_BROKEN_GLIBC_FOPEN_APPEND], [
AC_CACHE_VAL(_cv_have_broken_glibc_fopen_append,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
FILE *fp;
@@ -1702,7 +1704,7 @@ int main(int argc, char *argv[])
fp = fopen(filename, "w");
if (fp == NULL) {
perror("fopen");
exit(2);
return 2;
}
fputs("foobar", fp);
fclose(fp);
@@ -1812,13 +1814,13 @@ int seeker(void *cookie, __off64_t *position, int whence)
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
main() {
int main() {
struct cookiedata g = { 0 };
FILE *fp = fopencookie(&g, "r", funcs);
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
exit(0);
exit(1);
return 0;
return 1;
}
]])], [
@@ -2084,7 +2086,7 @@ dnl Search for the sendmail binary
dnl
AC_DEFUN([PHP_PROG_SENDMAIL], [
PHP_ALT_PATH=/usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
AC_PATH_PROG(PROG_SENDMAIL, sendmail,[], $PATH:$PHP_ALT_PATH)
AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/sbin/sendmail, $PATH:$PHP_ALT_PATH)
PHP_SUBST(PROG_SENDMAIL)
])
@@ -2252,6 +2254,8 @@ AC_DEFUN([PHP_SETUP_ICU],[
fi
fi
fi
ICU_CFLAGS="$ICU_CFLAGS -DU_DEFINE_FALSE_AND_TRUE=1"
])
dnl
+1 -5
View File
@@ -978,10 +978,6 @@ else
# endif
#endif
#ifdef __cplusplus
extern "C" void exit (int);
#endif
void fnord() { int i=42;}
int main ()
{
@@ -997,7 +993,7 @@ int main ()
else
puts (dlerror ());
exit (status);
return (status);
}]
EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+8 -7
View File
@@ -107,8 +107,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=3
PHP_RELEASE_VERSION=15
PHP_EXTRA_VERSION=""
PHP_RELEASE_VERSION=29
PHP_EXTRA_VERSION="-dev"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
@@ -716,6 +716,7 @@ dnl Also check for working getaddrinfo
AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#ifndef AF_INET
@@ -728,11 +729,11 @@ int main(void) {
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) {
exit(1);
return 1;
}
if (ai == 0) {
exit(1);
return 1;
}
pai = ai;
@@ -740,16 +741,16 @@ int main(void) {
while (pai) {
if (pai->ai_family != AF_INET) {
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
exit(1);
return 1;
}
if (pai->ai_addr->sa_family != AF_INET) {
/* 127.0.0.1/NUMERICHOST should only resolve ONE way */
exit(1);
return 1;
}
pai = pai->ai_next;
}
freeaddrinfo(ai);
exit(0);
return 0;
}
]])],[ac_cv_func_getaddrinfo=yes], [ac_cv_func_getaddrinfo=no], [ac_cv_func_getaddrinfo=no])],
[ac_cv_func_getaddrinfo=no])])
+2 -2
View File
@@ -83,12 +83,12 @@ bool(false)
resource(%d) of type (stream)
resource(%d) of type (stream)
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
bool(false)
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
bool(false)
+10 -5
View File
@@ -23,20 +23,25 @@
#include "sdncal.h"
#include <time.h>
#define SECS_PER_DAY (24 * 3600)
/* {{{ proto int unixtojd([int timestamp])
Convert UNIX timestamp to Julian Day */
PHP_FUNCTION(unixtojd)
{
time_t ts = 0;
zend_long tl = 0;
struct tm *ta, tmbuf;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &ts) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &tl) == FAILURE) {
return;
}
if (!ts) {
if (!tl) {
ts = time(NULL);
} else if (ts < 0) {
} else if (tl >= 0) {
ts = (time_t) tl;
} else {
RETURN_FALSE;
}
@@ -59,11 +64,11 @@ PHP_FUNCTION(jdtounix)
}
uday -= 2440588 /* J.D. of 1.1.1970 */;
if (uday < 0 || uday > 24755) { /* before beginning of unix epoch or behind end of unix epoch */
if (uday < 0 || uday > ZEND_LONG_MAX / SECS_PER_DAY) { /* before beginning of unix epoch or greater than representable */
RETURN_FALSE;
}
RETURN_LONG(uday * 24 * 3600);
RETURN_LONG(uday * SECS_PER_DAY);
}
/* }}} */
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #80185 (jdtounix() fails after 2037)
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
if (PHP_INT_SIZE != 8) die("skip for 64bit platforms only");
?>
--FILE--
<?php
var_dump(jdtounix(2465712));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
?>
--EXPECT--
int(2170713600)
int(9223372036854720000)
bool(false)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #80185 (jdtounix() fails after 2037)
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip ext/calendar required');
if (PHP_INT_SIZE != 4) die("skip for 32bit platforms only");
?>
--FILE--
<?php
var_dump(jdtounix(2465712));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440588));
var_dump(jdtounix(PHP_INT_MAX / 86400 + 2440589));
?>
--EXPECT--
bool(false)
int(2147472000)
bool(false)
+7 -8
View File
@@ -61,7 +61,7 @@ PHP_FUNCTION(com_create_instance)
&module_name, &module_name_len, &server_name, &server_name_len,
&cp, &typelib_name, &typelib_name_len) &&
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
ZEND_NUM_ARGS(), "sa|ls",
ZEND_NUM_ARGS(), "sa/|ls",
&module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) {
@@ -133,7 +133,7 @@ PHP_FUNCTION(com_create_instance)
info.pwszName = php_com_string_to_olestring(server_name, server_name_len, obj->code_page);
if (user_name) {
authid.User = php_com_string_to_olestring(user_name, -1, obj->code_page);
authid.User = (OLECHAR*)user_name;
authid.UserLength = (ULONG)user_name_len;
if (password) {
@@ -221,7 +221,6 @@ PHP_FUNCTION(com_create_instance)
if (server_name) {
if (info.pwszName) efree(info.pwszName);
if (authid.User) efree(authid.User);
}
efree(moniker);
@@ -248,7 +247,7 @@ PHP_FUNCTION(com_create_instance)
TL = php_com_load_typelib_via_cache(typelib_name, obj->code_page, &cached);
if (TL) {
if (COMG(autoreg_on) && !cached) {
if (COMG(autoreg_on)) {
php_com_import_typelib(TL, mode, obj->code_page);
}
@@ -440,8 +439,9 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
if (obj->typeinfo) {
hr = ITypeInfo_GetIDsOfNames(obj->typeinfo, &olename, 1, dispid);
if (FAILED(hr)) {
HRESULT hr1 = hr;
hr = IDispatch_GetIDsOfNames(V_DISPATCH(&obj->v), &IID_NULL, &olename, 1, LOCALE_SYSTEM_DEFAULT, dispid);
if (SUCCEEDED(hr)) {
if (SUCCEEDED(hr) && hr1 != E_NOTIMPL) {
/* fall back on IDispatch direct */
ITypeInfo_Release(obj->typeinfo);
obj->typeinfo = NULL;
@@ -589,6 +589,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
}
}
efree(vargs);
if (byref_vals) efree(byref_vals);
}
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
@@ -838,9 +839,7 @@ PHP_FUNCTION(com_load_typelib)
php_com_initialize();
pTL = php_com_load_typelib_via_cache(name, codepage, &cached);
if (pTL) {
if (cached) {
RETVAL_TRUE;
} else if (php_com_import_typelib(pTL, cs ? CONST_CS : 0, codepage) == SUCCESS) {
if (php_com_import_typelib(pTL, cs ? CONST_CS : 0, codepage) == SUCCESS) {
RETVAL_TRUE;
}
+6 -4
View File
@@ -252,9 +252,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
}
if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page), &cached)) != NULL) {
if (!cached) {
php_com_import_typelib(pTL, mode, COMG(code_page));
}
php_com_import_typelib(pTL, mode, COMG(code_page));
ITypeLib_Release(pTL);
}
}
@@ -336,11 +334,15 @@ PHP_MINIT_FUNCTION(com_dotnet)
#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
#define COM_ERR_CONST(x) { \
#if SIZEOF_ZEND_LONG == 8
# define COM_ERR_CONST(x) { \
zend_long __tmp; \
ULongToIntPtr(x, &__tmp); \
REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
}
#else
# define COM_ERR_CONST COM_CONST
#endif
COM_CONST(CLSCTX_INPROC_SERVER);
COM_CONST(CLSCTX_INPROC_HANDLER);
+1 -1
View File
@@ -187,7 +187,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b
SafeArrayGetUBound(V_ARRAY(&I->safe_array), 1, &I->sa_max);
/* pre-fetch the element */
if (php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
if (I->sa_max >= bound && php_com_safearray_get_elem(&I->safe_array, &I->v, bound)) {
I->key = bound;
ZVAL_NULL(&ptr);
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
+55
View File
@@ -103,3 +103,58 @@ PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring, size_t
return string;
}
BSTR php_com_string_to_bstr(zend_string *string, int codepage)
{
BSTR bstr = NULL;
DWORD flags = codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS;
size_t mb_len = ZSTR_LEN(string);
int wc_len;
if ((wc_len = MultiByteToWideChar(codepage, flags, ZSTR_VAL(string), (int)mb_len + 1, NULL, 0)) <= 0) {
goto fail;
}
if ((bstr = SysAllocStringLen(NULL, (UINT)(wc_len - 1))) == NULL) {
goto fail;
}
if ((wc_len = MultiByteToWideChar(codepage, flags, ZSTR_VAL(string), (int)mb_len + 1, bstr, wc_len)) <= 0) {
goto fail;
}
return bstr;
fail:
char *msg = php_win32_error_to_msg(GetLastError());
php_error_docref(NULL, E_WARNING,
"Could not convert string to unicode: `%s'", msg);
LocalFree(msg);
SysFreeString(bstr);
return SysAllocString(L"");
}
zend_string *php_com_bstr_to_string(BSTR bstr, int codepage)
{
zend_string *string = NULL;
UINT wc_len = SysStringLen(bstr);
int mb_len;
mb_len = WideCharToMultiByte(codepage, 0, bstr, wc_len + 1, NULL, 0, NULL, NULL);
if (mb_len > 0) {
string = zend_string_alloc(mb_len - 1, 0);
mb_len = WideCharToMultiByte(codepage, 0, bstr, wc_len + 1, ZSTR_VAL(string), mb_len, NULL, NULL);
}
if (mb_len <= 0) {
char *msg = php_win32_error_to_msg(GetLastError());
php_error_docref(NULL, E_WARNING,
"Could not convert string from unicode: `%s'", msg);
LocalFree(msg);
if (string != NULL) {
zend_string_release(string);
}
string = ZSTR_EMPTY_ALLOC();
}
return string;
}
+2 -11
View File
@@ -248,13 +248,6 @@ static struct IStreamVtbl php_istream_vtbl = {
static void istream_destructor(php_istream *stm)
{
if (stm->res) {
zend_resource *res = stm->res;
stm->res = NULL;
zend_list_delete(res);
return;
}
if (stm->refcount > 0) {
CoDisconnectObject((IUnknown*)stm, 0);
}
@@ -268,7 +261,6 @@ static void istream_destructor(php_istream *stm)
PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
{
php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));
zval *tmp;
if (stm == NULL)
return NULL;
@@ -280,8 +272,7 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
stm->stream = stream;
GC_ADDREF(stream->res);
tmp = zend_list_insert(stm, le_istream);
stm->res = Z_RES_P(tmp);
stm->res = zend_register_resource(stm, le_istream);
return (IStream*)stm;
}
@@ -398,7 +389,7 @@ CPH_METHOD(SaveToFile)
RETURN_FALSE;
}
olefilename = php_com_string_to_olestring(filename, strlen(fullpath), helper->codepage);
olefilename = php_com_string_to_olestring(fullpath, strlen(fullpath), helper->codepage);
efree(fullpath);
}
res = IPersistFile_Save(helper->ipf, olefilename, remember);
+4 -2
View File
@@ -114,6 +114,8 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
proxy->dimensions, args, 0);
efree(args);
if (res == SUCCESS) {
php_com_zval_from_variant(rv, &v, proxy->obj->code_page);
VariantClear(&v);
@@ -387,7 +389,7 @@ static zend_object* saproxy_clone(zval *object)
memcpy(cloneproxy, proxy, sizeof(*cloneproxy));
Z_ADDREF_P(cloneproxy->zobj);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0);
cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval), 0);
clone_indices(cloneproxy, proxy, proxy->dimensions);
return &cloneproxy->std;
@@ -437,7 +439,7 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index)
}
Z_ADDREF_P(proxy->zobj);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);
proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval), 0);
if (rel) {
clone_indices(proxy, rel, rel->dimensions);
+25 -21
View File
@@ -267,18 +267,20 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
if (obj) {
if (dispname == NULL && sink) {
IProvideClassInfo2 *pci2;
IProvideClassInfo *pci;
if (V_VT(&obj->v) == VT_DISPATCH) {
IProvideClassInfo2 *pci2;
IProvideClassInfo *pci;
if (SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo2, (void**)&pci2))) {
gotguid = SUCCEEDED(IProvideClassInfo2_GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
IProvideClassInfo2_Release(pci2);
}
if (!gotguid && SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo, (void**)&pci))) {
/* examine the available interfaces */
/* TODO: write some code here */
php_error_docref(NULL, E_WARNING, "IProvideClassInfo: this code not yet written!");
IProvideClassInfo_Release(pci);
if (SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo2, (void**)&pci2))) {
gotguid = SUCCEEDED(IProvideClassInfo2_GetGUID(pci2, GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid));
IProvideClassInfo2_Release(pci2);
}
if (!gotguid && SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IProvideClassInfo, (void**)&pci))) {
/* examine the available interfaces */
/* TODO: write some code here */
php_error_docref(NULL, E_WARNING, "IProvideClassInfo: this code not yet written!");
IProvideClassInfo_Release(pci);
}
}
} else if (dispname == NULL) {
if (obj->typeinfo) {
@@ -295,15 +297,17 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj
/* get the library from the object; the rest will be dealt with later */
ITypeInfo_GetContainingTypeLib(obj->typeinfo, &typelib, &idx);
} else if (typelibname == NULL) {
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
if (dispname) {
unsigned int idx;
/* get the library from the object; the rest will be dealt with later */
ITypeInfo_GetContainingTypeLib(typeinfo, &typelib, &idx);
if (V_VT(&obj->v) == VT_DISPATCH) {
IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &typeinfo);
if (dispname) {
unsigned int idx;
/* get the library from the object; the rest will be dealt with later */
ITypeInfo_GetContainingTypeLib(typeinfo, &typelib, &idx);
if (typelib) {
ITypeInfo_Release(typeinfo);
typeinfo = NULL;
if (typelib) {
ITypeInfo_Release(typeinfo);
typeinfo = NULL;
}
}
}
}
@@ -436,6 +440,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
char *ansiname = NULL;
size_t ansinamelen;
int ret = 0;
DISPID lastid = 0; /* for props */
if (FAILED(ITypeInfo_GetTypeAttr(typeinfo, &attr))) {
return 0;
@@ -469,7 +474,6 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
/* So we've got the dispatch interface; lets list the event methods */
for (i = 0; i < attr->cFuncs; i++) {
zval tmp;
DISPID lastid = 0; /* for props */
int isprop;
if (FAILED(ITypeInfo_GetFuncDesc(typeinfo, i, &func)))
@@ -582,8 +586,8 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
ZVAL_STRINGL(&tmp, ansiname, ansinamelen);
zend_hash_index_update(id_to_name, func->memid, &tmp);
// TODO: avoid reallocation???
efree(ansiname);
}
efree(ansiname);
}
ITypeInfo_ReleaseFuncDesc(typeinfo, func);
}
+3 -14
View File
@@ -96,7 +96,6 @@ bogus:
PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codepage)
{
OLECHAR *olestring;
php_com_dotnet_object *obj;
zend_uchar ztype = IS_NULL;
@@ -164,13 +163,7 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
case IS_STRING:
V_VT(v) = VT_BSTR;
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage);
if (CP_UTF8 == codepage) {
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, (UINT)(wcslen(olestring) * sizeof(OLECHAR)));
} else {
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, (UINT)(Z_STRLEN_P(z) * sizeof(OLECHAR)));
}
efree(olestring);
V_BSTR(v) = php_com_string_to_bstr(Z_STR_P(z), codepage);
break;
case IS_RESOURCE:
@@ -236,12 +229,8 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
case VT_BSTR:
olestring = V_BSTR(v);
if (olestring) {
size_t len;
char *str = php_com_olestring_to_string(olestring,
&len, codepage);
ZVAL_STRINGL(z, str, len);
// TODO: avoid reallocation???
efree(str);
zend_string *str = php_com_bstr_to_string(olestring, codepage);
ZVAL_STR(z, str);
olestring = NULL;
}
break;
+2
View File
@@ -89,6 +89,8 @@ PHP_COM_DOTNET_API char *php_com_olestring_to_string(OLECHAR *olestring,
size_t *string_len, int codepage);
PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string,
size_t string_len, int codepage);
BSTR php_com_string_to_bstr(zend_string *string, int codepage);
zend_string *php_com_bstr_to_string(BSTR bstr, int codepage);
/* com_com.c */
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #62474 (com_event_sink crashes on certain arguments)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
var_dump(com_event_sink(new variant, function() {}, array()));
var_dump(com_event_sink(new variant, new variant, 'a'));
?>
--EXPECT--
bool(false)
bool(false)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #63208 (BSTR to PHP string conversion not binary safe)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
$string = "\u{0905}b\0cd";
$variant = new VARIANT($string, VT_ARRAY | VT_UI1, CP_UTF8); // Array of bytes
$converted = (string) $variant;
var_dump(bin2hex($string));
var_dump(bin2hex($converted));
?>
--EXPECT--
string(14) "e0a48562006364"
string(14) "e0a48562006364"
+27
View File
@@ -0,0 +1,27 @@
--TEST--
Bug #64130 (COM obj parameters passed by reference are not updated)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
if (PHP_INT_SIZE != 4) die('skip for 32bit platforms only');
try {
$ie = new com('InternetExplorer.Application');
} catch (com_exception $ex) {
die("skip {$ex->getMessage()}");
}
$ie->quit();
?>
--FILE--
<?php
$ie = new com('InternetExplorer.Application');
$x = 0;
$y = 0;
try {
$ie->clientToWindow($x, $y);
} catch (com_exception $ex) {}
var_dump($x > 0, $y > 0);
$ie->quit();
?>
--EXPECT--
bool(true)
bool(true)
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #66322 (COMPersistHelper::SaveToFile can save to wrong location)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
try {
new COM('Word.Application');
} catch (com_exception $ex) {
die('skip MS Word not available');
}
if (getenv("SKIP_SLOW_TESTS")) die('skip slow test');
?>
--FILE--
<?php
$w = new COM('Word.Application');
$doc = $w->Documents->Add();
$ph = new COMPersistHelper($doc);
$filename = __DIR__ . '\\..\\' . basename(__DIR__) . '\\66322.docx';
$ph->SaveToFile($filename);
var_dump(file_exists($filename));
$w->Quit();
?>
--EXPECT--
bool(true)
+3 -1
View File
@@ -2,7 +2,9 @@
Bug #73679 DOTNET read access violation using invalid codepage
--SKIPIF--
<?php # vim:ft=php
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
?>
--FILE--
<?php
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #79242 (COM error constants don't match com_exception codes)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
?>
--FILE--
<?php
var_dump(
DISP_E_DIVBYZERO,
DISP_E_OVERFLOW,
DISP_E_BADINDEX,
MK_E_UNAVAILABLE
);
?>
--EXPECT--
int(-2147352558)
int(-2147352566)
int(-2147352565)
int(-2147221021)
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #79248 (Traversing empty VT_ARRAY throws com_exception)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
$v = new variant([], VT_ARRAY);
foreach ($v as $el) {
var_dump($el);
}
echo "done\n";
?>
--EXPECT--
done
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #79299 (com_print_typeinfo prints duplicate variables)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
$dict = new COM("Scripting.Dictionary");
ob_start();
com_print_typeinfo($dict);
$typeinfo = ob_get_clean();
preg_match_all('/\/\* DISPID=9 \*\//', $typeinfo, $matches);
var_dump($matches[0]);
?>
--EXPECT--
array(1) {
[0]=>
string(14) "/* DISPID=9 */"
}
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #79332 (php_istreams are never freed)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
$ph = new COMPersistHelper(null);
try {
$ph->LoadFromStream(fopen(__FILE__, 'r'));
} catch (com_exception $ex) {
// use hard-coded message to avoid localization issues
echo "A com_exception has been thrown\n";
}
?>
--EXPECT--
A com_exception has been thrown
+2 -4
View File
@@ -2167,8 +2167,6 @@ PHP_FUNCTION(curl_copy_handle)
_php_setup_easy_copy_handlers(dupch, ch);
Z_ADDREF_P(zid);
ZVAL_RES(return_value, zend_register_resource(dupch, le_curl));
dupch->res = Z_RES_P(return_value);
}
@@ -2721,7 +2719,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
return FAILURE;
}
ZEND_HASH_FOREACH_VAL(ph, current) {
ZEND_HASH_FOREACH_VAL_IND(ph, current) {
ZVAL_DEREF(current);
val = zval_get_tmp_string(current, &tmp_val);
slist = curl_slist_append(slist, ZSTR_VAL(val));
@@ -2799,7 +2797,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
}
#endif
ZEND_HASH_FOREACH_KEY_VAL(postfields, num_key, string_key, current) {
ZEND_HASH_FOREACH_KEY_VAL_IND(postfields, num_key, string_key, current) {
zend_string *postval, *tmp_postval;
/* Pretend we have a string_key here */
if (!string_key) {
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #79199 (curl_copy_handle() memory leak)
--SKIPIF--
<?php
if (!extension_loaded('curl')) die('skip curl extension not available');
?>
--FILE--
<?php
$mem_old = 0;
for($i = 0; $i < 50; ++$i) {
$c1 = curl_init();
$c2 = curl_copy_handle($c1);
curl_close($c2);
curl_close($c1);
$mem_new = memory_get_usage();
if ($mem_new <= $mem_old) {
break;
}
$mem_old = $mem_new;
}
echo $i < 50 ? "okay" : "leak", PHP_EOL;
?>
--EXPECT--
okay
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #79741: curl_setopt CURLOPT_POSTFIELDS asserts on object with declared properties
--FILE--
<?php
class Test {
public $prop = "value";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, new Test);
?>
===DONE===
--EXPECT--
===DONE===
+4 -4
View File
@@ -7,7 +7,7 @@ TestFest 2009 - AFUP - Perrick Penet <perrick@noparking.net>
--FILE--
<?php
$url = uniqid()."://www.".uniqid().".".uniqid();
$url = substr(uniqid(),0,7)."://www.".uniqid().".".uniqid();
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@@ -18,6 +18,6 @@ curl_close($ch);
?>
--EXPECTREGEX--
string\(\d+\) "([^\r\n]*rotocol[^\r\n]+|Could not resolve host: .+)"
int\(\d\)
--EXPECTF--
string(%d) "%Srotocol%s"
int(1)
+1
View File
@@ -1,6 +1,7 @@
// vim:ft=javascript
EXTENSION("date", "php_date.c", false, "/Iext/date/lib /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DHAVE_TIMELIB_CONFIG_H=1");
PHP_DATE = "yes";
ADD_SOURCES("ext/date/lib", "astro.c timelib.c dow.c parse_date.c parse_tz.c tm2unixtime.c unixtime2tm.c parse_iso_intervals.c interval.c", "date");
AC_DEFINE('HAVE_DATE', 1, 'Have date/time support');
+20028 -22817
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1001,7 +1001,7 @@ reltextnumber = 'first'|'second'|'third'|'fourth'|'fifth'|'sixth'|'seventh'|'eig
reltexttext = 'next'|'last'|'previous'|'this';
reltextunit = 'ms' | 'µs' | (('msec'|'millisecond'|'µsec'|'microsecond'|'usec'|'sec'|'second'|'min'|'minute'|'hour'|'day'|'fortnight'|'forthnight'|'month'|'year') 's'?) | 'weeks' | daytext;
relnumber = ([+-]*[ \t]*[0-9]+);
relnumber = ([+-]*[ \t]*[0-9]{1,13});
relative = relnumber space? (reltextunit | 'week' );
relativetext = (reltextnumber|reltexttext) space reltextunit;
relativetextweek = reltexttext space 'week';
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -322,9 +322,9 @@ typedef struct _timelib_tzdb {
# define timelib_free free
#endif
#define TIMELIB_VERSION 201803
#define TIMELIB_EXTENDED_VERSION 20180301
#define TIMELIB_ASCII_VERSION "2018.03"
#define TIMELIB_VERSION 201804
#define TIMELIB_EXTENDED_VERSION 20180401
#define TIMELIB_ASCII_VERSION "2018.04"
#define TIMELIB_NONE 0x00
#define TIMELIB_OVERRIDE_TIME 0x01
+1054 -1144
View File
File diff suppressed because it is too large. Load diff
+8
View File
@@ -367,6 +367,14 @@ static timelib_sll do_years(timelib_sll year)
timelib_sll eras;
eras = (year - 1970) / 40000;
/* Hack to make sure we don't overflow. Right now, we can't easily thrown a
* warning in this case, so we'll just return some rubbish. Sucks, but at
* least it doesn't show UBSAN warnings anymore */
if (eras < -1000000 || eras > 1000000) {
return eras > 0 ? LLONG_MAX/10 : LLONG_MIN/10;
}
if (eras != 0) {
year = year - (eras * 40000);
res += (SECS_PER_ERA * eras * 100);
+1
View File
@@ -3562,6 +3562,7 @@ static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long
dateobj->time->s = s;
dateobj->time->us = ms;
timelib_update_ts(dateobj->time, NULL);
timelib_update_from_sse(dateobj->time);
} /* }}} */
/* {{{ proto DateTime date_time_set(DateTime object, int hour, int minute[, int second[, int microseconds]])
+3 -3
View File
@@ -6,12 +6,12 @@ Handling of large year values
<?php
date_default_timezone_set("America/Toronto");
$t = mktime(0,0,0,1,1,292277026596);
$t = mktime(0,0,0,1,1,2922770265);
var_dump(date("r", $t));
echo "OK\n";
?>
--EXPECT--
string(39) "Fri, 01 Jan 292277026596 00:00:00 -0500"
--EXPECTF--
string(%d) "%s, 01 Jan 2922770265 00:00:00 -0500"
OK
+7 -7
View File
@@ -4,7 +4,7 @@ Bug #48097 (date_timezone_set function produces wrong datetime result)
date.timezone=UTC
--FILE--
<?php
$d = date_create( "Mon, 23 May 1955 00:00:00 +0200" );
$d = date_create( "Sun, 22 May 1955 02:00:00 +0200" );
var_dump( $d );
echo $d->format( DATE_ISO8601 ), "\n";
echo $d->format( 'U' ), "\n\n";
@@ -16,23 +16,23 @@ echo $d->format( 'U' ), "\n\n";
--EXPECT--
object(DateTime)#1 (3) {
["date"]=>
string(26) "1955-05-23 00:00:00.000000"
string(26) "1955-05-22 02:00:00.000000"
["timezone_type"]=>
int(1)
["timezone"]=>
string(6) "+02:00"
}
1955-05-23T00:00:00+0200
-461124000
1955-05-22T02:00:00+0200
-461203200
object(DateTime)#1 (3) {
["date"]=>
string(26) "1955-05-22 23:00:00.000000"
string(26) "1955-05-22 01:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(15) "Europe/Budapest"
}
1955-05-22T23:00:00+0100
1955-05-22T01:00:00+0100
-461124000
-461203200
@@ -0,0 +1,24 @@
--TEST--
Test for setting Date/Time during a forward DST transition
--FILE--
<?php
date_default_timezone_set('America/Chicago');
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(2, 0)->format('Y-m-d H:i:s T/e - U') . "\n";
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(2, 30)->format('Y-m-d H:i:s T/e - U') . "\n";
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(3, 0)->format('Y-m-d H:i:s T/e - U') . "\n";
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(1, 59, 59)->format('Y-m-d H:i:s T/e - U') . "\n";
?>
--EXPECT--
2020-03-08 03:00:00 CDT/America/Chicago - 1583654400
2020-03-08 03:30:00 CDT/America/Chicago - 1583656200
2020-03-08 03:00:00 CDT/America/Chicago - 1583654400
2020-03-08 01:59:59 CST/America/Chicago - 1583654399
+1 -2
View File
@@ -339,7 +339,7 @@ int dom_document_encoding_write(dom_object *obj, zval *newval)
str = zval_get_string(newval);
handler = xmlFindCharEncodingHandler(Z_STRVAL_P(newval));
handler = xmlFindCharEncodingHandler(ZSTR_VAL(str));
if (handler != NULL) {
xmlCharEncCloseFunc(handler);
@@ -2024,7 +2024,6 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */
}
ctxt = htmlCreateFileParserCtxt(source, NULL);
} else {
source_len = xmlStrlen((xmlChar *) source);
if (ZEND_SIZE_T_INT_OVFL(source_len)) {
php_error_docref(NULL, E_WARNING, "Input string is too long");
RETURN_FALSE;
+3 -7
View File
@@ -428,13 +428,9 @@ int dom_node_child_nodes_read(dom_object *obj, zval *retval)
return FAILURE;
}
if (dom_node_children_valid(nodep) == FAILURE) {
ZVAL_NULL(retval);
} else {
php_dom_create_interator(retval, DOM_NODELIST);
intern = Z_DOMOBJ_P(retval);
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
}
php_dom_create_interator(retval, DOM_NODELIST);
intern = Z_DOMOBJ_P(retval);
dom_namednode_iter(obj, XML_ELEMENT_NODE, intern, NULL, NULL, NULL);
return SUCCESS;
}
+15
View File
@@ -1358,6 +1358,14 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *l
/* }}} */
/* }}} end dom_element_get_elements_by_tag_name_ns_raw */
static inline zend_bool is_empty_node(xmlNodePtr nodep)
{
xmlChar *strContent = xmlNodeGetContent(nodep);
zend_bool ret = strContent == NULL || *strContent == '\0';
xmlFree(strContent);
return ret;
}
/* {{{ void dom_normalize (xmlNodePtr nodep) */
void dom_normalize (xmlNodePtr nodep)
{
@@ -1383,6 +1391,13 @@ void dom_normalize (xmlNodePtr nodep)
break;
}
}
if (is_empty_node(child)) {
nextp = child->next;
xmlUnlinkNode(child);
php_libxml_node_free_resource(child);
child = nextp;
continue;
}
break;
case XML_ELEMENT_NODE:
dom_normalize (child);
+2 -2
View File
@@ -50,7 +50,7 @@ object(DOMText)#%d (19) {
["parentNode"]=>
NULL
["childNodes"]=>
NULL
string(22) "(object value omitted)"
["firstChild"]=>
NULL
["lastChild"]=>
@@ -140,7 +140,7 @@ object(DOMText)#%d (19) {
["parentNode"]=>
NULL
["childNodes"]=>
NULL
string(22) "(object value omitted)"
["firstChild"]=>
NULL
["lastChild"]=>
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #77569 (Write Access Violation in DomImplementation)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die('skip dom extension not available');
?>
--FILE--
<?php
$imp = new DOMImplementation;
$dom = $imp->createDocument("", "");
$dom->encoding = null;
?>
--EXPECTF--
Warning: main(): Invalid Document Encoding in %s on line %d
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #78221 (DOMNode::normalize() doesn't remove empty text nodes)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die('skip dom extension not available');
?>
--FILE--
<?php
$doc = new DOMDocument();
$doc->loadHTML('<p id=x>foo</p>');
$p = $doc->getElementById('x');
$p->childNodes[0]->textContent = '';
$p->normalize();
var_dump($p->childNodes->length);
?>
--EXPECT--
int(0)
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #79271 (DOMDocumentType::$childNodes is NULL)
--SKIPIF--
<?php
if (!extension_loaded('dom')) die('skip dom extension not available');
?>
--FILE--
<?php
$dom = new DOMImplementation();
$type = $dom->createDocumentType('html');
var_dump($type->childNodes);
?>
--EXPECTF--
object(DOMNodeList)#%d (1) {
["length"]=>
int(0)
}
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #80268 (loadHTML() truncates at NUL bytes)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$doc = new DOMDocument;
$doc->loadHTML("<p>foo\0bar</p>");
$html = $doc->saveHTML();
var_dump(strpos($html, '<p>foo</p>') !== false);
file_put_contents(__DIR__ . '/80268.html', "<p>foo\0bar</p>");
$doc = new DOMDocument;
$doc->loadHTMLFile(__DIR__ . '/80268.html');
$html = $doc->saveHTML();
var_dump(strpos($html, '<p>foo</p>') !== false);
?>
--CLEAN--
<?php
unlink(__DIR__ . '/80268.html');
?>
--EXPECT--
bool(true)
bool(true)
+6 -10
View File
@@ -723,18 +723,16 @@ PHP_FUNCTION(enchant_dict_quick_check)
PHP_ENCHANT_GET_DICT;
if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
int n_sugg;
size_t n_sugg_st;
size_t n_sugg;
char **suggs;
if (!sugg && ZEND_NUM_ARGS() == 2) {
RETURN_FALSE;
}
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
if (suggs && n_sugg) {
int i;
size_t i;
for (i = 0; i < n_sugg; i++) {
add_next_index_string(sugg, suggs[i]);
}
@@ -776,8 +774,7 @@ PHP_FUNCTION(enchant_dict_suggest)
size_t wordlen;
char **suggs;
enchant_dict *pdict;
int n_sugg;
size_t n_sugg_st;
size_t n_sugg;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &dict, &word, &wordlen) == FAILURE) {
RETURN_FALSE;
@@ -785,10 +782,9 @@ PHP_FUNCTION(enchant_dict_suggest)
PHP_ENCHANT_GET_DICT;
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg);
if (suggs && n_sugg) {
int i;
size_t i;
array_init(return_value);
for (i = 0; i < n_sugg; i++) {
+64 -27
View File
@@ -66,7 +66,8 @@ typedef unsigned char uchar;
#define EFREE_IF(ptr) if (ptr) efree(ptr)
#define MAX_IFD_NESTING_LEVEL 150
#define MAX_IFD_NESTING_LEVEL 10
#define MAX_IFD_TAGS 1000
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0)
@@ -1940,6 +1941,7 @@ typedef struct {
int read_thumbnail;
int read_all;
int ifd_nesting_level;
int ifd_count;
/* internal */
file_section_list file;
} image_info_type;
@@ -2674,6 +2676,7 @@ static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result)
/* forward declarations */
static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag);
static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table);
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index);
/* {{{ exif_get_markername
Get name of marker */
@@ -3147,7 +3150,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
if (value_len < 2 || maker_note->offset >= value_len - 1) {
/* Do not go past the value end */
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short: 0x%04X offset 0x%04X", value_len, maker_note->offset);
return FALSE;
return TRUE;
}
dir_start = value_ptr + maker_note->offset;
@@ -3173,6 +3176,23 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
/* It can be that motorola_intel is wrongly mapped, let's try inverting it */
if ((2+NumDirEntries*12) > value_len) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Potentially invalid endianess, trying again with different endianness before imminent failure.");
ImageInfo->motorola_intel = ImageInfo->motorola_intel == 0 ? 1 : 0;
NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel);
}
if ((2+NumDirEntries*12) > value_len) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
return FALSE;
}
if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len);
return FALSE;
}
switch (maker_note->offset_mode) {
case MN_OFFSET_MAKER:
offset_base = value_ptr;
@@ -3203,15 +3223,6 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
break;
}
if ((2+NumDirEntries*12) > value_len) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + 0x%04X*12 = 0x%04X > 0x%04X", NumDirEntries, 2+NumDirEntries*12, value_len);
return FALSE;
}
if ((dir_start - value_ptr) > value_len - (2+NumDirEntries*12)) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 0x%04X > 0x%04X", (dir_start - value_ptr) + (2+NumDirEntries*12), value_len);
return FALSE;
}
for (de=0;de<NumDirEntries;de++) {
size_t offset = 2 + 12 * de;
if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset,
@@ -3238,7 +3249,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
/* {{{ exif_process_IFD_TAG
* Process one of the nested IFDs directories. */
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
static int exif_process_IFD_TAG_impl(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
{
size_t length;
unsigned int tag, format, components;
@@ -3251,13 +3262,6 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
int dump_free;
#endif /* EXIF_DEBUG */
/* Protect against corrupt headers */
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached");
return FALSE;
}
ImageInfo->ifd_nesting_level++;
tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel);
format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel);
components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);
@@ -3577,6 +3581,24 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha
}
/* }}} */
static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table)
{
int result;
/* Protect against corrupt headers */
if (ImageInfo->ifd_count++ > MAX_IFD_TAGS) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum IFD tag count reached");
return FALSE;
}
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached");
return FALSE;
}
ImageInfo->ifd_nesting_level++;
result = exif_process_IFD_TAG_impl(ImageInfo, dir_entry, offset_base, IFDlength, displacement, section_index, ReadNextIFD, tag_table);
ImageInfo->ifd_nesting_level--;
return result;
}
/* {{{ exif_process_IFD_in_JPEG
* Process one of the nested IFDs directories. */
static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int tag)
@@ -3665,6 +3687,11 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
{
unsigned exif_value_2a, offset_of_ifd;
if (length < 2) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Missing TIFF alignment marker");
return;
}
/* set the thumbnail stuff to nothing so we can test to see if they get set up */
if (memcmp(CharBuf, "II", 2) == 0) {
ImageInfo->motorola_intel = 0;
@@ -3817,7 +3844,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo)
return FALSE;
}
sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL);
sn = exif_file_sections_add(ImageInfo, marker, itemlen, NULL);
Data = ImageInfo->file.list[sn].data;
/* Store first two pre-read bytes. */
@@ -4005,7 +4032,7 @@ static int exif_scan_thumbnail(image_info_type *ImageInfo)
/* {{{ exif_process_IFD_in_TIFF
* Parse the TIFF header; */
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index)
static int exif_process_IFD_in_TIFF_impl(image_info_type *ImageInfo, size_t dir_offset, int section_index)
{
int i, sn, num_entries, sub_section_index = 0;
unsigned char *dir_entry;
@@ -4014,10 +4041,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
int entry_tag , entry_type;
tag_table_type tag_table = exif_get_tag_table(section_index);
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
return FALSE;
}
if (ImageInfo->FileSize >= 2 && ImageInfo->FileSize - 2 >= dir_offset) {
sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL);
#ifdef EXIF_DEBUG
@@ -4161,7 +4184,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Next IFD: %s @x%04X", exif_get_sectionname(sub_section_index), entry_offset);
#endif
ImageInfo->ifd_nesting_level++;
exif_process_IFD_in_TIFF(ImageInfo, entry_offset, sub_section_index);
if (section_index!=SECTION_THUMBNAIL && entry_tag==TAG_SUB_IFD) {
if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN
@@ -4205,7 +4227,6 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) at x%04X", next_offset);
#endif
ImageInfo->ifd_nesting_level++;
exif_process_IFD_in_TIFF(ImageInfo, next_offset, SECTION_THUMBNAIL);
#ifdef EXIF_DEBUG
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size);
@@ -4242,6 +4263,21 @@ static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offse
}
/* }}} */
static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index)
{
int result;
if (ImageInfo->ifd_count++ > MAX_IFD_TAGS) {
return FALSE;
}
if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) {
return FALSE;
}
ImageInfo->ifd_nesting_level++;
result = exif_process_IFD_in_TIFF_impl(ImageInfo, dir_offset, section_index);
ImageInfo->ifd_nesting_level--;
return result;
}
/* {{{ exif_scan_FILE_header
* Parse the marker stream until SOS or EOI is seen; */
static int exif_scan_FILE_header(image_info_type *ImageInfo)
@@ -4397,6 +4433,7 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
ImageInfo->ifd_nesting_level = 0;
ImageInfo->ifd_count = 0;
/* Scan the headers */
ret = exif_scan_FILE_header(ImageInfo);
Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #75785 fix corrupt EXIF header issues; Related to mixed endianness. (Thank you @Richard Matzinger for providing the test photo)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$mixedEndiannessFile = dirname(__FILE__).'/P1000506.JPG';
$tags = exif_read_data($mixedEndiannessFile, 'EXIF', true, false);
echo $tags['GPS']['GPSLatitude'][0] . PHP_EOL;
echo $tags['GPS']['GPSLongitude'][0] . PHP_EOL;
?>
===DONE===
--EXPECTF--
38/1
122/1
===DONE===
+2
View File
@@ -10,6 +10,8 @@ DONE
--EXPECTF--
Warning: exif_thumbnail(bug77563.jpg): IFD data too short: 0x0009 offset 0x0008 in %s%ebug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): Illegal IFD offset in %s%ebug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): File structure corrupted in %s%ebug77563.php on line %d
Warning: exif_thumbnail(bug77563.jpg): Invalid JPEG file in %s%ebug77563.php on line %d
+29 -2
View File
@@ -13,5 +13,32 @@ Warning: exif_read_data(): Process tag(x927C=MakerNote ): Illegal format code 0
Warning: exif_read_data(): IFD data too short: 0x0000 offset 0x000C in %s on line %d
Warning: exif_read_data(): Invalid TIFF file in %s on line %d
bool(false)
Warning: exif_read_data(): Error in TIFF: filesize(x002A) less than start of IFD dir(x46494C4F) in %s on line %d
array(8) {
["FileDateTime"]=>
int(0)
["FileSize"]=>
int(42)
["FileType"]=>
int(8)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(13) "ANY_TAG, IFD0"
["COMPUTED"]=>
array(2) {
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(1)
}
["Make"]=>
array(2) {
[0]=>
int(1179994697)
[1]=>
int(1179208781)
}
["MakerNote"]=>
NULL
}
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #79282: Use-of-uninitialized-value in exif
--FILE--
<?php
var_dump(exif_read_data('data://image/jpeg;base64,/9jhAAlFeGlmAAAg'));
?>
--EXPECTF--
Warning: exif_read_data(): Missing TIFF alignment marker in %s on line %d
Warning: exif_read_data(): File structure corrupted in %s on line %d
Warning: exif_read_data(): Invalid JPEG file in %s on line %d
bool(false)
+10
View File
@@ -0,0 +1,10 @@
--TEST--
Should not cause OOM
--FILE--
<?php
var_dump(@exif_read_data(__DIR__ . '/nesting_level_oom.tiff'));
?>
--EXPECT--
bool(false)
Loaded 100 of 367 files, more files were not shown because too many files have changed in this diff. Show more