Compare commits

...
268 Commits
Author SHA1 Message Date
Derick Rethans 264ef4f163 Update versions for PHP 7.4.2 2020-01-21 11:35:15 +00:00
Derick Rethans 56de1e6c53 Update NEWS 2020-01-21 11:33:51 +00:00
Derick Rethans 4c2254b076 Update NEWS for PHP 7.4.2 2020-01-21 10:13:25 +00:00
Derick Rethans b5efe15d58 Remove RC1 header 2020-01-21 10:11:52 +00:00
Stanislav Malyshev bea47b794f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
  Fix bug #79037 (global buffer-overflow in `mbfl_filt_conv_big5_wchar`)
  Fix #79099: OOB read in php_strip_tags_ex
  Fix #79091: heap use-after-free in session_create_id()
2020-01-21 10:10:02 +00:00
Derick Rethans c497becad4 Fixed release line in NEWS 2020-01-07 11:17:01 +00:00
Derick Rethans 452c7d82c6 Update NEWS for 7.4.3 2020-01-07 08:30:57 +00:00
Derick Rethans 75a5a08161 Update NEWS for PHP 7.4.2RC1 2020-01-07 08:29:39 +00:00
Nikita Popov 59c3ddab13 Remove support for preloading on Windows
Due to ASLR restrictions, preloading on Windows does not work with
any code that has preloading dependencies on internal classes.
This effectively makes it unusable for any non-trivial codebase.

Instead of pretending like preloading is going to work, only to
make people realize that it really doesn't once they get beyond
a dummy example, we disable support for preloading on Windows
entirely.

Closes GH-4999.
2020-01-06 22:41:55 +01:00
Nikita Popov 846b647953 Throw Error when referencing uninit typed prop in __sleep
Previously this generated a notice, but would likely generate an
Error when unserializing.

Now we treat it with the same distinction as direct property
accesses, i.e. referencing an unset/undefined normal property
stays a notice, while a typed property becomes an Error exception.

This fixed bug #79002.

Closes GH-5050.
2020-01-06 18:47:27 +01:00
Christoph M. Becker 56306cc4af [ci skip] Merge branch 'PHP-7.3' into PHP-7.4
Empty merge.
2020-01-06 15:33:42 +01:00
Christoph M. Becker 06e78cad83 Revert "Extend CURLFile to support streams"
This reverts commit 17a9f1401a, because
this commit would break ABI, and also due to bug #79013.
We keep the commit for PHP 7.4+, though.
2020-01-06 15:31:49 +01:00
Christoph M. Becker 09ebeba1af Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #54298: Using empty additional_headers adding extraneous CRLF
2020-01-06 14:48:46 +01:00
Christoph M. Becker ae2150692a Fix #54298: Using empty additional_headers adding extraneous CRLF
If the header string is empty, we pass `NULL` to `php_mail()` to avoid
further checks on the string length.
2020-01-06 14:47:23 +01:00
Nikita Popov 68f6ab7113 Don't link against openssl 1.1 in curl
OpenSSL 1.1 does not need crypto locking callbacks, so avoid
detecting and linking against it in the first place.
2020-01-06 10:42:57 +01:00
Christoph M. Becker 74b11e3315 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79068: gdTransformAffineCopy() changes interpolation method
2020-01-06 10:38:22 +01:00
Christoph M. Becker 4bec59f175 Fix #79068: gdTransformAffineCopy() changes interpolation method
We port
<https://github.com/libgd/libgd/commit/9088591eae437358ee5b929adf82865e37e3001e>.
2020-01-06 10:36:48 +01:00
Nikita Popov b59f760472 Fix bug #79063: Curl openssl does not respect PKG_CONFIG_PATH 2020-01-06 10:31:22 +01:00
Nikita Popov 2d29904f25 Clean up curl openssl check
Only set HAVE_CURL_OPENSSL flag, and remove Windows specific code,
as all of this is only relevant for OpenSSL < 1.1, which is not
used on Windows.
2020-01-06 10:17:37 +01:00
Christoph M. Becker f799f42ec8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79067: gdTransformAffineCopy() may use unitialized values
2020-01-06 09:37:40 +01:00
Christoph M. Becker 2c5860517c Fix #79067: gdTransformAffineCopy() may use unitialized values
We port
<https://github.com/libgd/libgd/commit/7a06c1669c563917bc48c464521e3de962ddb4e8>.
2020-01-06 09:35:13 +01:00
Christoph M. Becker f4aa0869ac Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78808: [LMDB] MDB_MAP_FULL: Environment mapsize limit reached
2020-01-03 18:51:07 +01:00
Christoph M. Becker c05a069adf Fix #78808: [LMDB] MDB_MAP_FULL: Environment mapsize limit reached
We implement support for a fifth parameter, which allows to specify the
mapsize.  The parameter defaults to zero, in which case the compiled in
default mapsize (usually 1048576) will be used.  The mapsize should be
a multiple of the page size of the OS.
2020-01-03 18:49:12 +01:00
Christoph M. Becker 4c6ad099c6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78538: shmop memory leak
2020-01-03 18:13:04 +01:00
Christoph M. Becker 18172303f4 Fix #78538: shmop memory leak
If the descriptor's refcount drops to zero, we have to unmap the
respective file view, to avoid leaking memory.
2020-01-03 18:10:29 +01:00
Nikita Popov 7f02b5fc47 Slightly increase tolerance in time_sleep_until() test
With the 1ms tolerance this still occasionally fails on macos.
I love macos. It always works and causes no problems at all.
2020-01-03 16:49:15 +01:00
Christoph M. Becker fc6e83e01a Try to fix intermittently failing test case
This test fails intermittently due to taskill reporting failure to kill
the process (because it already has been terminated).  We increase the
sleep time, to hopefully prevent that from happening again.
2020-01-03 16:44:53 +01:00
Christoph M. Becker 40b2f82380 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79015: undefined-behavior in php_date.c
2020-01-03 14:32:30 +01:00
Christoph M. Becker b48f2625b5 Fix #79015: undefined-behavior in php_date.c
We check that the given microsecond fraction is in the valid range
[0, 1000000[, and otherwise mark it as invalid.  We also drop the
useless do loop; a plain block is sufficient here.
2020-01-03 14:31:03 +01:00
Nikita Popov 3e5675d730 Remove unnecessary strncpy in zip
This causes a warning on GCC 9 and is unnecessary to boot: We
only use "cwd" for the open_basedir check, so we can just as well
pass in the original string.
2020-01-03 11:53:03 +01:00
Nikita Popov 6f63e05320 Add test for bug #73816
This has been fixed by 0f2cdbf214,
add the test case.
2020-01-03 11:26:31 +01:00
Nikita Popov 3c2fcb717d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #71876
2020-01-03 11:16:14 +01:00
Nikita Popov 1f9e93687c Fixed bug #71876
This is a backport of fcdc0a6db0
to the PHP-7.3 branch. We need to make sure that OnUpdateString
is also called for a NULL value, otherwise the reset of the encoding
at the end of the request will not work.
2020-01-03 11:14:45 +01:00
Nikita Popov 1dcdcd79ba Fixed bug #79056 2020-01-03 11:08:48 +01:00
Christoph M. Becker c39b45df72 Add test case for bug #78883
The original test has been provided by divinity76.
2020-01-02 19:28:10 +01:00
Nikita Popov 8abb2ced39 Fixed bug #79055
Fix file cache serialization of property types. I'm changing the
overall type serialization format to perform additional adjustments
in order to yield a plausible pointer for zend_type, rather than
using an entirely separate serialization format, as was previously
done. That would have been annoying to extend to the case of CE
pointers.
2020-01-02 15:53:15 +01:00
Nikita Popov 48622970fb Extract functions for file cache type serialization
This is already done in master.
2020-01-02 15:16:24 +01:00
Nikita Popov 36d5fbbd6b Fix file cache run_time_cache unserialization
If the script was serialized as file_cache_only (thus non-immutable)
and then gets unserialized into SHM, we need to allocate a new
run_time_cache slot and can't use the serialized arena pointer.
2020-01-02 14:56:39 +01:00
Nikita Popov e576d342bb Update ZCSG(map_ptr_last) only if for_shm
Otherwise we may get a memory protection fault here. Updating of
ZCSG(map_ptr_last) is handled when loading from file cache to SHM.
2020-01-02 11:59:36 +01:00
Nikita Popov 90fea67546 Populate hashtable of __sleep() properties
Instead of populating a hashtable of property names and then
directly serializing.

This has the advantage of a) detecting duplicate properties more
precisely and b) gives us the ability to discard values without
rewriting the serialization string after the fact for GH-5027.
2020-01-02 11:14:01 +01:00
Nikita Popov de0ca4734e Deref names returned by __sleep() 2020-01-02 11:14:00 +01:00
Nikita Popov 701e8c66d1 Extract php_var_serialize_nested_data() function
And split code-paths for arrays and objects based on it.
2020-01-02 11:14:00 +01:00
Christoph M. Becker 8d2b20db58 [ci skip] Revert "Add test case for bug #78883"
This reverts commit 09e76cbe6d, because
the test fails reliably on AppVeyor.  This needs closer investigation.
2019-12-31 14:27:16 +01:00
Christoph M. Becker 09e76cbe6d Add test case for bug #78883
The actual test has been provided by divinity76.
2019-12-31 13:09:27 +01:00
Christoph M. Becker 4f0e5c8dd9 Remove superfluous compiler option
`-fsanitize-address-use-after-scope` is the default as of clang 5.0.0,
and we don't allow to enable ASan for older versions anyway.
2019-12-31 12:00:10 +01:00
Nikita Popov 22e9f9fe4d Also propagate include exceptions in opcache 2019-12-30 23:22:26 +01:00
Nikita Popov 003be875e4 Make url_stats in resolve_path quiet
These stats are used to check whether the file exists -- they
should not generate errors. Having the flag set is particularly
important for custom stream wrappers.
2019-12-30 23:22:26 +01:00
Christoph M. Becker 98df5c97f4 Avoid undefined behavior 2019-12-30 23:17:39 +01:00
Nikita Popov f77747b06c Properly propagate url_stat exceptions during include
Make sure we abort operations early, and that we don't emit
additional warnings or errors if an exception has been thrown.
2019-12-30 22:56:42 +01:00
Nikita Popov d1537e506e Fixed bug #79046 2019-12-30 17:23:53 +01:00
Christoph M. Becker 94063619a0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79040: Warning Opcode handlers are unusable due to ASLR
2019-12-30 15:17:41 +01:00
Christoph M. Becker 0cecf83b26 Fix #79040: Warning Opcode handlers are unusable due to ASLR
We must not use the same shared memory OPcache instance for different
SAPIs, since their memory layout is different.  To avoid this, we add
the SAPI name (truncated to at most 20 characters) to the names of the
memory base file, the mutex and the file mapping.
2019-12-30 15:12:58 +01:00
Nikita Popov fcaf7cbd64 Add test for bug #79031
Fixed by preceding revert.
2019-12-30 11:31:27 +01:00
Nikita Popov ed3811e781 Revert "Increase serialize_lock while decoding session"
This reverts commit b8ef7c35ab.

See bug #79031. The semantics of serialize locking aren't quite
correct right now, and the use of the lock in this particular
place makes us hit the issue in a common case. I'm reverting this
commit for PHP 7.4 and will try to fix this properly for PHP 8,
as I believe it will require ABI breakage.
2019-12-30 11:27:13 +01:00
Christoph M. Becker 935a61d034 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing skipif clause
2019-12-28 11:01:22 +01:00
Christoph M. Becker 1aa419dcdc Add missing skipif clause 2019-12-28 11:00:37 +01:00
Christoph M. Becker 6d1dff6f3d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79033: Curl timeout error with specific url and post
2019-12-28 10:48:59 +01:00
Christoph M. Becker c47b18a222 Fix #79033: Curl timeout error with specific url and post
We must not set an empty mime structure as `CURLOPT_MIMEPOST`; instead
we set it to `NULL` if `CURLOPT_POSTFIELDS` has been set to an empty
array.
2019-12-28 10:47:03 +01:00
Nikita Popov 32cd373dfd Handle empty password fast path in caching_sha2_password
If an empty password is used, no additional packets are exchanged
during caching_sha2_password auth. We're only looking for an
OK/ERR response.
2019-12-27 17:27:45 +01:00
Nikita Popov 813d4a00b4 Handle error response during caching_sha2_password auth
In particular, this fixes handling of expired passwords.
2019-12-27 17:27:45 +01:00
Nikita Popov e7e1254f3e Add support for caching_sha2_password in change user authentication
Same as for connection handshakes.
2019-12-27 17:27:45 +01:00
Nikita Popov 03ee36d1c5 Fix unix socket check during caching_sha2_password
The fact that conn->unix_socket is set does not mean that a Unix
socket is actually in use -- this member is set in a default
configuration.

Instead check whether a unix_socket stream ops is used.
2019-12-27 17:27:41 +01:00
Nikita Popov 6225137b4a Support auth switch request during caching sha2 auth 2019-12-27 17:27:04 +01:00
Nikita Popov b0efd18f78 Don't use PASSWORD() function in test
Doesn't exist anymore in MySQL 8.
2019-12-27 17:26:15 +01:00
Nikita Popov 248c783e7d Specify explicit row order in PDO MySQL test 2019-12-27 17:25:58 +01:00
Nikita Popov 23d4659635 Skip bug77956.phpt if local_infile disabled on server 2019-12-27 17:25:53 +01:00
Nikita Popov 6572d9149d Don't check TIMESTAMP NOT NULL in fetch_field_flags test
The behavior of this is very dependent on the MySQL vendor, MySQL
version and MySQL configuration, in particular the
explicit_defaults_for_timestamp variable.

I don't think it's worthwhile to try and model this exactly, so
drop the test.
2019-12-27 17:25:23 +01:00
Nikita Popov c4cbdfa99c Don't test the RENAME DATABASE query
Apparently this only existed for a short time, because it was
found to be insecure. Don't try to test it.
2019-12-27 17:25:12 +01:00
Nikita Popov f97806726f Make GeomFromText tests compatible with MySQL 8
The function has been renamed to ST_GeomFromText.
2019-12-27 17:25:01 +01:00
Christoph M. Becker 58cc66e175 Skip test for clang builds
On Windows, clang builds don't use __vectorcall, so executing this test
does not make sense.
2019-12-27 15:09:19 +01:00
Christoph M. Becker 1b0a79ab3f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter).
2019-12-25 12:35:44 +01:00
Xinchen Hui 27bb3289ac Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter).
We backport the fix PHP 7.3, since this branch is affected as well.

(cherry picked from commit b5e0043796)
(cherry picked from commit e36daa6927)
(cherry picked from commit 2704ee6844)
2019-12-25 12:33:30 +01:00
Christoph M. Becker 2704ee6844 Fix test case
As of PHP 7.3.0, unlinking files with open handles is possible on
Windows, but these file entries are still blocked until all open
handles are closed.  Since this test doesn't require to write to the
same file, we use three separate files.

We also add the missing skip check for XMLReader.
2019-12-25 12:07:54 +01:00
Xinchen Hui e36daa6927 Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). 2019-12-25 15:55:15 +08:00
Xinchen Hui 4c6e170c57 Revert "Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter)"
This reverts commit d8ad2f4695.
2019-12-25 15:27:10 +08:00
Xinchen Hui d8ad2f4695 Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter) 2019-12-25 13:14:08 +08:00
Xinchen Hui b5e0043796 Partial fix for bug #79029 2019-12-25 12:43:44 +08:00
Xinchen Hui f09b958e90 Similar problem (#79022) also exists in Interfaces 2019-12-24 14:20:55 +08:00
Xinchen Hui 153c9cc346 Fixed bug #79022 (class_exists returns True for classes that are not ready to be used) 2019-12-24 14:04:19 +08:00
Nikita Popov b829ea5f74 Fix leak when generator closed during yield in finally
In this case we need to free any pending exceptions or return values
that will be discarded.
2019-12-20 17:46:31 +01:00
Christoph M. Becker 6ec4056928 Fix #79008: General performance regression with PHP 7.4 on Windows
We no longer try to retrieve the filename of a given stream when
fstat'ing, because this is very slow.  Since we neither didn't do that
in PHP 7.3 and earlier, we regard this as sensible trade-off.
2019-12-20 16:28:11 +01:00
Nikita Popov d5c55f81ec Try to make proc_open_bug69900.phpt more robust 2019-12-20 13:51:31 +01:00
Nikita Popov b0737fa35e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78982: pdo_pgsql returns dead persistent connection
2019-12-20 12:06:05 +01:00
SATO Kentaro 37d11d123e Fix #78982: pdo_pgsql returns dead persistent connection
Call PQconsumeInput() before PQstatus() to update the status.
2019-12-20 12:05:17 +01:00
Nikita Popov f974f252dd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78980: pgsqlGetNotify() overlooks dead connection
2019-12-20 11:45:16 +01:00
SATO Kentaro 7e39e6934d Fix #78980: pgsqlGetNotify() overlooks dead connection
pgsqlGetNotify() didn't check result of PQconsumeInput().
2019-12-20 11:44:07 +01:00
Nikita Popov 10eb0b3110 Fixed bug #79000
Don't report EAGAIN/EWOULDBLOCK as errors for fwrite on
non-blocking socket streams. This matches behavior for fread,
as well as behavior for plain file streams.

Closes GH-5026.
2019-12-20 11:37:43 +01:00
Nikita Popov d4ba1fd963 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #74170: locale information change after mime_content_type
2019-12-20 11:24:03 +01:00
Sergei Turchanov c62cd9a43a Fix #74170: locale information change after mime_content_type
Some functions in libmagic (distributed with fileinfo extension) perform this sequence of calls:
func() {
setlocale(LC_TYPE, "C")
.. do some work ..
setlocale(LC_TYPE, "")
}

It effectively resets LC_TYPE if it that was set before the function call.

To avoid manipulations with current locale at all, the problematic functions
were modified to use locale-independent functions.
2019-12-20 11:22:59 +01:00
Nikita Popov 5155097431 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78402: pcntl_signal() misleading error message
2019-12-20 11:02:57 +01:00
SATO Kentaro cbb0efaeeb Fix #78402: pcntl_signal() misleading error message
An error message can be misleading when a handler
passed to pcntl_signal() is not callable.
2019-12-20 11:02:20 +01:00
Nikita Popov 885b3451f4 Fix early free of assign_obj op_data
We need to make sure that op_data is only freed after populating
result, as op_data may be the only thing holding the value in the
case of an overloaded assignment.

This reverts the code to how it looked like in 7.3.
2019-12-20 10:35:34 +01:00
Dmitry Stogov 66d5b0608a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78999 (Cycle leak when using function result as temporary)
2019-12-19 23:17:39 +03:00
Dmitry Stogov eb846939b1 Fixed bug #78999 (Cycle leak when using function result as temporary) 2019-12-19 23:11:08 +03:00
Christoph M. Becker 7e05f97fa6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78983: pdo_pgsql config.w32 cannot find libpq-fe.h
2019-12-19 13:21:23 +01:00
SATO Kentaro 3e35b08980 Fix #78983: pdo_pgsql config.w32 cannot find libpq-fe.h
When configured with a path specified.
2019-12-19 13:20:43 +01:00
Nikita Popov 527ad1d80c Avoid signed integer overflow in string offset check
Cast to size_t before performing operations instead of afterwards.
2019-12-19 11:47:50 +01:00
Nikita Popov e4b12fc62a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add destructor annotations in ini parser
2019-12-19 10:43:14 +01:00
Nikita Popov 0f078f6e78 Add destructor annotations in ini parser
It would be better to switch this to use %union and %type annotations,
but not going to do that change for 7.3.
2019-12-19 10:43:05 +01:00
Nikita Popov df08d6bffe Fix leak in assign_ref with function
As far as I can see, the retval copying is already done in all
callers of this function, so it should not be duplicated here.
2019-12-18 17:18:10 +01:00
Nikita Popov 4a61d842e7 Fixed bug #78776
By using the normal inheritance check if the parent is abstract
as well.
2019-12-18 15:55:45 +01:00
Remi Collet 76eb30ded3 fix release date 2019-12-18 14:18:03 +01:00
Remi Collet e5e1425a05 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  fix release date
  fix release date
2019-12-18 14:17:49 +01:00
Remi Collet bacfae8baf fix release date 2019-12-18 14:17:31 +01:00
Remi Collet 22dec2b323 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  fix release date
2019-12-18 14:17:21 +01:00
Remi Collet 864f5ef12f fix release date 2019-12-18 14:16:19 +01:00
Nikita Popov bd4fce4f6f Fixed bug #78986
Don't assume that handlers live in the arena, they may also be in
SHM.
2019-12-18 11:40:58 +01:00
Fabien Villepinte 203308f6c3 Add CONFLICTS tag
These tests can be the reason file_get_contents_variation8.phpt fails times to times.
2019-12-18 11:08:24 +01:00
Nikita Popov bfb38c3592 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Rethrow generator exception even without active stack frame
2019-12-18 11:04:46 +01:00
Nikita Popov 897d99c7a4 Rethrow generator exception even without active stack frame
Finally blocks in generators may be invoked during shutdown, in
which case we don't have a stack frame. Similar to what
zend_call_function does, we still need to rethrow these exceptions,
otherwise they will be hidden (and leak).
2019-12-18 11:04:15 +01:00
Nikita Popov b965f158ac Fix use-after-free when trying to write to closure property 2019-12-18 10:24:02 +01:00
Nikita Popov ee89e73312 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix freeing of dynamic call name
2019-12-18 10:11:23 +01:00
Nikita Popov 189f625e2b Fix freeing of dynamic call name
We need to free op2 if the call construction fails.

Also remove a redundant check for !call.
2019-12-18 10:11:09 +01:00
Nikita Popov 0301ab70b3 Fix const/cv freeing on failed reference assignment 2019-12-18 09:54:10 +01:00
Christoph M. Becker 9458f7e2d8 More updates to CONTRIBUTING.md
7.4 is stable.
2019-12-17 20:01:18 +01:00
Christoph M. Becker 250416ccb1 Update CONTRIBUTING.md
7.1 is EOL; 7.2 is security fixes only.
2019-12-17 19:57:49 +01:00
Christoph M. Becker 4cd6d384bd Fix #78976: SplFileObject::fputcsv returns -1 on failure
`php_stream_write()` returns `-1` on failure now, which has to be
catered to by `SplFileObject::fputcsv()` which still is supposed to
return `false` on failure.
2019-12-17 17:52:18 +01:00
Nikita Popov e45b613950 Free buffer in php_verror even if it is empty
vspprintf allocates a buffer even if the resulting string is empty.
2019-12-17 16:46:52 +01:00
Nikita Popov fcdc0a6db0 Fix resetting of internal_encoding and friends
We need to update the value even if new_value is NULL. In particular,
it should be reset back to NULL after each request if the setting was
not specified on startup. Otherwise we leave dangling pointers.
2019-12-17 16:27:56 +01:00
Nikita Popov dd997a40d0 Avoid float to int cast UB in exif 2019-12-17 13:26:05 +01:00
Christoph M. Becker ddd6e68ef9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update/fix NEWS [ci skip]
2019-12-17 10:05:18 +01:00
Christoph M. Becker 3d50131ef7 Update/fix NEWS [ci skip] 2019-12-17 10:04:42 +01:00
Christoph M. Becker 900283d25d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  [ci skip] Update NEWS
  [ci skip] Update  NEWS
  Fix test
2019-12-17 10:02:43 +01:00
Christoph M. Becker b94c28b0e6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  [ci skip] Update  NEWS
2019-12-17 10:01:50 +01:00
Stanislav Malyshev 0e413241ec [ci skip] Update NEWS 2019-12-16 23:45:11 -08:00
Stanislav Malyshev 9705e631a4 [ci skip] Update NEWS 2019-12-16 23:41:04 -08:00
Dmitry Stogov d89cd0bb22 Property names of internal classes from temporary extensins, loaded by dl(), may be emalloc-ed strings. 2019-12-17 10:10:11 +03:00
Dmitry Stogov abf05181b9 Fixed memory leak 2019-12-17 10:09:22 +03:00
Dmitry Stogov 0927af3d8d Fixed memory leaks 2019-12-17 09:58:27 +03:00
Nikita Popov 77e131da91 Set opcache.optimization_level=0 in test
Otherwise opcache "inlines" the function, which causes a minor
difference in destruction behavior.
2019-12-16 20:23:17 +01:00
Stanislav Malyshev a62154564d Fix test 2019-12-16 10:32:49 -08:00
Stanislav Malyshev d82a2f6c21 Test fixes 2019-12-16 10:31:22 -08:00
Stanislav Malyshev 6b010b5d86 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test
  Fix bug #78793
2019-12-16 10:05:02 -08:00
Stanislav Malyshev 6b9af4f5d9 Merge branch 'PHP-7.4' of git.php.net:php-src into PHP-7.4
* 'PHP-7.4' of git.php.net:php-src:
  Remove DateTime class registration test
  Fixed bug #78973
  Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS)
2019-12-16 10:04:09 -08:00
Stanislav Malyshev 5cb4686753 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix test
  Fix bug #78793
2019-12-16 10:04:03 -08:00
Stanislav Malyshev 6d5cddabaf Fix test 2019-12-16 10:03:43 -08:00
Nikita Popov 8e12f04b5e Remove DateTime class registration test
This test is more annoying than useful.
2019-12-16 18:57:19 +01:00
Nikita Popov 11b041d3c6 Fixed bug #78973
Save opline in leave helper to correctly handle destructor calls
during CV freeing (or other leave freeing).
2019-12-16 18:52:30 +01:00
Dmitry Stogov 6ef7e53c1b Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS) 2019-12-16 12:24:47 +03:00
Stanislav Malyshev c14eb8de97 Fix bug #78793 2019-12-16 01:14:58 -08:00
Stanislav Malyshev c85a877577 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix build - no model field anymore
2019-12-16 01:11:01 -08:00
Stanislav Malyshev b74a300edf Fix build - no model field anymore 2019-12-16 01:10:42 -08:00
Stanislav Malyshev d9f57e8316 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
  Fix #78943: mail() may release string with refcount==1 twice
2019-12-16 00:39:37 -08:00
Stanislav Malyshev a65b8abf2c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78910
  Fix #78878: Buffer underflow in bc_shift_addsub
  Fix test
  Fix #78862: link() silently truncates after a null byte on Windows
  Fix #78863: DirectoryIterator class silently truncates after a null byte
2019-12-16 00:38:54 -08:00
Stanislav Malyshev d348cfb96f Fixed bug #78910 2019-12-16 00:10:39 -08:00
Christoph M. Becker eb23c60087 Fix #78878: Buffer underflow in bc_shift_addsub
We must not rely on `isdigit()` to detect digits, since we only support
decimal ASCII digits in the following processing.
2019-12-16 00:05:03 -08:00
Stanislav Malyshev b771a18133 Fix test 2019-12-16 00:03:18 -08:00
Christoph M. Becker 0e6c0654ed Fix #78862: link() silently truncates after a null byte on Windows
Since link() is supposed to accepts paths (i.e. strings without NUL
bytes), we must not accept arbitrary strings.
2019-12-16 00:03:06 -08:00
Christoph M. Becker a5a15965da Fix #78863: DirectoryIterator class silently truncates after a null byte
Since the constructor of DirectoryIterator and friends is supposed to
accepts paths (i.e. strings without NUL bytes), we must not accept
arbitrary strings.
2019-12-16 00:02:57 -08:00
Christoph M. Becker 518a160b65 Fix #78943: mail() may release string with refcount==1 twice
Since we need `headers_lc` as well as `headers_trim` in the following,
we do not release the former even if they are the same string, to avoid
complicating the release logic even more.

A new test case is not necessary, since we already have
mail_basic_alt2-win32.phpt and others.
2019-12-15 13:13:30 -08:00
Nikita Popov 7e9e0937f3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78921
2019-12-13 16:38:24 +01:00
Nikita Popov 621598eaa8 Fixed bug #78921
By resetting fake_scope during autoloading. We already do the same
when executing destructors.
2019-12-13 16:37:20 +01:00
Nikita Popov 0f2cdbf214 Introduce extra counter to avoid RTD key collisions
Also generate a fatal error if a collision occurs in zend_compile.

This is not perfect, because collisions might still be introduced
via opcache, if one file is included multiple times during a request,
invalidate in the meantime and recompiled by different processes.

This still needs to be addressed, but this patch fixes the much
more common case of collisions occuring when opcache is not used.

Fixes bug #78903.
2019-12-13 11:04:44 +01:00
Kachalin Alexey 79376ab209 Fix #78929: plus signs in cookie values are converted to spaces
We switch the cookie value parsing function from `php_url_decode()` to
`php_raw_url_decode()`, so that cookie values are now parsed according
to RFC 6265, section 4.1.1.  We also refactor to remove duplicate code
without changing the execution flow.
2019-12-12 14:21:46 +01:00
Nikita Popov be89a5c7f1 Fixed bug #78950: Preloading trait method with static variables
We need to make sure that trait methods with static variables
allocate a separate MAP slot for the static variables pointer,
rather than working in-place.
2019-12-12 11:52:43 +01:00
Nikita Popov 2d03b638dc Fix handling of non-final loop var free in sccp
We only need to preserve the FE_FREE that marks the end of the
loop range. Skip FE_FREEs with the FREE_ON_RETURN flag.
2019-12-12 09:39:52 +01:00
Christoph M. Becker 86aac3eed2 uint/ulong removal may affect other platforms as well 2019-12-11 23:44:46 +01:00
Adrian Verde 2bf38aff79 Typo fix in php.ini-production
Possibe -> Possible
2019-12-11 23:15:07 +01:00
Nikita Popov 502cd7b1f1 Revert "Fixed bug #78903: Conflict in RTD key for closures results in crash"
This reverts commit b55033fa18.

This breaks ext/opcache/tests/bug65915.phpt.
2019-12-11 14:38:48 +01:00
Nikita Popov b55033fa18 Fixed bug #78903: Conflict in RTD key for closures results in crash
I wasn't able to create a simple reproducer for this. General approach
is the same as for anonymous classes: If the key is already used, reuse
the old definition.
2019-12-11 13:07:45 +01:00
Nikita Popov b6a59cee47 Free RSA public key in mysqlnd sha256 auth
Not sure why this only started showing up as a leak now.
2019-12-11 10:31:56 +01:00
Dmitry Stogov 3280209c03 Addirional fix for bug #78918 2019-12-11 12:21:49 +03:00
Dmitry Stogov 20ef51db22 Fixed bug #78937 (Preloading unlinkable anonymous class can segfault) 2019-12-11 00:46:30 +03:00
Dmitry Stogov 518a8f89c1 Fix error message 2019-12-10 22:17:10 +03:00
Derick Rethans 2badeb511b PHP-7.4 is now 7.4.2-dev 2019-12-10 16:56:33 +00:00
Nikita Popov e87dc32569 Set zend.exception_ignore_args=0 in run-tests.php
Any existing tests are going to be written under this assumption...
2019-12-10 16:15:26 +01:00
Nikita Popov 5ddcacac2e Fix incorrect zend_try usage 2019-12-10 15:22:31 +01:00
Nikita Popov d6f86caa11 Fix release build failure
GCC complained about potentially uninitialized __orig_bailout,
even though the variable has an initializer. This warning was
quite persistent, I was only able to avoid it by using a separate
function.

Am I missing something?
2019-12-10 13:51:09 +01:00
Christoph M. Becker 9e22c3d4d9 Improve error message
Formerly, the error message was like:

| Can't preload unlinked class MyException: Internal parent (Windows
| only limitation)Exception

Now it's like:

| Can't preload unlinked class MyException: Windows can't link to
| internal parent Exception
2019-12-10 13:19:58 +01:00
Nikita Popov baf3a9133b Add support for class_alias to preloading
Related to bug #78918.
2019-12-10 13:06:36 +01:00
Nikita Popov 3f86adb0ef Fixed bug #78935: Check that all linked classes can be preloaded
During preloading, check that all classes that have been included
as part of the preload script itself (rather than through opcache_compile_file)
can actually be preloaded, i.e. satisfy Windows restrictions, have
resolved initializers and resolved property types. When resolving
initializers and property types, also autoload additional classes.
Because of this, the resolution runs in a loop.
2019-12-10 13:05:48 +01:00
Nikita Popov 4313659bb9 Fix merge mistake 2019-12-10 09:03:44 +01:00
Nikita Popov 7e028a41e2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix DCE with FE_FETCH
2019-12-10 09:01:18 +01:00
Nikita Popov 87691e74e5 Fix DCE with FE_FETCH
For now, don't treat FE_FETCH op2 as no-val use. See GH-4982.
2019-12-10 09:00:09 +01:00
Christoph M. Becker 505cc77cbe Fix #78912: INTL Support for accounting format
We provide `NumberFormatter::CURRENCY_ACCOUNTING` to wrap
`UNUM_CURRENCY_ACCOUNTING `[1].

[1] <https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266dae97cdd7ed612d07d251021c076efb1c5>
2019-12-09 16:34:56 +01:00
Nikita Popov 8d36d79d57 Fix build 2019-12-09 16:06:26 +01:00
Dmitry Stogov 03d1c788ea Export zend_init_func_run_time_cache() 2019-12-09 15:58:00 +03:00
Dmitry Stogov 92c23e1fd3 Call zend_unregister_ini_entries() when unload extension loaded through dl() without MSHUTDOWN callback.
Extensions with MSHUTDOWN should use UNREGISTER_INI_ENTRIES().
2019-12-09 15:05:24 +03:00
Dmitry Stogov 42a2fb8411 Fixed bug #78895 (Reflection detects abstract non-static class as abstract static. IS_IMPLICIT_ABSTRACT is not longer used) 2019-12-09 13:49:12 +03:00
Christoph M. Becker b37a5b9ca4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Extend CURLFile to support streams
  Use curl_mime_*() functions if available
2019-12-09 10:32:03 +01:00
Christoph M. Becker 17a9f1401a Extend CURLFile to support streams
Due to former restrictions of the libcurl API, curl multipart/formdata
file uploads supported only proper files.  However, as of curl 7.56.0
the new `curl_mime_*()` API is available (and already supported by
PHP[1]), which allows us to support arbitrary *seekable* streams, which
is generally desirable, and particularly resolves issues with the
transparent Unicode and long part support on Windows (see bug #77711).

Note that older curl versions are still supported, but CURLFile is
still restricted to proper files in this case.

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

(cherry picked from commit c68dc6b5e3)
2019-12-09 10:30:00 +01:00
Christoph M. Becker e1202733a5 Use curl_mime_*() functions if available
As of curl 7.56.0, `curl_formadd()` is deprecated in favor of
`curl_mime_*()`, so we use the latter if available.

(cherry picked from commit a83b68ba56)
2019-12-09 10:24:49 +01:00
Nikita Popov 32c1f37574 Fixed bug #78926: Handle class table reallocation on failed link
When we change back the bucket key on a class linking failure,
make sure to reload the bucket pointer, as the class table may
have been reallocated in the meantime.

Also remove a bogus bucket key change in anon class registration:
We don't actually rename the class in this case anymore, the RTD
key is already the final name.
2019-12-09 09:15:27 +01:00
Nikita Popov 3d90b770e8 Fix bug #78887: Add upgrading note about get_declared_classes() order
[ci skip]
2019-12-09 08:58:28 +01:00
Nikita Popov 5fcc12f505 Use unmangled named in property type inheritance error 2019-12-09 08:48:33 +01:00
Nikita Popov 84354c62b3 Fixed bug #78904: Don't call any magic for uninitialized typed properties
We already changed the behavior for __set() in f1848a4. However, it
seems that this is also a problem for all the other property magic,
see bug #78904.

This commit makes the behavior of all the property magic consistent:
Magic will not be triggered for uninitialized typed properties, only
explicitly unset() ones. This brings behavior more in line how
non-typed properties behave and avoids WTF.

Closes GH-4974.
2019-12-09 08:40:53 +01:00
Jakub Zelenka ac042f839f Fix bug #78916 (php-fpm 7.4.0 don't send mail via mail()) 2019-12-08 17:57:17 +00:00
Christoph M. Becker aba070e630 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78923: Artifacts when convoluting image with transparency
2019-12-07 12:08:30 +01:00
willson-chen b5d2cbe027 Fix #78923: Artifacts when convoluting image with transparency
We have to properly initialize `pxl` before using it.

Fix ported from <https://github.com/libgd/libgd/pull/559>.
2019-12-07 12:06:33 +01:00
Nikita Popov 07fc0764d1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix constant evaluation of && and ||
2019-12-06 11:10:31 +01:00
Nikita Popov 249e49092d Fix constant evaluation of && and ||
The "return" in the for loop should have been a break on the switch,
otherwise the result is just ignored... but because it prevents
evaluation of the other operand, it also violates the invariant that
everything has been constant evaluated, resulting in an assertion
failure.

The for loop isn't correct in any case though, because it's not legal
to determine the result based on just the second operand, as the
first one may have a side-effect that cannot be optimized away.
2019-12-06 11:07:57 +01:00
Nikita Popov 8753975418 Fix intermittent error in pdo_mysql___construct_options.phpt
For the love of god, don't write tests based on mt_rand!
2019-12-06 07:39:54 +01:00
Nikita Popov e760d94f4b Fix timeout tests
After taking a more detailed look at our commonly failing timeout
tests... turns out that most of them are useless as written and
don't test what they're supposed to.

This PR has a couple of changes:

* Tests for timeout in while/for/foreach should just have the loop
as an infinite loop. Calling into something like busy_wait means
that we just end up always testing whatever busy_wait does.
* Tests for timeouts in calls need to be based on something like
sleep, otherwise we'd have to introduce a loop, and we'd end up
testing timeout of the looping structure instead. Using sleep only
works on Windows, because that's the only system where sleep counts
towards the timeout. As such, many of those tests are now Windows only.
* Removed some tests where I don't see a good way to test what they're
supposed to test. E.g. how can we test a timeout in eval() specifically?

The shutdown function tests are marked as XFAIL, as we are currently
missing a timeout check in call_user_function. I believe that's a
legitimate issue.

Closes GH-4969.
2019-12-05 11:19:23 +01:00
Nikita Popov 6b7cb4a8d7 Fix mysqli ssl tests
First, make sure the tests are skipped if we connect via unix
socket, as we can't use SSL in that case.

Second, use a cipher that is not blacklisted in current MySQL
versions.
2019-12-05 08:38:40 +01:00
Arjen de Korte ee4295b4ce Fix bug #78823: add zlib library to mysqlnd
The problem is newer binutils will no longer default to --copy-dt-needed-entries but use --no-copy-dt-needed-entries instead. So all libraries needed *must* be provided.

Workarounds (either one works)
1) Add "-Wl,--copy-dt-needed-entries" to LDFLAGS to bring back the old behavior of the linker
2) Add "-lz" to list of libraries to be added

In "ext/mysqlnd/mysqlnd_protocol_frame_codec.c" when the "zlib.h" header is included should also trigger adding '-lz' to the list of libraries.
2019-12-05 07:24:52 +01:00
Nikita Popov 3167e591b5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix AST printing of nullable builtin types
2019-12-04 11:21:28 +01:00
Nikita Popov fac43d6515 Fix AST printing of nullable builtin types
Fixes oss-fuzz #19109.
2019-12-04 11:20:52 +01:00
Nikita Popov 7cbf31a3c7 Preload: Better reason message for internal parents on windows
Related to bug #78881.
2019-12-04 09:52:40 +01:00
Nikita Popov 6540797f1e Fixed bug #78898 2019-12-04 09:40:48 +01:00
Nikita Popov 9533a815d5 Add ReflectionMethod::getClosure() change to UPGRADING
Fixes bug #78897.

[ci skip]
2019-12-04 08:07:59 +01:00
Nikita Popov 39b08ba99c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix print_r return types in opcache
2019-12-04 07:16:56 +01:00
Tyson Andre c8e9aa854c Fix print_r return types in opcache
https://www.php.net/print_r

> When the return parameter is TRUE, this function will return a string.
> Otherwise, the return value is TRUE.
2019-12-04 07:16:32 +01:00
Christoph M. Becker b16b7ad036 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Next is 7.3.14
2019-12-03 12:07:57 +01:00
Christoph M. Becker 65bbc67063 Next is 7.3.14 2019-12-03 12:04:17 +01:00
Remi Collet 322b5de661 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  next is 7.2.27
2019-12-03 11:26:20 +01:00
Remi Collet 3444b90746 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  next is 7.2.27
2019-12-03 11:26:05 +01:00
Remi Collet d2cfb63f02 next is 7.2.27 2019-12-03 11:25:37 +01:00
Christoph M. Becker 996f217aa5 Fix #78883: fgets(STDIN) fails on Windows
We add the `is_seekable` member to `php_stdio_stream_data`, and prefer
that over `is_pipe`, since the latter is simply a misnomer.  We keep
`is_pipe` for now for Windows only, though, because we need special
support for pipes there.  We also fix the misaligned bitfield which
formerly took 33 bit.
2019-12-02 16:52:32 +01:00
Christoph M. Becker 3356dd0575 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:39:35 +01:00
Christoph M. Becker 861fa60814 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:38:45 +01:00
Christoph M. Becker 600f1f898f Fix #78814: strip_tags allows / in tag name => whitelist bypass
When normalizing tags to check whether they are contained in the set
of allowable tags, we must not strip slashes, unless they come
immediately after the opening `<`, or immediately before the closing
`>`.
2019-12-02 11:37:25 +01:00
Christoph M. Becker a9e45bc0fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78296: is_file fails to detect file
2019-12-02 11:29:58 +01:00
Christoph M. Becker bb735c9e9e Fix #78296: is_file fails to detect file
If we're constructing extended-length paths (i.e. paths prefixed with
`\\?\`), we have to replace all forward slashes with backward slashes,
because the former are not supported by Windows for extended-length
paths.

The more efficient and likely cleaner alternative solution would be to
cater to this in `php_win32_ioutil_normalize_path_w()` by always
replacing forward slashes, but that might break existing code.  It
might be sensible to change that for `master`, though.
2019-12-02 11:29:10 +01:00
Christoph M. Becker 4ff242a9a7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78833: Integer overflow in pack causes out-of-bound access
2019-12-02 11:21:07 +01:00
Christoph M. Becker 3d81c54879 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78833: Integer overflow in pack causes out-of-bound access
2019-12-02 11:19:15 +01:00
Christoph M. Becker db420cb6a1 Fix #78833: Integer overflow in pack causes out-of-bound access
We check for potential signed integer overflow, and bail out
gracefully, in that case.
2019-12-02 11:18:19 +01:00
Jakub Zelenka 67cd4271e9 Fix bug #78889 (php-fpm service fails to start) 2019-12-01 17:13:20 +00:00
Christoph M. Becker 246b9db569 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Upgrade to Oniguruma 6.9.4
2019-11-30 14:01:25 +01:00
Christoph M. Becker 1979c5d16f Upgrade to Oniguruma 6.9.4
Oniguruma 6.9.4 fixes several CVEs.
2019-11-30 14:00:41 +01:00
Christoph M. Becker 92cdf2aa7f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing skip checks
2019-11-29 23:51:12 +01:00
Christoph M. Becker 8c4b0ddde5 Add missing skip checks 2019-11-29 23:50:05 +01:00
Christoph M. Becker f899e5ff17 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Partially revert "Adapt test cases for Oniguruma 6.9.4"
2019-11-29 23:41:39 +01:00
Christoph M. Becker ff2140c49d Partially revert "Adapt test cases for Oniguruma 6.9.4"
This partially reverts commit c55d09c2f5,
because `MB_ONIGURUMA_VERSION` is only available as of PHP 7.4.0, so
that change made no sense for PHP-7.3; we keep it for PHP-7.4, though.
We also stick with the modification to bug78633.phpt.
2019-11-29 23:40:30 +01:00
Christoph M. Becker 2b700841c5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Adapt test cases for Oniguruma 6.9.4
2019-11-29 17:00:11 +01:00
Christoph M. Becker c55d09c2f5 Adapt test cases for Oniguruma 6.9.4
Apparently, bug 78633 has now really been fixed; the former fix only
catered to the buffer overflow, but yielded a wrong result.  Also,
the order of the named captures has been fixed.
2019-11-29 16:59:19 +01:00
Christoph M. Becker 4ac3bda462 Prevent parallel test conflicts
The better solution would be to actually use different directory names,
but adding respective CONFLICTS sections solves the issue for now.
2019-11-27 14:04:10 +01:00
Christoph M. Becker 30aa2e8932 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78840: imploding $GLOBALS crashes
2019-11-27 09:33:55 +01:00
Christoph M. Becker fee38633d2 Fix #78840: imploding $GLOBALS crashes
We add support for IS_INDIRECT zvals to implode().
2019-11-27 09:32:16 +01:00
Christoph M. Becker 717730ddd1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77638: var_export'ing certain class instances segfaults
2019-11-25 15:57:56 +01:00
Christoph M. Becker 23c65a8173 Fix #77638: var_export'ing certain class instances segfaults
If objects return immutable property hash tables (typically,
`zend_empty_array`), we must not try to apply recursion protection on
those.
2019-11-25 15:54:11 +01:00
Dmitry Stogov 2ebf530946 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value)
2019-11-25 14:09:18 +03:00
Dmitry Stogov bb30fe9e2b Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value) 2019-11-25 14:05:43 +03:00
Derick Rethans 71d42dc794 Consolidate NEWS for 7.4.0 release 2019-11-24 10:23:33 +01:00
Derick Rethans c16cbfd1da WIP: Merge NEWS 2019-11-23 20:00:51 +01:00
Tyson Andre b037fe5bd1 Handle reallocated root buffer during GC destroy phase (v2)
We no longer protect GC during the destroy phase, so we need to
deal with buffer reallocation.

Note that the implementation of spl_SplObjectStorage_free_storage
will call the destructor of SplObjectStorage, and free the instance properties,
which I think is what caused the root buffer to be reallocated.
(`current` is a pointer for an index within the root buffer?)

This fixes bug #78811 for me.

Closes GH-4935
2019-11-23 10:45:20 -05:00
Christoph M. Becker cfb643ca2b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78853: preg_match() may return integer > 1
2019-11-22 19:29:11 +01:00
Christoph M. Becker e1da72bdf1 Fix #78853: preg_match() may return integer > 1
Commit 54ebebd[1] optimized the match loop, but for this case it has
been overlooked, that we must only loop if we're doing global matching.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=54ebebd686255c5f124af718c966edb392782d4a>
2019-11-22 19:26:26 +01:00
George Wang 99b8e67615 Merge branch 'PHP-7.3' into PHP-7.4 2019-11-21 17:58:44 -05:00
George Wang e981f5af51 Merge branch 'PHP-7.2' into PHP-7.3 2019-11-21 17:58:16 -05:00
George Wang c7141412ce Added environment LSAPI_CLEAN_SHUTDOWN to control clean shutdown. Update SAPI version to LiteSpeed v7.6 . 2019-11-21 17:57:50 -05:00
Christoph M. Becker b78ec58f09 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:02:33 +01:00
Christoph M. Becker b4f501d5a4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:01:05 +01:00
Christoph M. Becker 9b92c1d154 Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
Apparently, this has not been tested for a long time, and might be a
refactoring relict.  Anyhow, we have to pass the context to
`GIFNextPixel` as well.
2019-11-21 09:59:26 +01:00
Adam Harvey 00df73c30d Make the UPGRADING note about ArrayObject more explicit.
We noticed the BC break when testing `curl_setopt()`, and hadn't interpreted
this note as affecting internal functions in general, so this adds a sub-bullet
to note that.

This overlaps a bit with the previous bullet, but since I don't know exactly
which operations were in mind at the time, I've elected to preserve them both.
Bits are cheap.
2019-11-20 15:33:04 -08:00
Christoph M. Becker bcb8ab304e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
2019-11-18 12:48:55 +01:00
Christoph M. Becker 3b46fbfc36 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
2019-11-18 12:47:53 +01:00
Christoph M. Becker f6eac76b65 Update NEWS 2019-11-18 12:46:43 +01:00
Dmitry Stogov be6fb13873 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix $x = (bool)$x; for undefined with opcache
2019-11-18 11:27:43 +03:00
Dmitry Stogov e72e3370c6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix $x = (bool)$x; for undefined with opcache
2019-11-18 11:26:30 +03:00
Tyson Andre a2c41c0ea6 Fix $x = (bool)$x; for undefined with opcache
And `$x = !$x`

Noticed while working on GH-4912

The included test would not emit undefined variable errors in php 8.0
with opcache enabled. The command used:

```
php -d zend_extension=opcache.so --no-php-ini -d error_reporting=E_ALL \
    -d opcache.file_cache= -d opcache.enable_cli=1  test.php
```
2019-11-18 11:24:03 +03:00
Jakub Zelenka 29c7c9e8ed Add NEWS entry for bug #76601 fix 2019-11-17 14:52:36 +00:00
Maksim Nikulin e37bd5dcc2 Do not let PHP-FPM children miss SIGTERM, SIGQUIT
Postpone signal delivery while spawning children.
Prevent the following case:

- Reload (reexec) is in progress.
- New master is forking to start enough children for pools
  where `pm` is not `on-demand`.
- Another `SIGUSR2` is received by the master process.
- Master process switches to reloading state.
- Some child has not set its own signal handlers.
- `SIGQUIT` and `SIGTERM` sent by master process are caught
  by signal handler set by master process and so they are ignored.
- A child is running, it has no reason to finish

Before pull request #4465 this scenario could cause deadlock,
however with 0ed6c37140 reload finishes after `SIGKILL`.

Use sigprocmask() around fork() to avoid race of delivery signal to children
and setting of own signal handlers.

Fixes bug #76601
2019-11-17 14:46:56 +00:00
Nikita Popov 3f4a15113c Handle reallocated root buffer during GC destroy phase
We no longer protect GC during the destroy phase, so we need to
deal with buffer reallocation.

Possible fix for bug #78811.
2019-11-15 15:53:49 +01:00
Derick Rethans 51ac4e302c Zend Engine version is no longer in -dev 2019-11-15 14:27:20 +00:00
Derick Rethans e99406f4d1 PHP-7.4 is now 7.4.1-dev 2019-11-15 14:22:14 +00:00
Nikita Popov 266f3a02bc Fixed bug #78810 2019-11-15 12:06:17 +01:00
Christoph M. Becker a5683e65da Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix ASLR related invalid opline handler issues
2019-11-15 09:47:34 +01:00
Christoph M. Becker 39d04f15f8 Fix ASLR related invalid opline handler issues
Opcache stores `opline->handler`s in shared memory.  These pointers are
invalid, if the main PHP DLL is loaded at another base address due to
ASLR.  We therefore store the address of `execute_ex` in the mmap base
file, and check on startup whether it matches its current address.  If
not, we fall back on the file cache if enabled, and bail out otherwise.

This still does not address cases where the opline handler is located
inside of another DLL (e.g. for some profilers, debuggers), but there
seems to be no general solution for now.

(cherry picked from commit 8ba10b8fbc)
2019-11-15 09:46:58 +01:00
Fabien Villepinte 92fd96531c Add more CONFLICTS tags
Closes GH-4908.
2019-11-13 20:59:23 +01:00
Dmitry Stogov 49fcbb4810 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed wrong constant usage
2019-11-12 13:00:27 +03:00
Dmitry Stogov 9083e178f6 Fixed wrong constant usage 2019-11-12 12:59:50 +03:00
Dmitry Stogov c3f23642da ws 2019-11-12 10:51:55 +03:00
Stanislav Malyshev 686a24c1eb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78804 - Segmentation fault in Locale::filterMatches
2019-11-11 23:08:44 -08:00
Stanislav Malyshev ea2a125789 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78804 - Segmentation fault in Locale::filterMatches
2019-11-11 23:08:38 -08:00
Stanislav Malyshev 2c9926f156 Fix bug #78804 - Segmentation fault in Locale::filterMatches 2019-11-11 22:32:35 -08:00
Christoph M. Becker ce047e6091 Fix test case for Windows 2019-11-11 12:49:32 +01:00
Christoph M. Becker 60081ca20d Fix test cases which fail on Windows debug builds
We use the portable {TMP} instead of the hard-coded /tmp, and skip
mysqli_debug_append.phpt on Windows, because unlinking the trace file
while the connection is still open won't work there.
2019-11-11 12:14:38 +01:00
Dmitry Stogov ecd0c5b6ad Fixed bug #78714 (funcs returning pointer can't use call convention spec) 2019-11-11 12:07:48 +03:00
287 changed files with 5744 additions and 2133 deletions

No files matched your search

+6 -6
View File
@@ -35,7 +35,7 @@ If you are fixing a bug, then please submit your PR against the lowest actively
supported branch of PHP that the bug affects (only green branches on
[the supported version page](https://www.php.net/supported-versions.php) are
supported). For example, at the time of writing, the lowest supported version is
PHP 7.2, which corresponds to the `PHP-7.2` branch in Git. Please also make sure
PHP 7.3, which corresponds to the `PHP-7.3` branch in Git. Please also make sure
you add a link to the PR in the bug on [the bug tracker](https://bugs.php.net/).
Pull requests implementing RFCs should be submitted against `master`.
@@ -331,10 +331,10 @@ Currently we have the following branches in use:
| Branch | |
| --------- | --------- |
| master | Active development branch for PHP 8.0, which is open for backwards incompatible changes and major internal API changes. |
| PHP-7.4 | Active development branch for PHP 7.4, which is open for new features and minor internal API changes. |
| PHP-7.4 | Is used to release the PHP 7.4.x series. This is a current stable version and is open for bugfixes only. |
| PHP-7.3 | Is used to release the PHP 7.3.x series. This is a current stable version and is open for bugfixes only. |
| PHP-7.2 | Is used to release the PHP 7.2.x series. This is a current stable version and is open for bugfixes only. |
| PHP-7.1 | Is used to release the PHP 7.1.x series. This is an old stable version and is open for security fixes only. |
| PHP-7.2 | Is used to release the PHP 7.2.x series. This is an old stable version and is open for security fixes only. |
| PHP-7.1 | This branch is closed. |
| PHP-7.0 | This branch is closed. |
| PHP-5.6 | This branch is closed. |
| PHP-5.5 | This branch is closed. |
@@ -348,8 +348,8 @@ Currently we have the following branches in use:
The next few rules are more of a technical nature:
1. All non-security bugfix changes should first go to the lowest bugfix branch
(i.e. 7.2) and then get merged up to all other branches. All security fixes
should go to the lowest security fixes branch (i.e 7.1). If a change is not
(i.e. 7.3) and then get merged up to all other branches. All security fixes
should go to the lowest security fixes branch (i.e 7.2). If a change is not
needed for later branches (i.e. fixes for features which were dropped from
later branches) an empty merge should be done.
+1509 -414
View File
File diff suppressed because it is too large. Load diff
+7 -1
View File
@@ -720,6 +720,7 @@ TSRM_API void *shmat(int key, const void *shmaddr, int flags)
TSRM_API int shmdt(const void *shmaddr)
{/*{{{*/
shm_pair *shm = shm_get(0, (void*)shmaddr);
int ret;
if (!shm->segment) {
return -1;
@@ -729,7 +730,12 @@ TSRM_API int shmdt(const void *shmaddr)
shm->descriptor->shm_lpid = getpid();
shm->descriptor->shm_nattch--;
return UnmapViewOfFile(shm->addr) ? 0 : -1;
ret = UnmapViewOfFile(shm->addr) ? 0 : -1;
if (!ret && shm->descriptor->shm_nattch <= 0) {
ret = UnmapViewOfFile(shm->descriptor) ? 0 : -1;
shm->descriptor = NULL;
}
return ret;
}/*}}}*/
TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf)
+17
View File
@@ -45,6 +45,9 @@ PHP 7.4 UPGRADE NOTES
. The "creating default object from empty value" warning is now consistently
thrown if a falsy value is promoted into an stdClass object. Previously some
cases like `$null->prop[0] = $val` missed this warning.
. Previously get_declared_classes() always returned parent classes before
child classes. This is no longer the case. No particular order is guaranteed
for the get_declared_classes() return value.
- BCMath:
. BCMath functions will now warn if a non well-formed number is passed, such
@@ -110,6 +113,11 @@ PHP 7.4 UPGRADE NOTES
to serialize them. Serialization for reflection objects was never
supported and resulted in corrupted reflection objects. It has been
explicitly prohibited now.
. The signature of the ReflectionMethod::getClosure() method changed to
account for existing behavior with static methods:
Before: ReflectionMethod::getClosure($object)
After: ReflectionMethod::getClosure($object = null)
The new signature is also (LSP) compatible with older PHP versions.
- SPL:
. Calling get_object_vars() on an ArrayObject instance will now always return
@@ -120,6 +128,9 @@ PHP 7.4 UPGRADE NOTES
* ReflectionObject::getProperties()
* reset(), current(), etc. Use Iterator methods instead.
* Potentially others working on object properties as a list.
* Other internal functions that iterate over an array, but which
previously silently accepted an ArrayObject as well; eg curl_setopt()
when used with an option that expects an array.
(array) casts are *not* affected. They will continue to return either the
wrapped array, or the ArrayObject properties, depending on whether the
@@ -552,6 +563,12 @@ PHP 7.4 UPGRADE NOTES
9. Other Changes to Extensions
========================================
DBA:
. As of PHP 7.4.2, dba_open() accepts a fifth optional parameter for lmdb
databases which allows to specify the mapsize. The parameter defaults to
zero, in which case the compiled in default mapsize (usually 1048576) will
be used. The mapsize should be a multiple of the page size of the OS.
- GD:
. The behavior of imagecropauto() in the bundled libgd has been synced with
that of system libgd:
+2 -2
View File
@@ -213,8 +213,8 @@ PHP 7.4 INTERNALS UPGRADE NOTES
an exception. For instructions on how to gracefully handle this see
https://wiki.php.net/rfc/tostring_exceptions#extension_guidelines.
u. The Windows typedefs uint and ulong are no longer available, and have to be
replaced with standard types.
u. The typedefs uint and ulong are no longer guaranteed to be available, and
have to be replaced with standard types.
v. Compound assignment opcodes were changed. Instead of ZEND_ASSIGN_ADD (and
others) with 0, ZEND_ASSIGN_DIM, ZEND_ASSIGN_OBJ or
+2 -2
View File
@@ -94,7 +94,7 @@ L0:
}
}));
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
class A {
use T1, T2 {
T1::foo insteadof foo;
@@ -244,7 +244,7 @@ Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c,
})) failed in %sexpect_015.php on line %d
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
Warning: assert(): assert(0 && ($a = function &(?array &$a, X $b = null) use($c, &$d): X {
class A {
use T1, T2 {
T1::foo insteadof foo;
+23
View File
@@ -0,0 +1,23 @@
--TEST--
Assigning the result of a non-reference function by-reference should not leak
--FILE--
<?php
function func() {
return [0];
}
$x = $y =& func();
var_dump($x, $y);
?>
--EXPECTF--
Notice: Only variables should be assigned by reference in %s on line %d
array(1) {
[0]=>
int(0)
}
array(1) {
[0]=>
int(0)
}
+1 -3
View File
@@ -11,14 +11,12 @@ set_error_handler(function($errno, $errstr, $errfile, $errline){
require 'notfound.php';
--EXPECTF--
error(require(notfound.php): failed to open stream: %s)
Warning: Uncaught Exception: Foo in %sbug60909_1.php:5
Fatal error: Uncaught Exception: Foo in %sbug60909_1.php:5
Stack trace:
#0 %sbug60909_1.php(8): {closure}(2, 'require(notfoun...', '%s', 8, Array)
#1 %sbug60909_1.php(8): require()
#2 {main}
thrown in %sbug60909_1.php on line 5
Fatal error: main(): Failed opening required 'notfound.php' (include_path='%s') in %sbug60909_1.php on line 8
!!!shutdown!!!
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #73816: Broken eval(anonymous class)
--FILE--
<?php
function anon()
{
static $i = 0;
return eval(sprintf('return new class { private $prop%s; };', ++$i));
}
var_dump(anon());
var_dump(anon());
?>
--EXPECT--
object(class@anonymous)#1 (1) {
["prop1":"class@anonymous":private]=>
NULL
}
object(class@anonymous)#1 (1) {
["prop2":"class@anonymous":private]=>
NULL
}
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Bug #78776: Abstract method implementation from trait does not check "static"
--FILE--
<?php
abstract class A
{
abstract public function createApp();
}
class B extends A
{
use C;
}
trait C
{
public static function createApp()
{
echo "You should not be here\n";
}
}
B::createApp();
?>
--EXPECTF--
Fatal error: Cannot make non static method A::createApp() static in class C in %s on line %d
+25
View File
@@ -0,0 +1,25 @@
--TEST--
Bug #78810: RW fetches do not throw "uninitialized property" exception
--FILE--
<?php
class Test {
public int $i;
}
$test = new Test;
try {
$test->i++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$test->i += 1;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Typed property Test::$i must not be accessed before initialization
Typed property Test::$i must not be accessed before initialization
+33
View File
@@ -0,0 +1,33 @@
--TEST--
Bug #78868: Calling __autoload() with incorrect EG(fake_scope) value
--FILE--
<?php
class C {
private $private = 1;
function foo() {
$this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C"
}
}
class A {
static $foo = B::foo; //not resolved on include()
}
function main_autoload($class_name) {
$c = new C;
$c->foo();
//doesn't affect the error
eval("class B {const foo = 1;}");
}
spl_autoload_register('main_autoload', false);
$classA = new ReflectionClass("A");
$props = $classA->getProperties();
$props[0]->setValue(2); //causes constant resolving, which runs autoload, all with EG(fake_scope) == "A"
echo "OK\n";
?>
--EXPECT--
OK
+34
View File
@@ -0,0 +1,34 @@
--TEST--
Bug #78898: call_user_func(['parent', ...]) fails while other succeed
--FILE--
<?php
class A
{
protected function _x()
{
echo "a";
}
public function __call($methodName, array $arguments)
{
throw new Exception("Unknown method.");
}
}
class B extends A
{
public function x()
{
parent::_x();
call_user_func('parent::_x');
call_user_func(['parent', '_x']);
}
}
$b = new B;
$b->x();
?>
--EXPECT--
aaa
+36
View File
@@ -0,0 +1,36 @@
--TEST--
Bug #78921: When Reflection triggers class load, property visibility is incorrect
--FILE--
<?php
spl_autoload_register(function($className) {
if ($className == 'PrivateStatic') {
class PrivateStatic
{
const SOME_CONST = 13;
private static $privateStaticVarArray = ['a', 'b', 'c'];
private static $otherStatic;
public static function init()
{
self::$otherStatic = self::$privateStaticVarArray;
}
}
PrivateStatic::init();
}
});
class OtherClass
{
const MY_CONST = PrivateStatic::SOME_CONST;
public static $prop = 'my property';
}
$reflectionClass = new ReflectionClass('OtherClass');
$reflectionProperty = $reflectionClass->getProperty('prop');
$reflectionProperty->setAccessible(true);
$value = $reflectionProperty->getValue();
echo "Value is $value\n";
?>
--EXPECT--
Value is my property
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #78926: Segmentation fault on Symfony cache:clear
--FILE--
<?php
spl_autoload_register(function($class) {
for ($i = 0; $i < 100; $i++) {
eval("class C$i {}");
}
});
try {
class B extends A {}
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(class_exists('B', false));
?>
--EXPECT--
Class 'A' not found
bool(false)
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #78973: Destructor during CV freeing causes segfault if opline never saved
--INI--
opcache.optimization_level=0
--FILE--
<?php
function test($x) {
}
test(new class {
public function __destruct() {
debug_print_backtrace();
}
});
?>
--EXPECTF--
#0 class@anonymous->__destruct() called at [%s:%d]
#1 test() called at [%s:%d]
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #78999 (Cycle leak when using function result as temporary)
--FILE--
<?php
function get() {
$t = new stdClass;
$t->prop = $t;
return $t;
}
var_dump(get());
var_dump(gc_collect_cycles());
--EXPECT--
object(stdClass)#1 (1) {
["prop"]=>
*RECURSION*
}
int(1)
+39
View File
@@ -0,0 +1,39 @@
--TEST--
Bug #79022 (class_exists returns True for classes that are not ready to be used)
--FILE--
<?php
function my_autoloader($class) {
if (class_exists('Foo', 0)) {
new Foo();
}
if ($class == 'Foo') {
eval("class Foo extends Bar{}");
}
if ($class == 'Bar') {
eval("class Bar {}");
}
if ($class == 'Dummy') {
eval ("class Dummy implements iFoo {}");
}
if (interface_exists('iFoo', 0)) {
new Dummy();
}
if ($class == 'iFoo') {
eval ("interface iFoo extends iBar {}");
}
if ($class == 'iBar') {
eval ("interface iBar {}");
}
}
spl_autoload_register('my_autoloader');
new Foo();
new Dummy();
echo "okey";
?>
--EXPECT--
okey
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Cannot write to closure properties
--FILE--
<?php
class A {
function getFn() {
return function() {
};
}
}
$a = new A;
try {
$c = $a->getFn()->b = new stdClass;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Closure object cannot have properties
+9
View File
@@ -0,0 +1,9 @@
--TEST--
Incorrect constant evaluation of and/or (OSS-Fuzz #19255)
--FILE--
<?php
const C = 0 && __namespace__;
var_dump(C);
?>
--EXPECT--
bool(false)
+28
View File
@@ -0,0 +1,28 @@
--TEST--
Freeing of function "name" when dynamic call fails
--FILE--
<?php
try {
$bar = "bar";
("foo" . $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$bar = ["bar"];
(["foo"] + $bar)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
(new stdClass)();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Call to undefined function foobar()
Function name must be a string
Function name must be a string
@@ -0,0 +1,41 @@
--TEST--
Make sure exceptions during include/require stating are properly propagated
--FILE--
<?php
class StreamWrapper {
public function url_stat($path, $flags) {
throw new Exception('stat failed');
}
}
stream_wrapper_register('test', StreamWrapper::class);
set_include_path('test://foo:test://bar');
try {
require_once 'doesnt_exist.php';
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
require 'doesnt_exist.php';
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
include_once 'doesnt_exist.php';
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
try {
include 'doesnt_exist.php';
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
stat failed
stat failed
stat failed
stat failed
@@ -0,0 +1,30 @@
--TEST--
Generator exceptions during shutdown should not be swallowed
--FILE--
<?php
function gen() {
try {
echo "before yield\n";
yield;
echo "after yield\n";
} finally {
echo "before yield in finally\n";
yield;
echo "after yield in finally\n";
}
echo "after finally\n";
}
$gen = gen();
$gen->rewind();
?>
--EXPECTF--
before yield
before yield in finally
Fatal error: Uncaught Error: Cannot yield from finally in a force-closed generator in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
@@ -0,0 +1,51 @@
--TEST--
Free pending exceptions / return values on clone on yield in finally
--FILE--
<?php
function gen1() {
try {
throw new Exception();
} finally {
yield;
}
}
function gen2() {
try {
$bar = "bar";
return "foo" . $bar;
} finally {
yield;
}
}
function gen3() {
try {
throw new Exception();
} finally {
try {
$bar = "bar";
return "foo" . $bar;
} finally {
yield;
}
}
}
function gen4() {
try {
try {
$bar = "bar";
return "foo" . $bar;
} finally {
yield;
}
} finally {
}
}
gen1()->rewind();
gen2()->rewind();
gen3()->rewind();
gen4()->rewind();
?>
===DONE===
--EXPECT--
===DONE===
+30
View File
@@ -0,0 +1,30 @@
--TEST--
Stats executed during include path resolution should be silent
--FILE--
<?php
class StreamWrapper {
public function url_stat($path, $flags) {
$path = str_replace('test://', 'file://', $path);
if ($flags & STREAM_URL_STAT_QUIET) {
return @stat($path);
} else {
return stat($path);
}
}
}
stream_wrapper_register('test', StreamWrapper::class);
set_include_path('test://foo:test://bar');
try {
require_once 'doesnt_exist.php';
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: require_once(doesnt_exist.php): failed to open stream: No such file or directory in %s on line %d
Fatal error: require_once(): Failed opening required 'doesnt_exist.php' (include_path='test://foo:test://bar') in %s on line %d
@@ -0,0 +1,14 @@
--TEST--
Make sure the return value of a property assignment is not freed to early
--FILE--
<?php
class Overloaded {
function __set($r, $a) {}
}
$obj = new Overloaded;
$x = $obj->prop = new stdClass;
var_dump($x);
?>
--EXPECT--
object(stdClass)#2 (0) {
}
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Accessing PHP_INT_MAX and PHP_INT_MIN as string offsets
--FILE--
<?php
$str = "";
var_dump($str[PHP_INT_MAX]);
var_dump($str[PHP_INT_MIN]);
?>
--EXPECTF--
Notice: Uninitialized string offset: %d in %s on line %d
string(0) ""
Notice: Uninitialized string offset: -%d in %s on line %d
string(0) ""
@@ -14,12 +14,13 @@ class Foo {
$foo = new Foo();
unset($foo->bar);
var_dump($foo->bar);
?>
--EXPECTF--
string(3) "bar"
Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, null used in %s:14
Fatal error: Uncaught TypeError: Typed property Foo::$bar must be int, null used in %s:%d
Stack trace:
#0 {main}
thrown in %s on line 14
thrown in %s on line %d
@@ -12,6 +12,7 @@ class Test {
}
$test = new Test;
unset($test->val);
var_dump($test);
var_dump($test->val);
@@ -13,6 +13,7 @@ class Test {
}
$test = new Test;
unset($test->val);
var_dump($test);
var_dump($val = &$test->val);
var_dump($test);
@@ -14,6 +14,7 @@ class Test {
$test = new Test;
$dummyRef = &$test->prop;
unset($test->val);
var_dump($test);
try {
var_dump($test->val);
@@ -0,0 +1,26 @@
--TEST--
CONST/CV should not be freed on failed reference assignment
--FILE--
<?php
class Test {
public ?Type $prop;
}
$obj = new Test;
$ref =& $obj->prop;
try {
$ref = [1];
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
$ary = [1];
$ref = $ary;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump($ref);
?>
--EXPECT--
Cannot assign array to reference held by property Test::$prop of type ?Type
Cannot assign array to reference held by property Test::$prop of type ?Type
NULL
@@ -5,12 +5,29 @@ __set() should not be invoked when setting an uninitialized typed property
class Test {
public int $foo;
public function __get($name) {
echo "__get ", $name, "\n";
return null;
}
public function __set($name, $value) {
echo "__set ", $name, " = ", $value, "\n";
}
public function __isset($name) {
echo "__isset ", $name, "\n";
return true;
}
public function __unset($name) {
echo "__unset ", $name, "\n";
}
}
$test = new Test;
try {
var_dump($test->foo);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump(isset($test->foo));
$test->foo = 42;
var_dump($test->foo);
@@ -44,6 +61,8 @@ $test->foo = 42;
?>
--EXPECT--
Typed property Test::$foo must not be accessed before initialization
bool(false)
int(42)
__set foo = 42
__set foo = 42
@@ -0,0 +1,11 @@
--TEST--
Typed property invariance violation for protected properties
--FILE--
<?php
class A { protected int $x; }
class B extends A { protected $x; }
?>
--EXPECTF--
Fatal error: Type of B::$x must be int (as in class A) in %s on line %d
+2
View File
@@ -524,6 +524,8 @@ static void zend_set_default_compile_time_values(void) /* {{{ */
/* default compile-time values */
CG(short_tags) = short_tags_default;
CG(compiler_options) = compiler_options_default;
CG(rtd_key_counter) = 0;
}
/* }}} */
+1 -1
View File
@@ -20,7 +20,7 @@
#ifndef ZEND_H
#define ZEND_H
#define ZEND_VERSION "3.4.0-dev"
#define ZEND_VERSION "3.4.0"
#define ZEND_ENGINE_3
+34 -9
View File
@@ -29,6 +29,7 @@
#include "zend_exceptions.h"
#include "zend_closures.h"
#include "zend_inheritance.h"
#include "zend_ini.h"
#include <stdarg.h>
@@ -2562,6 +2563,12 @@ void module_destructor(zend_module_entry *module) /* {{{ */
module->module_shutdown_func(module->type, module->module_number);
}
if (module->module_started
&& !module->module_shutdown_func
&& module->type == MODULE_TEMPORARY) {
zend_unregister_ini_entries(module->module_number);
}
/* Deinitilaise module globals */
if (module->globals_size) {
#ifdef ZTS
@@ -2649,17 +2656,22 @@ ZEND_API void zend_post_deactivate_modules(void) /* {{{ */
{
if (EG(full_tables_cleanup)) {
zend_module_entry *module;
zval *zv;
zend_string *key;
ZEND_HASH_FOREACH_PTR(&module_registry, module) {
if (module->post_deactivate_func) {
module->post_deactivate_func();
}
} ZEND_HASH_FOREACH_END();
ZEND_HASH_REVERSE_FOREACH_PTR(&module_registry, module) {
ZEND_HASH_REVERSE_FOREACH_STR_KEY_VAL(&module_registry, key, zv) {
module = Z_PTR_P(zv);
if (module->type != MODULE_TEMPORARY) {
break;
}
module_destructor(module);
free(module);
zend_string_release_ex(key, 0);
} ZEND_HASH_FOREACH_END_DEL();
} else {
zend_module_entry **p = module_post_deactivate_handlers;
@@ -2755,6 +2767,7 @@ ZEND_API zend_class_entry *zend_register_internal_interface(zend_class_entry *or
ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zend_class_entry *ce, int persistent) /* {{{ */
{
zend_string *lcname;
zval zv, *ret;
/* TODO: Move this out of here in 7.4. */
if (persistent && EG(current_module) && EG(current_module)->type == MODULE_TEMPORARY) {
@@ -2772,9 +2785,11 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen
zend_assert_valid_class_name(lcname);
lcname = zend_new_interned_string(lcname);
ce = zend_hash_add_ptr(CG(class_table), lcname, ce);
ZVAL_ALIAS_PTR(&zv, ce);
ret = zend_hash_add(CG(class_table), lcname, &zv);
zend_string_release_ex(lcname, 0);
if (ce) {
if (ret) {
if (!(ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
ce->refcount++;
}
@@ -3117,11 +3132,13 @@ static zend_always_inline int zend_is_callable_check_func(int check_flags, zval
((fcc->object && fcc->calling_scope->__call) ||
(!fcc->object && fcc->calling_scope->__callstatic)))) {
scope = zend_get_executed_scope();
if (fcc->function_handler->common.scope != scope
|| !zend_check_protected(zend_get_function_root_class(fcc->function_handler), scope)) {
retval = 0;
fcc->function_handler = NULL;
goto get_function_via_handler;
if (fcc->function_handler->common.scope != scope) {
if ((fcc->function_handler->common.fn_flags & ZEND_ACC_PRIVATE)
|| !zend_check_protected(zend_get_function_root_class(fcc->function_handler), scope)) {
retval = 0;
fcc->function_handler = NULL;
goto get_function_via_handler;
}
}
}
} else {
@@ -3762,7 +3779,9 @@ ZEND_API int zend_declare_typed_property(zend_class_entry *ce, zend_string *name
}
/* Must be interned to avoid ZTS data races */
name = zend_new_interned_string(zend_string_copy(name));
if (is_persistent_class(ce)) {
name = zend_new_interned_string(zend_string_copy(name));
}
}
if (access_type & ZEND_ACC_PUBLIC) {
@@ -4206,6 +4225,12 @@ ZEND_API int zend_update_static_property_ex(zend_class_entry *scope, zend_string
zend_property_info *prop_info;
zend_class_entry *old_scope = EG(fake_scope);
if (UNEXPECTED(!(scope->ce_flags & ZEND_ACC_CONSTANTS_UPDATED))) {
if (UNEXPECTED(zend_update_class_constants(scope)) != SUCCESS) {
return FAILURE;
}
}
EG(fake_scope) = scope;
property = zend_std_get_static_property_with_info(scope, name, BP_VAR_W, &prop_info);
EG(fake_scope) = old_scope;
+1 -1
View File
@@ -1557,7 +1557,7 @@ simple_list:
}
break;
case ZEND_AST_TYPE:
switch (ast->attr) {
switch (ast->attr & ~ZEND_TYPE_NULLABLE) {
case IS_ARRAY: APPEND_STR("array");
case IS_CALLABLE: APPEND_STR("callable");
EMPTY_SWITCH_DEFAULT_CASE();
+3 -3
View File
@@ -1476,7 +1476,7 @@ static inline void class_exists_impl(INTERNAL_FUNCTION_PARAMETERS, int flags, in
}
if (ce) {
RETURN_BOOL((flags == 0 || (ce->ce_flags & flags)) && !(ce->ce_flags & skip_flags));
RETURN_BOOL(((ce->ce_flags & flags) == flags) && !(ce->ce_flags & skip_flags));
} else {
RETURN_FALSE;
}
@@ -1487,7 +1487,7 @@ static inline void class_exists_impl(INTERNAL_FUNCTION_PARAMETERS, int flags, in
Checks if the class exists */
ZEND_FUNCTION(class_exists)
{
class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0, ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT);
class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_LINKED, ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT);
}
/* }}} */
@@ -1495,7 +1495,7 @@ ZEND_FUNCTION(class_exists)
Checks if the class exists */
ZEND_FUNCTION(interface_exists)
{
class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_INTERFACE, 0);
class_exists_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_LINKED|ZEND_ACC_INTERFACE, 0);
}
/* }}} */
+1 -1
View File
@@ -435,7 +435,7 @@ static ZEND_COLD zval *zend_closure_read_property(zval *object, zval *member, in
static ZEND_COLD zval *zend_closure_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return value;
return &EG(error_zval);
}
/* }}} */
+64 -56
View File
@@ -122,21 +122,16 @@ static void zend_destroy_property_info_internal(zval *zv) /* {{{ */
{
zend_property_info *property_info = Z_PTR_P(zv);
zend_string_release_ex(property_info->name, 1);
zend_string_release(property_info->name);
free(property_info);
}
/* }}} */
static zend_string *zend_build_runtime_definition_key(zend_string *name, unsigned char *lex_pos) /* {{{ */
static zend_string *zend_build_runtime_definition_key(zend_string *name, uint32_t start_lineno) /* {{{ */
{
zend_string *result;
char char_pos_buf[32];
size_t char_pos_len = sprintf(char_pos_buf, "%p", lex_pos);
zend_string *filename = CG(active_op_array)->filename;
/* NULL, name length, filename length, last accepting char position length */
result = zend_string_alloc(1 + ZSTR_LEN(name) + ZSTR_LEN(filename) + char_pos_len, 0);
sprintf(ZSTR_VAL(result), "%c%s%s%s", '\0', ZSTR_VAL(name), ZSTR_VAL(filename), char_pos_buf);
zend_string *result = zend_strpprintf(0, "%c%s%s:%" PRIu32 "$%" PRIx32,
'\0', ZSTR_VAL(name), ZSTR_VAL(filename), start_lineno, CG(rtd_key_counter)++);
return zend_new_interned_string(result);
}
/* }}} */
@@ -1005,9 +1000,16 @@ ZEND_API void function_add_ref(zend_function *function) /* {{{ */
GC_ADDREF(op_array->static_variables);
}
}
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
ZEND_MAP_PTR_INIT(op_array->run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void*)));
ZEND_MAP_PTR_SET(op_array->run_time_cache, NULL);
if (CG(compiler_options) & ZEND_COMPILE_PRELOAD) {
ZEND_ASSERT(op_array->fn_flags & ZEND_ACC_PRELOADED);
ZEND_MAP_PTR_NEW(op_array->run_time_cache);
ZEND_MAP_PTR_NEW(op_array->static_variables_ptr);
} else {
ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
ZEND_MAP_PTR_INIT(op_array->run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void*)));
ZEND_MAP_PTR_SET(op_array->run_time_cache, NULL);
}
} else if (function->type == ZEND_INTERNAL_FUNCTION) {
if (function->common.function_name) {
zend_string_addref(function->common.function_name);
@@ -1068,8 +1070,12 @@ ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */
if (UNEXPECTED(!zv)) {
ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(lcname));
ZEND_ASSERT(ce && "Class with lcname should be registered");
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name));
if (ce) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name));
} else {
ZEND_ASSERT(EG(current_execute_data)->func->op_array.fn_flags & ZEND_ACC_PRELOADED);
zend_error_noreturn(E_ERROR, "Class %s wasn't preloaded", Z_STRVAL_P(lcname));
}
return FAILURE;
}
@@ -1082,6 +1088,8 @@ ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */
}
if (zend_do_link_class(ce, lc_parent_name) == FAILURE) {
/* Reload bucket pointer, the hash table may have been reallocated */
zv = zend_hash_find(EG(class_table), Z_STR_P(lcname));
zend_hash_set_bucket_key(EG(class_table), (Bucket *) zv, Z_STR_P(rtd_key));
return FAILURE;
}
@@ -2622,7 +2630,7 @@ static void zend_compile_list_assign(
continue;
}
}
if (elem_ast->kind == ZEND_AST_UNPACK) {
zend_error(E_COMPILE_ERROR,
"Spread operator is not supported in assignments");
@@ -5611,7 +5619,7 @@ static void find_implicit_binds(closure_info *info, zend_ast *params_ast, zend_a
zend_ast_list *param_list = zend_ast_get_list(params_ast);
uint32_t i;
zend_hash_init(&info->uses, param_list->children, NULL, NULL, 0);
zend_hash_init(&info->uses, param_list->children, NULL, NULL, 0);
find_implicit_binds_recursively(info, stmt_ast);
@@ -5911,8 +5919,11 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as
return;
}
key = zend_build_runtime_definition_key(lcname, decl->lex_pos);
zend_hash_update_ptr(CG(function_table), key, op_array);
key = zend_build_runtime_definition_key(lcname, decl->start_lineno);
if (!zend_hash_add_ptr(CG(function_table), key, op_array)) {
zend_error_noreturn(E_ERROR,
"Runtime definition key collision for function %s. This is a bug", ZSTR_VAL(name));
}
if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
opline = zend_emit_op_tmp(result, ZEND_DECLARE_LAMBDA_FUNCTION, NULL, NULL);
@@ -6334,16 +6345,11 @@ void zend_compile_implements(zend_ast *ast) /* {{{ */
}
/* }}} */
static zend_string *zend_generate_anon_class_name(unsigned char *lex_pos) /* {{{ */
static zend_string *zend_generate_anon_class_name(uint32_t start_lineno) /* {{{ */
{
zend_string *result;
char char_pos_buf[32];
size_t char_pos_len = sprintf(char_pos_buf, "%p", lex_pos);
zend_string *filename = CG(active_op_array)->filename;
/* NULL, name length, filename length, last accepting char position length */
result = zend_string_alloc(sizeof("class@anonymous") + ZSTR_LEN(filename) + char_pos_len, 0);
sprintf(ZSTR_VAL(result), "class@anonymous%c%s%s", '\0', ZSTR_VAL(filename), char_pos_buf);
zend_string *result = zend_strpprintf(0, "class@anonymous%c%s:%" PRIu32 "$%" PRIx32,
'\0', ZSTR_VAL(filename), start_lineno, CG(rtd_key_counter)++);
return zend_new_interned_string(result);
}
/* }}} */
@@ -6383,7 +6389,7 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
zend_register_seen_symbol(lcname, ZEND_SYMBOL_CLASS);
} else {
name = zend_generate_anon_class_name(decl->lex_pos);
name = zend_generate_anon_class_name(decl->start_lineno);
lcname = zend_string_tolower(name);
}
lcname = zend_new_interned_string(lcname);
@@ -6495,13 +6501,13 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
if (toplevel
/* We currently don't early-bind classes that implement interfaces or use traits */
&& !(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
&& !(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD)) {
if (extends_ast) {
zend_class_entry *parent_ce = zend_lookup_class_ex(
ce->parent_name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (parent_ce
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD) /* delay inheritance till preloading */
&& ((parent_ce->type != ZEND_INTERNAL_CLASS) || !(CG(compiler_options) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES))
&& ((parent_ce->type != ZEND_USER_CLASS) || !(CG(compiler_options) & ZEND_COMPILE_IGNORE_OTHER_FILES) || (parent_ce->info.user.filename == ce->info.user.filename))) {
@@ -6540,20 +6546,19 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
opline->extended_value = zend_alloc_cache_slot();
opline->result_type = IS_VAR;
opline->result.var = get_temporary_variable();
if (!zend_hash_add_ptr(CG(class_table), lcname, ce)) {
/* this anonymous class has been included */
zval zv;
ZVAL_PTR(&zv, ce);
destroy_zend_class(&zv);
return opline;
zend_error_noreturn(E_ERROR,
"Runtime definition key collision for %s. This is a bug", ZSTR_VAL(name));
}
} else {
zend_string *key = zend_build_runtime_definition_key(lcname, decl->lex_pos);
zend_string *key = zend_build_runtime_definition_key(lcname, decl->start_lineno);
/* RTD key is placed after lcname literal in op1 */
zend_add_literal_string(&key);
zend_hash_update_ptr(CG(class_table), key, ce);
if (!zend_hash_add_ptr(CG(class_table), key, ce)) {
zend_error_noreturn(E_ERROR,
"Runtime definition key collision for class %s. This is a bug", ZSTR_VAL(name));
}
opline->opcode = ZEND_DECLARE_CLASS;
if (extends_ast && toplevel
@@ -7072,7 +7077,7 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
if (elem_ast->kind != ZEND_AST_UNPACK) {
zend_eval_const_expr(&elem_ast->child[0]);
zend_eval_const_expr(&elem_ast->child[1]);
if (elem_ast->attr /* by_ref */ || elem_ast->child[0]->kind != ZEND_AST_ZVAL
|| (elem_ast->child[1] && elem_ast->child[1]->kind != ZEND_AST_ZVAL)
) {
@@ -7080,7 +7085,7 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
}
} else {
zend_eval_const_expr(&elem_ast->child[0]);
if (elem_ast->child[0]->kind != ZEND_AST_ZVAL) {
is_constant = 0;
}
@@ -7121,13 +7126,13 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
}
Z_TRY_ADDREF_P(val);
} ZEND_HASH_FOREACH_END();
continue;
} else {
zend_error_noreturn(E_COMPILE_ERROR, "Only arrays and Traversables can be unpacked");
}
}
}
Z_TRY_ADDREF_P(value);
key_ast = elem_ast->child[1];
@@ -8778,25 +8783,28 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
case ZEND_AST_AND:
case ZEND_AST_OR:
{
int i;
for (i = 0; i <= 1; i++) {
zend_eval_const_expr(&ast->child[i]);
if (ast->child[i]->kind == ZEND_AST_ZVAL) {
if (zend_is_true(zend_ast_get_zval(ast->child[i])) == (ast->kind == ZEND_AST_OR)) {
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
return;
}
}
}
if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {
zend_bool child0_is_true, child1_is_true;
zend_eval_const_expr(&ast->child[0]);
zend_eval_const_expr(&ast->child[1]);
if (ast->child[0]->kind != ZEND_AST_ZVAL) {
return;
}
child0_is_true = zend_is_true(zend_ast_get_zval(ast->child[0]));
if (child0_is_true == (ast->kind == ZEND_AST_OR)) {
ZVAL_BOOL(&result, ast->kind == ZEND_AST_OR);
break;
}
if (ast->child[1]->kind != ZEND_AST_ZVAL) {
return;
}
child1_is_true = zend_is_true(zend_ast_get_zval(ast->child[1]));
if (ast->kind == ZEND_AST_OR) {
ZVAL_BOOL(&result, zend_is_true(zend_ast_get_zval(ast->child[0])) || zend_is_true(zend_ast_get_zval(ast->child[1])));
ZVAL_BOOL(&result, child0_is_true || child1_is_true);
} else {
ZVAL_BOOL(&result, zend_is_true(zend_ast_get_zval(ast->child[0])) && zend_is_true(zend_ast_get_zval(ast->child[1])));
ZVAL_BOOL(&result, child0_is_true && child1_is_true);
}
break;
}
+13 -5
View File
@@ -596,9 +596,6 @@ static zend_never_inline ZEND_COLD int zend_wrong_assign_to_variable_reference(z
Z_TRY_ADDREF_P(value_ptr);
value_ptr = zend_assign_to_variable(variable_ptr, value_ptr, IS_TMP_VAR, EX_USES_STRICT_TYPES());
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value_ptr);
}
return 1;
}
@@ -2372,7 +2369,7 @@ try_string_offset:
offset = Z_LVAL_P(dim);
}
if (UNEXPECTED(Z_STRLEN_P(container) < (size_t)((offset < 0) ? -offset : (offset + 1)))) {
if (UNEXPECTED(Z_STRLEN_P(container) < ((offset < 0) ? -(size_t)offset : ((size_t)offset + 1)))) {
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
ZVAL_EMPTY_STRING(result);
@@ -3187,7 +3184,9 @@ ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *value, zend_uc
Z_TRY_DELREF_P(value);
}
if (!ret) {
zval_ptr_dtor(value);
if (value_type & (IS_VAR|IS_TMP_VAR)) {
zval_ptr_dtor(value);
}
return Z_REFVAL_P(variable_ptr);
}
@@ -3606,6 +3605,13 @@ ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function_str(const char *name,
return NULL;
} /* }}} */
ZEND_API void ZEND_FASTCALL zend_init_func_run_time_cache(zend_op_array *op_array) /* {{{ */
{
if (!RUN_TIME_CACHE(op_array)) {
init_func_run_time_cache_i(op_array);
}
} /* }}} */
static zend_always_inline void i_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
{
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
@@ -4186,6 +4192,8 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_include_or_eval(zval
if (zend_hash_exists(&EG(included_files), resolved_path)) {
goto already_compiled;
}
} else if (UNEXPECTED(EG(exception))) {
break;
} else if (UNEXPECTED(strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename))) {
zend_message_dispatcher(
(type == ZEND_INCLUDE_ONCE) ?
+1
View File
@@ -311,6 +311,7 @@ ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zen
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function(zend_string *name);
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function_str(const char *name, size_t len);
ZEND_API void ZEND_FASTCALL zend_init_func_run_time_cache(zend_op_array *op_array);
ZEND_API void zend_fetch_dimension_const(zval *result, zval *container, zval *dim, int type);
+4
View File
@@ -890,6 +890,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
zend_string *lc_name;
zend_fcall_info fcall_info;
zend_fcall_info_cache fcall_cache;
zend_class_entry *orig_fake_scope;
if (key) {
lc_name = key;
@@ -986,11 +987,14 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
fcall_cache.called_scope = NULL;
fcall_cache.object = NULL;
orig_fake_scope = EG(fake_scope);
EG(fake_scope) = NULL;
zend_exception_save();
if ((zend_call_function(&fcall_info, &fcall_cache) == SUCCESS) && !EG(exception)) {
ce = zend_hash_find_ptr(EG(class_table), lc_name);
}
zend_exception_restore();
EG(fake_scope) = orig_fake_scope;
zval_ptr_dtor(&args[0]);
zval_ptr_dtor_str(&fcall_info.function_name);
+8 -6
View File
@@ -1547,11 +1547,11 @@ ZEND_API int zend_gc_collect_cycles(void)
}
}
/* Destroy zvals */
/* Destroy zvals. The root buffer may be reallocated. */
GC_TRACE("Destroying zvals");
current = GC_IDX2PTR(GC_FIRST_ROOT);
last = GC_IDX2PTR(GC_G(first_unused));
while (current != last) {
idx = GC_FIRST_ROOT;
while (idx != end) {
current = GC_IDX2PTR(idx);
if (GC_IS_GARBAGE(current->ref)) {
p = GC_GET_PTR(current->ref);
GC_TRACE_REF(p, "destroying");
@@ -1561,6 +1561,8 @@ ZEND_API int zend_gc_collect_cycles(void)
EG(objects_store).object_buckets[obj->handle] = SET_OBJ_INVALID(obj);
GC_TYPE_INFO(obj) = IS_NULL |
(GC_TYPE_INFO(obj) & ~GC_TYPE_MASK);
/* Modify current before calling free_obj (bug #78811: free_obj() can cause the root buffer (with current) to be reallocated.) */
current->ref = GC_MAKE_GARBAGE(((char*)obj) - obj->handlers->offset);
if (!(OBJ_FLAGS(obj) & IS_OBJ_FREE_CALLED)) {
GC_ADD_FLAGS(obj, IS_OBJ_FREE_CALLED);
GC_ADDREF(obj);
@@ -1569,7 +1571,6 @@ ZEND_API int zend_gc_collect_cycles(void)
}
ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(obj->handle);
current->ref = GC_MAKE_GARBAGE(((char*)obj) - obj->handlers->offset);
} else if (GC_TYPE(p) == IS_ARRAY) {
zend_array *arr = (zend_array*)p;
@@ -1582,11 +1583,12 @@ ZEND_API int zend_gc_collect_cycles(void)
zend_hash_destroy(arr);
}
}
current++;
idx++;
}
/* Free objects */
current = GC_IDX2PTR(GC_FIRST_ROOT);
last = GC_IDX2PTR(end);
while (current != last) {
if (GC_IS_GARBAGE(current->ref)) {
p = GC_GET_PTR(current->ref);
+48 -26
View File
@@ -95,9 +95,10 @@ ZEND_API zend_execute_data* zend_generator_freeze_call_stack(zend_execute_data *
static void zend_generator_cleanup_unfinished_execution(
zend_generator *generator, zend_execute_data *execute_data, uint32_t catch_op_num) /* {{{ */
{
if (execute_data->opline != execute_data->func->op_array.opcodes) {
zend_op_array *op_array = &execute_data->func->op_array;
if (execute_data->opline != op_array->opcodes) {
/* -1 required because we want the last run opcode, not the next to-be-run one. */
uint32_t op_num = execute_data->opline - execute_data->func->op_array.opcodes - 1;
uint32_t op_num = execute_data->opline - op_array->opcodes - 1;
if (UNEXPECTED(generator->frozen_call_stack)) {
/* Temporarily restore generator->execute_data if it has been NULLed out already. */
@@ -106,6 +107,7 @@ static void zend_generator_cleanup_unfinished_execution(
zend_generator_restore_call_stack(generator);
generator->execute_data = save_ex;
}
zend_cleanup_unfinished_execution(execute_data, op_num, catch_op_num);
}
}
@@ -166,7 +168,7 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
{
zend_generator *generator = (zend_generator*) object;
zend_execute_data *ex = generator->execute_data;
uint32_t op_num, finally_op_num, finally_op_end;
uint32_t op_num, try_catch_offset;
int i;
/* leave yield from mode to properly allow finally execution */
@@ -194,38 +196,57 @@ static void zend_generator_dtor_storage(zend_object *object) /* {{{ */
/* -1 required because we want the last run opcode, not the
* next to-be-run one. */
op_num = ex->opline - ex->func->op_array.opcodes - 1;
try_catch_offset = -1;
/* Find next finally block */
finally_op_num = 0;
finally_op_end = 0;
/* Find the innermost try/catch that we are inside of. */
for (i = 0; i < ex->func->op_array.last_try_catch; i++) {
zend_try_catch_element *try_catch = &ex->func->op_array.try_catch_array[i];
if (op_num < try_catch->try_op) {
break;
}
if (op_num < try_catch->finally_op) {
finally_op_num = try_catch->finally_op;
finally_op_end = try_catch->finally_end;
if (op_num < try_catch->catch_op || op_num < try_catch->finally_end) {
try_catch_offset = i;
}
}
/* If a finally block was found we jump directly to it and
* resume the generator. */
if (finally_op_num) {
zval *fast_call;
/* Walk try/catch/finally structures upwards, performing the necessary actions. */
while (try_catch_offset != (uint32_t) -1) {
zend_try_catch_element *try_catch = &ex->func->op_array.try_catch_array[try_catch_offset];
zend_generator_cleanup_unfinished_execution(generator, ex, finally_op_num);
if (op_num < try_catch->finally_op) {
/* Go to finally block */
zval *fast_call =
ZEND_CALL_VAR(ex, ex->func->op_array.opcodes[try_catch->finally_end].op1.var);
fast_call = ZEND_CALL_VAR(ex, ex->func->op_array.opcodes[finally_op_end].op1.var);
Z_OBJ_P(fast_call) = EG(exception);
EG(exception) = NULL;
Z_OPLINE_NUM_P(fast_call) = (uint32_t)-1;
zend_generator_cleanup_unfinished_execution(generator, ex, try_catch->finally_op);
Z_OBJ_P(fast_call) = EG(exception);
EG(exception) = NULL;
Z_OPLINE_NUM_P(fast_call) = (uint32_t)-1;
ex->opline = &ex->func->op_array.opcodes[finally_op_num];
generator->flags |= ZEND_GENERATOR_FORCED_CLOSE;
zend_generator_resume(generator);
ex->opline = &ex->func->op_array.opcodes[try_catch->finally_op];
generator->flags |= ZEND_GENERATOR_FORCED_CLOSE;
zend_generator_resume(generator);
/* TODO: If we hit another yield inside try/finally,
* should we also jump to the next finally block? */
return;
} else if (op_num < try_catch->finally_end) {
zval *fast_call =
ZEND_CALL_VAR(ex, ex->func->op_array.opcodes[try_catch->finally_end].op1.var);
/* Clean up incomplete return statement */
if (Z_OPLINE_NUM_P(fast_call) != (uint32_t) -1) {
zend_op *retval_op = &ex->func->op_array.opcodes[Z_OPLINE_NUM_P(fast_call)];
if (retval_op->op2_type & (IS_TMP_VAR | IS_VAR)) {
zval_ptr_dtor(ZEND_CALL_VAR(ex, retval_op->op2.var));
}
}
/* Clean up backed-up exception */
if (Z_OBJ_P(fast_call)) {
OBJ_RELEASE(Z_OBJ_P(fast_call));
}
}
try_catch_offset--;
}
}
/* }}} */
@@ -824,9 +845,10 @@ try_again:
if (UNEXPECTED(EG(exception) != NULL)) {
if (generator == orig_generator) {
zend_generator_close(generator, 0);
if (EG(current_execute_data) &&
EG(current_execute_data)->func &&
ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
if (!EG(current_execute_data)) {
zend_throw_exception_internal(NULL);
} else if (EG(current_execute_data)->func &&
ZEND_USER_CODE(EG(current_execute_data)->func->common.type)) {
zend_rethrow_exception(EG(current_execute_data));
}
} else {
+2
View File
@@ -127,6 +127,8 @@ struct _zend_compiler_globals {
HashTable *delayed_variance_obligations;
HashTable *delayed_autoloads;
uint32_t rtd_key_counter;
};
+7 -10
View File
@@ -812,7 +812,7 @@ static zend_always_inline inheritance_status do_inheritance_check_on_method_ex(z
parent = proto;
}
if (!check_only && child_zv && child->common.prototype != proto) {
if (!check_only && child->common.prototype != proto) {
do {
if (child->common.scope != ce
&& child->type == ZEND_USER_FUNCTION
@@ -820,7 +820,7 @@ static zend_always_inline inheritance_status do_inheritance_check_on_method_ex(z
if (ce->ce_flags & ZEND_ACC_INTERFACE) {
/* Few parent interfaces contain the same method */
break;
} else {
} else if (child_zv) {
/* op_array wasn't duplicated yet */
zend_function *new_function = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
memcpy(new_function, child, sizeof(zend_op_array));
@@ -936,7 +936,7 @@ static void emit_incompatible_property_error(
zend_error_noreturn(E_COMPILE_ERROR,
"Type of %s::$%s must be %s%s (as in class %s)",
ZSTR_VAL(child->ce->name),
ZSTR_VAL(child->name),
zend_get_unmangled_property_name(child->name),
ZEND_TYPE_ALLOW_NULL(parent->type) ? "?" : "",
ZEND_TYPE_IS_CLASS(parent->type)
? ZSTR_VAL(ZEND_TYPE_IS_CE(parent->type) ? ZEND_TYPE_CE(parent->type)->name : resolve_class_name(parent->ce, ZEND_TYPE_NAME(parent->type)))
@@ -1585,17 +1585,14 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
}
zend_hash_update_mem(*overridden, key, fn, sizeof(zend_function));
return;
} else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT &&
(existing_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0) {
/* Make sure the trait method is compatible with previosly declared abstract method */
perform_delayable_implementation_check(
ce, fn, existing_fn, /*always_error*/ 1);
} else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
} else if ((fn->common.fn_flags & ZEND_ACC_ABSTRACT)
&& !(existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT)) {
/* Make sure the abstract declaration is compatible with previous declaration */
perform_delayable_implementation_check(
ce, existing_fn, fn, /*always_error*/ 1);
return;
} else if (UNEXPECTED(existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)) {
} else if (UNEXPECTED((existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)
&& !(existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT))) {
/* two traits can't define the same non-abstract method */
#if 1
zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s",
+1 -1
View File
@@ -310,7 +310,7 @@ static void zval_ini_dtor(zval *zv)
%left '|' '&' '^'
%right '~' '!'
%destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL
%destructor { zval_ini_dtor(&$$); } TC_RAW TC_CONSTANT TC_NUMBER TC_STRING TC_WHITESPACE TC_LABEL TC_OFFSET TC_VARNAME BOOL_TRUE BOOL_FALSE NULL_NULL cfg_var_ref constant_literal constant_string encapsed_list expr option_offset section_string_or_value string_or_value var_string_list var_string_list_section
%%
+7 -5
View File
@@ -637,11 +637,13 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type)
zend_save_lexical_state(&original_lex_state);
if (open_file_for_scanning(file_handle)==FAILURE) {
if (type==ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
zend_bailout();
} else {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
if (!EG(exception)) {
if (type==ZEND_REQUIRE) {
zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
zend_bailout();
} else {
zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
}
}
} else {
op_array = zend_compile(ZEND_USER_FUNCTION);
+25 -4
View File
@@ -679,6 +679,10 @@ ZEND_API zval *zend_std_read_property(zval *object, zval *member, int type, void
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
goto exit;
}
if (UNEXPECTED(Z_PROP_FLAG_P(retval) == IS_PROP_UNINIT)) {
/* Skip __get() for uninitialized typed properties */
goto uninit_error;
}
} else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) {
if (EXPECTED(zobj->properties != NULL)) {
if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET(property_offset)) {
@@ -782,6 +786,7 @@ call_getter:
}
}
uninit_error:
if (type != BP_VAR_IS) {
if (UNEXPECTED(prop_info)) {
zend_throw_error(NULL, "Typed property %s::$%s must not be accessed before initialization",
@@ -1044,8 +1049,16 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
if (EXPECTED(!zobj->ce->__get) ||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
ZVAL_NULL(retval);
zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
if (UNEXPECTED(prop_info)) {
zend_throw_error(NULL,
"Typed property %s::$%s must not be accessed before initialization",
ZSTR_VAL(prop_info->ce->name),
ZSTR_VAL(name));
retval = &EG(error_zval);
} else {
ZVAL_NULL(retval);
zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
}
} else {
/* we do have getter - fail and let it try again with usual get/set */
@@ -1118,8 +1131,11 @@ ZEND_API void zend_std_unset_property(zval *object, zval *member, void **cache_s
}
goto exit;
}
/* Reset the IS_PROP_UNINIT flag, if it exists. */
Z_PROP_FLAG_P(slot) = 0;
if (UNEXPECTED(Z_PROP_FLAG_P(slot) == IS_PROP_UNINIT)) {
/* Reset the IS_PROP_UNINIT flag, if it exists and bypass __unset(). */
Z_PROP_FLAG_P(slot) = 0;
goto exit;
}
} else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))
&& EXPECTED(zobj->properties != NULL)) {
if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) {
@@ -1678,6 +1694,11 @@ ZEND_API int zend_std_has_property(zval *object, zval *member, int has_set_exist
if (Z_TYPE_P(value) != IS_UNDEF) {
goto found;
}
if (UNEXPECTED(Z_PROP_FLAG_P(value) == IS_PROP_UNINIT)) {
/* Skip __isset() for uninitialized typed properties */
result = 0;
goto exit;
}
} else if (EXPECTED(IS_DYNAMIC_PROPERTY_OFFSET(property_offset))) {
if (EXPECTED(zobj->properties != NULL)) {
if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET(property_offset)) {
+1 -1
View File
@@ -35,7 +35,7 @@
#include "zend_multiply.h"
#include "zend_object_handlers.h"
#define LONG_SIGN_MASK (((zend_long)1) << (8*sizeof(zend_long)-1))
#define LONG_SIGN_MASK ZEND_LONG_MIN
BEGIN_EXTERN_C()
ZEND_API int ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2);
+6
View File
@@ -427,6 +427,7 @@ struct _zend_ast_ref {
/* internal types */
#define IS_INDIRECT 13
#define IS_PTR 14
#define IS_ALIAS_PTR 15
#define _IS_ERROR 15
/* fake types used only for type hinting (Z_TYPE(zv) can not use them) */
@@ -964,6 +965,11 @@ static zend_always_inline uint32_t zval_gc_info(uint32_t gc_type_info) {
Z_TYPE_INFO_P(z) = IS_PTR; \
} while (0)
#define ZVAL_ALIAS_PTR(z, p) do { \
Z_PTR_P(z) = (p); \
Z_TYPE_INFO_P(z) = IS_ALIAS_PTR; \
} while (0)
#define ZVAL_ERROR(z) do { \
Z_TYPE_INFO_P(z) = _IS_ERROR; \
} while (0)
+27 -8
View File
@@ -1018,8 +1018,10 @@ ZEND_VM_COLD_CONST_HANDLER(14, ZEND_BOOL_NOT, CONST|TMPVAR|CV, ANY)
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_FALSE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_TRUE(EX_VAR(opline->result.var));
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (OP1_TYPE == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -2493,6 +2495,9 @@ ZEND_VM_C_LABEL(assign_object):
} else {
ZEND_VM_C_LABEL(fast_assign_obj):
value = zend_assign_to_variable(property_val, value, OP_DATA_TYPE, EX_USES_STRICT_TYPES());
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
ZEND_VM_C_GOTO(exit_assign_obj);
}
}
@@ -2540,6 +2545,9 @@ ZEND_VM_C_LABEL(fast_assign_obj):
}
}
zend_hash_add_new(zobj->properties, Z_STR_P(property), value);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
ZEND_VM_C_GOTO(exit_assign_obj);
}
}
@@ -2552,11 +2560,11 @@ ZEND_VM_C_LABEL(fast_assign_obj):
value = Z_OBJ_HT_P(object)->write_property(object, property, value, (OP2_TYPE == IS_CONST) ? CACHE_ADDR(opline->extended_value) : NULL);
ZEND_VM_C_LABEL(free_and_exit_assign_obj):
FREE_OP_DATA();
ZEND_VM_C_LABEL(exit_assign_obj):
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_COPY(EX_VAR(opline->result.var), value);
}
FREE_OP_DATA();
ZEND_VM_C_LABEL(exit_assign_obj):
FREE_OP2();
FREE_OP1_VAR_PTR();
/* assign_obj has two opcodes! */
@@ -2865,6 +2873,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
{
zend_execute_data *old_execute_data;
uint32_t call_info = EX_CALL_INFO();
SAVE_OPLINE();
if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED)) == 0)) {
i_free_compiled_variables(execute_data);
@@ -3813,11 +3822,11 @@ ZEND_VM_C_LABEL(try_function_name):
call = NULL;
}
FREE_OP2();
if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
FREE_OP2();
if (OP2_TYPE & (IS_VAR|IS_TMP_VAR)) {
if (UNEXPECTED(EG(exception))) {
if (call) {
@@ -3829,8 +3838,6 @@ ZEND_VM_C_LABEL(try_function_name):
}
HANDLE_EXCEPTION();
}
} else if (UNEXPECTED(!call)) {
HANDLE_EXCEPTION();
}
call->prev_execute_data = EX(call);
@@ -4327,7 +4334,11 @@ ZEND_VM_INLINE_HANDLER(62, ZEND_RETURN, CONST|TMP|VAR|CV, ANY)
if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
ZVAL_COPY_VALUE(return_value, retval_ptr);
if (GC_MAY_LEAK(ref)) {
gc_possible_root(ref);
}
ZVAL_NULL(retval_ptr);
break;
} else {
@@ -5319,8 +5330,10 @@ ZEND_VM_COLD_CONST_HANDLER(52, ZEND_BOOL, CONST|TMPVAR|CV, ANY)
if (Z_TYPE_INFO_P(val) == IS_TRUE) {
ZVAL_TRUE(EX_VAR(opline->result.var));
} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
/* The result and op1 can be the same cv zval */
const uint32_t orig_val_type = Z_TYPE_INFO_P(val);
ZVAL_FALSE(EX_VAR(opline->result.var));
if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
if (OP1_TYPE == IS_CV && UNEXPECTED(orig_val_type == IS_UNDEF)) {
SAVE_OPLINE();
ZVAL_UNDEFINED_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
@@ -7280,6 +7293,8 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_CLASS_DELAYED, CONST, CONST)
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name));
} else {
if (zend_do_link_class(ce, Z_STR_P(RT_CONSTANT(opline, opline->op2))) == FAILURE) {
/* Reload bucket pointer, the hash table may have been reallocated */
zv = zend_hash_find(EG(class_table), Z_STR_P(lcname));
zend_hash_set_bucket_key(EG(class_table), (Bucket *) zv, Z_STR_P(lcname + 1));
HANDLE_EXCEPTION();
}
@@ -7300,12 +7315,16 @@ ZEND_VM_HANDLER(146, ZEND_DECLARE_ANON_CLASS, ANY, ANY, CACHE_SLOT)
if (UNEXPECTED(ce == NULL)) {
zend_string *rtd_key = Z_STR_P(RT_CONSTANT(opline, opline->op1));
zv = zend_hash_find_ex(EG(class_table), rtd_key, 1);
if (UNEXPECTED(zv == NULL)) {
SAVE_OPLINE();
ZEND_ASSERT(EX(func)->op_array.fn_flags & ZEND_ACC_PRELOADED);
zend_error_noreturn(E_ERROR, "Anonymous class wasn't preloaded");
}
ZEND_ASSERT(zv != NULL);
ce = Z_CE_P(zv);
if (!(ce->ce_flags & ZEND_ACC_LINKED)) {
SAVE_OPLINE();
if (zend_do_link_class(ce, (OP2_TYPE == IS_CONST) ? Z_STR_P(RT_CONSTANT(opline, opline->op2)) : NULL) == FAILURE) {
zend_hash_set_bucket_key(EG(class_table), (Bucket *) zv, rtd_key);
HANDLE_EXCEPTION();
}
}
+348 -86
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -17,7 +17,7 @@ dnl Basic autoconf initialization, generation of config.nice.
dnl ----------------------------------------------------------------------------
AC_PREREQ([2.68])
AC_INIT([PHP],[7.4.0-dev],[https://bugs.php.net],[php],[https://www.php.net])
AC_INIT([PHP],[7.4.2],[https://bugs.php.net],[php],[https://www.php.net])
AC_CONFIG_SRCDIR([main/php_version.h])
AC_CONFIG_AUX_DIR([build])
AC_PRESERVE_HELP_ORDER
+2 -2
View File
@@ -56,9 +56,9 @@ bc_str2num (bc_num *num, char *str, int scale)
zero_int = FALSE;
if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */
while (*ptr == '0') ptr++; /* Skip leading zeros. */
while (isdigit((int)*ptr)) ptr++, digits++; /* digits */
while (*ptr >= '0' && *ptr <= '9') ptr++, digits++; /* digits */
if (*ptr == '.') ptr++; /* decimal point */
while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */
while (*ptr >= '0' && *ptr <= '9') ptr++, strscale++; /* digits */
if ((*ptr != '\0') || (digits+strscale == 0))
{
*num = bc_copy_num (BCG(_zero_));
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #78878 (Buffer underflow in bc_shift_addsub)
--SKIPIF--
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
?>
--FILE--
<?php
print @bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4));
?>
--EXPECT--
0
+18 -9
View File
@@ -23,14 +23,10 @@ if test "$PHP_CURL" != "no"; then
esac
if test "$CURL_SSL" = yes; then
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $CURL_CFLAGS"
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $CURL_LIBS"
AC_MSG_CHECKING([for openssl support in libcurl])
AC_MSG_CHECKING([for libcurl linked against old openssl])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <strings.h>
#include <curl/curl.h>
@@ -43,21 +39,34 @@ int main(int argc, char *argv[])
const char *ptr = data->ssl_version;
while(*ptr == ' ') ++ptr;
return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1);
if (strncasecmp(ptr, "OpenSSL/1.1", sizeof("OpenSSL/1.1")-1) == 0) {
/* New OpenSSL version */
return 3;
}
if (strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1) == 0) {
/* Old OpenSSL version */
return 0;
}
/* Different SSL library */
return 2;
}
/* No SSL support */
return 1;
}
]])],[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
AC_CHECK_HEADERS([openssl/crypto.h])
AC_DEFINE([HAVE_CURL_OLD_OPENSSL], [1], [Have cURL with old OpenSSL])
PKG_CHECK_MODULES([OPENSSL], [openssl], [
PHP_EVAL_LIBLINE($OPENSSL_LIBS, CURL_SHARED_LIBADD)
PHP_EVAL_INCLINE($OPENSSL_CFLAGS)
AC_CHECK_HEADERS([openssl/crypto.h])
], [])
], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"
else
AC_MSG_RESULT([no])
-1
View File
@@ -28,7 +28,6 @@ if (PHP_CURL != "no") {
) {
EXTENSION("curl", "interface.c multi.c share.c curl_file.c");
AC_DEFINE('HAVE_CURL', 1, 'Have cURL library');
AC_DEFINE('HAVE_CURL_SSL', 1, 'Have SSL suppurt in cURL');
ADD_FLAG("CFLAGS_CURL", "/D CURL_STATICLIB");
// TODO: check for curl_version_info
} else {
+12 -15
View File
@@ -43,22 +43,17 @@
#endif
/* {{{ cruft for thread safe SSL crypto locks */
#if defined(ZTS) && defined(HAVE_CURL_SSL)
# ifdef PHP_WIN32
#if defined(ZTS) && defined(HAVE_CURL_OLD_OPENSSL)
# if defined(HAVE_OPENSSL_CRYPTO_H)
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# elif defined(HAVE_CURL_OPENSSL)
# if defined(HAVE_OPENSSL_CRYPTO_H)
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# else
# warning \
# else
# warning \
"libcurl was compiled with OpenSSL support, but configure could not find " \
"openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \
"cause random crashes on SSL requests"
# endif
# endif /* HAVE_CURL_OPENSSL */
#endif /* ZTS && HAVE_CURL_SSL */
# endif
#endif /* ZTS && HAVE_CURL_OLD_OPENSSL */
/* }}} */
#define SMART_STR_PREALLOC 4096
@@ -2754,7 +2749,7 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
zend_string *string_key;
zend_ulong num_key;
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
curl_mime *mime;
curl_mime *mime = NULL;
curl_mimepart *part;
CURLcode form_error;
#else
@@ -2769,9 +2764,11 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
}
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
mime = curl_mime_init(ch->cp);
if (mime == NULL) {
return FAILURE;
if (zend_hash_num_elements(postfields) > 0) {
mime = curl_mime_init(ch->cp);
if (mime == NULL) {
return FAILURE;
}
}
#endif
+1
View File
@@ -3,6 +3,7 @@ Bug #78775: TLS issues from HTTP request affecting other encrypted connections
--SKIPIF--
<?php
if (!extension_loaded('curl')) die('skip Requires curl');
if (!extension_loaded('openssl')) die('skip Requires openssl');
if (getenv('SKIP_ONLINE_TESTS')) die('skip Online test');
?>
--FILE--
+29
View File
@@ -0,0 +1,29 @@
--TEST--
Bug #79033 (Curl timeout error with specific url and post)
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "{$host}/get.inc?test=post",
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => [],
CURLINFO_HEADER_OUT => true,
CURLOPT_RETURNTRANSFER => true,
]);
var_dump(curl_exec($ch));
var_dump(curl_getinfo($ch)["request_header"]);
?>
--EXPECTF--
string(%d) "array(0) {
}
"
string(90) "POST /get.inc?test=post HTTP/1.1
Host: localhost:%d
Accept: */*
Content-Length: 0
"
+7 -5
View File
@@ -4426,14 +4426,16 @@ static int php_date_interval_initialize_from_hash(zval **return_value, php_inter
PHP_DATE_INTERVAL_READ_PROPERTY("h", h, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("i", i, timelib_sll, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("s", s, timelib_sll, -1)
do {
{
zval *z_arg = zend_hash_str_find(myht, "f", sizeof("f") - 1);
(*intobj)->diff->us = -1000000;
if (z_arg) {
(*intobj)->diff->us = ((double)zval_get_double(z_arg) * 1000000);
} else {
(*intobj)->diff->us = (double) -1000000;
double val = zval_get_double(z_arg) * 1000000;
if (val >= 0 && val < 1000000) {
(*intobj)->diff->us = val;
}
}
} while (0);
}
PHP_DATE_INTERVAL_READ_PROPERTY("weekday", weekday, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("weekday_behavior", weekday_behavior, int, -1)
PHP_DATE_INTERVAL_READ_PROPERTY("first_last_day_of", first_last_day_of, int, -1)
-208
View File
@@ -1,208 +0,0 @@
--TEST--
Test DateTime class registration
--FILE--
<?php
echo "*** Verify DateTime class ***\n";
echo "Verify DateTime class registered OK\n";
$class = new ReflectionClass('DateTime');
var_dump($class);
echo "..and get names of all its methods\n";
$methods = $class->getMethods();
var_dump($methods);
echo "..and get names of all its class constants\n";
$constants = $class->getConstants();
var_dump($constants);
echo "..and get __set_state arguments\n";
$method = new ReflectionMethod('DateTime', '__set_state');
var_dump($method->getParameters());
var_dump($method->getParameters()[0]->isOptional());
?>
===DONE===
--EXPECTF--
*** Verify DateTime class ***
Verify DateTime class registered OK
object(ReflectionClass)#%d (1) {
["name"]=>
string(8) "DateTime"
}
..and get names of all its methods
array(19) {
[0]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(11) "__construct"
["class"]=>
string(8) "DateTime"
}
[1]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(8) "__wakeup"
["class"]=>
string(8) "DateTime"
}
[2]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(11) "__set_state"
["class"]=>
string(8) "DateTime"
}
[3]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(19) "createFromImmutable"
["class"]=>
string(8) "DateTime"
}
[4]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(16) "createFromFormat"
["class"]=>
string(8) "DateTime"
}
[5]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(13) "getLastErrors"
["class"]=>
string(8) "DateTime"
}
[6]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(6) "format"
["class"]=>
string(8) "DateTime"
}
[7]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(6) "modify"
["class"]=>
string(8) "DateTime"
}
[8]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(3) "add"
["class"]=>
string(8) "DateTime"
}
[9]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(3) "sub"
["class"]=>
string(8) "DateTime"
}
[10]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(11) "getTimezone"
["class"]=>
string(8) "DateTime"
}
[11]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(11) "setTimezone"
["class"]=>
string(8) "DateTime"
}
[12]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(9) "getOffset"
["class"]=>
string(8) "DateTime"
}
[13]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(7) "setTime"
["class"]=>
string(8) "DateTime"
}
[14]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(7) "setDate"
["class"]=>
string(8) "DateTime"
}
[15]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(10) "setISODate"
["class"]=>
string(8) "DateTime"
}
[16]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(12) "setTimestamp"
["class"]=>
string(8) "DateTime"
}
[17]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(12) "getTimestamp"
["class"]=>
string(8) "DateTime"
}
[18]=>
object(ReflectionMethod)#%d (2) {
["name"]=>
string(4) "diff"
["class"]=>
string(8) "DateTime"
}
}
..and get names of all its class constants
array(13) {
["ATOM"]=>
string(13) "Y-m-d\TH:i:sP"
["COOKIE"]=>
string(16) "l, d-M-Y H:i:s T"
["ISO8601"]=>
string(13) "Y-m-d\TH:i:sO"
["RFC822"]=>
string(16) "D, d M y H:i:s O"
["RFC850"]=>
string(16) "l, d-M-y H:i:s T"
["RFC1036"]=>
string(16) "D, d M y H:i:s O"
["RFC1123"]=>
string(16) "D, d M Y H:i:s O"
["RFC7231"]=>
string(21) "D, d M Y H:i:s \G\M\T"
["RFC2822"]=>
string(16) "D, d M Y H:i:s O"
["RFC3339"]=>
string(13) "Y-m-d\TH:i:sP"
["RFC3339_EXTENDED"]=>
string(15) "Y-m-d\TH:i:s.vP"
["RSS"]=>
string(16) "D, d M Y H:i:s O"
["W3C"]=>
string(13) "Y-m-d\TH:i:sP"
}
..and get __set_state arguments
array(1) {
[0]=>
object(ReflectionParameter)#%d (1) {
["name"]=>
string(5) "array"
}
}
bool(false)
===DONE===
+42
View File
@@ -0,0 +1,42 @@
--TEST--
Bug #79015 (undefined-behavior in php_date.c)
--FILE--
<?php
$payload = 'O:12:"DateInterval":16:{s:1:"y";i:1;s:1:"m";i:0;s:1:"d";i:4;s:1:"h";i:0;s:1:"i";i:0;s:1:"s";i:0;s:1:"f";i:9999999999990;s:7:"weekday";i:0;s:16:"weekday_behavior";i:0;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";b:0;s:12:"special_type";i:0;s:14:"special_amount";i:0;s:21:"have_weekday_relative";i:0;s:21:"have_special_relative";i:0;}';
var_dump(unserialize($payload));
?>
--EXPECTF--
object(DateInterval)#%d (16) {
["y"]=>
int(1)
["m"]=>
int(0)
["d"]=>
int(4)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(-1)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
+16
View File
@@ -43,10 +43,18 @@ DBA_OPEN_FUNC(lmdb)
MDB_env *env;
MDB_txn *txn;
int rc, mode = 0644, flags = MDB_NOSUBDIR;
zend_long mapsize = 0;
if(info->argc > 0) {
mode = zval_get_long(&info->argv[0]);
if (info->argc > 1) {
mapsize = zval_get_long(&info->argv[1]);
if (mapsize < 0) {
*error = "mapsize must be greater than or equal to zero";
return FAILURE;
}
}
/* TODO implement handling of the additional flags. */
}
@@ -56,6 +64,14 @@ DBA_OPEN_FUNC(lmdb)
return FAILURE;
}
if (mapsize > 0) {
rc = mdb_env_set_mapsize(env, (size_t) mapsize);
if (rc) {
*error = mdb_strerror(rc);
return FAILURE;
}
}
rc = mdb_env_open(env, info->path, flags, mode);
if (rc) {
*error = mdb_strerror(rc);
+25
View File
@@ -0,0 +1,25 @@
--TEST--
Bug #78808 ([LMDB] MDB_MAP_FULL: Environment mapsize limit reached)
--SKIPIF--
<?php
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
$handler = 'lmdb';
require_once __DIR__ .'/skipif.inc';
?>
--FILE--
<?php
$handler = 'lmdb';
require_once __DIR__ .'/test.inc';
$lmdb_h = dba_open($db_filename, 'c', 'lmdb', 0644, 5*1048576);
for ($i = 0; $i < 50000; $i++) {
dba_insert('key' . $i, 'value '. $i, $lmdb_h);
}
dba_close($lmdb_h);
echo "done\n";
?>
--EXPECT--
done
--CLEAN--
<?php
require_once dirname(__FILE__) .'/clean.inc';
?>
+28 -5
View File
@@ -1697,6 +1697,27 @@ static int exif_rewrite_tag_format_to_unsigned(int format)
}
/* }}} */
/* Use saturation for out of bounds values to avoid UB */
static size_t float_to_size_t(float x) {
if (x < 0.0f || zend_isnan(x)) {
return 0;
} else if (x > (float) SIZE_MAX) {
return SIZE_MAX;
} else {
return (size_t) x;
}
}
static size_t double_to_size_t(double x) {
if (x < 0.0 || zend_isnan(x)) {
return 0;
} else if (x > (double) SIZE_MAX) {
return SIZE_MAX;
} else {
return (size_t) x;
}
}
/* {{{ exif_convert_any_to_int
* Evaluate number, be it int, rational, or float from directory. */
static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel)
@@ -1735,12 +1756,12 @@ static size_t exif_convert_any_to_int(void *value, int format, int motorola_inte
#ifdef EXIF_DEBUG
php_error_docref(NULL, E_NOTICE, "Found value of type single");
#endif
return (size_t) php_ifd_get_float(value);
return float_to_size_t(php_ifd_get_float(value));
case TAG_FMT_DOUBLE:
#ifdef EXIF_DEBUG
php_error_docref(NULL, E_NOTICE, "Found value of type double");
#endif
return (size_t) php_ifd_get_double(value);
return double_to_size_t(php_ifd_get_double(value));
}
return 0;
}
@@ -3129,7 +3150,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
/*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s)", maker_note->make?maker_note->make:"");*/
if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make)))
continue;
if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
if (maker_note->id_string && value_len >= maker_note->id_string_len
&& strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len))
continue;
break;
}
@@ -3203,8 +3225,9 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
}
for (de=0;de<NumDirEntries;de++) {
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
size_t offset = 2 + 12 * de;
if (!exif_process_IFD_TAG(ImageInfo, dir_start + offset,
offset_base, data_len - offset, displacement, section_index, 0, maker_note->tag_table)) {
return FALSE;
}
}
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #78793: Use-after-free in exif parsing under memory sanitizer
--FILE--
<?php
$f = "ext/exif/tests/bug77950.tiff";
for ($i = 0; $i < 10; $i++) {
@exif_read_data($f);
}
?>
===DONE===
--EXPECT--
===DONE===
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #78910: Heap-buffer-overflow READ in exif (OSS-Fuzz #19044)
--FILE--
<?php
var_dump(exif_read_data('data:image/jpg;base64,TU0AKgAAAAwgICAgAAIBDwAEAAAAAgAAACKSfCAgAAAAAEZVSklGSUxN'));
?>
--EXPECTF--
Notice: exif_read_data(): Read from TIFF: tag(0x927C, MakerNote): Illegal format code 0x2020, switching to BYTE in %s on line %d
Warning: exif_read_data(): Process tag(x927C=MakerNote): Illegal format code 0x2020, suppose BYTE in %s on line %d
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)
+33
View File
@@ -0,0 +1,33 @@
--TEST--
Bug #79046: NaN to int cast undefined behavior in exif
--FILE--
<?php
var_dump(exif_read_data('data://image/tiff;base64,TU0AKgAAAA7//wAAANUAAQERAAsAAAABAAD4fwAAAA4A'));
?>
--EXPECT--
array(8) {
["FileDateTime"]=>
int(0)
["FileSize"]=>
int(33)
["FileType"]=>
int(8)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(24) "ANY_TAG, IFD0, THUMBNAIL"
["COMPUTED"]=>
array(2) {
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(1)
}
["StripOffsets"]=>
float(NAN)
["THUMBNAIL"]=>
array(1) {
["StripOffsets"]=>
float(NAN)
}
}
+43
View File
@@ -0,0 +1,43 @@
--TEST--
Overflow in float to int cast
--FILE--
<?php
var_dump(@exif_read_data(__DIR__ . '/float_cast_overflow.tiff'));
?>
--EXPECTF--
array(8) {
["FileName"]=>
string(24) "float_cast_overflow.tiff"
["FileDateTime"]=>
int(%d)
["FileSize"]=>
int(142)
["FileType"]=>
int(7)
["MimeType"]=>
string(10) "image/tiff"
["SectionsFound"]=>
string(24) "ANY_TAG, IFD0, THUMBNAIL"
["COMPUTED"]=>
array(5) {
["html"]=>
string(20) "width="1" height="1""
["Height"]=>
int(1)
["Width"]=>
int(1)
["IsColor"]=>
int(0)
["ByteOrderMotorola"]=>
int(0)
}
["THUMBNAIL"]=>
array(2) {
["ImageWidth"]=>
int(1)
["ImageLength"]=>
float(-2.5961487387524E+33)
}
}
Binary file not shown.
+10 -10
View File
@@ -127,16 +127,6 @@ declaration_specifiers(zend_ffi_dcl *dcl):
{dcl->flags |= ZEND_FFI_DCL_INLINE;}
| "_Noreturn"
{dcl->flags |= ZEND_FFI_DCL_NO_RETURN;}
| "__cdecl"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_CDECL);}
| "__stdcall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_STDCALL);}
| "__fastcall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_FASTCALL);}
| "__thiscall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);}
| "__vectorcall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);}
| "_Alignas"
"("
( &type_name_start
@@ -494,6 +484,16 @@ attributes(zend_ffi_dcl *dcl):
)?
)+
")"
| "__cdecl"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_CDECL);}
| "__stdcall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_STDCALL);}
| "__fastcall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_FASTCALL);}
| "__thiscall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);}
| "__vectorcall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);}
)++
;
+325 -316
View File
@@ -56,50 +56,50 @@ static void yy_error_sym(const char *msg, int sym);
#define YY___INLINE 13
#define YY___INLINE__ 14
#define YY__NORETURN 15
#define YY___CDECL 16
#define YY___STDCALL 17
#define YY___FASTCALL 18
#define YY___THISCALL 19
#define YY___VECTORCALL 20
#define YY__ALIGNAS 21
#define YY_CONST 22
#define YY___CONST 23
#define YY___CONST__ 24
#define YY_RESTRICT 25
#define YY___RESTRICT 26
#define YY___RESTRICT__ 27
#define YY_VOLATILE 28
#define YY___VOLATILE 29
#define YY___VOLATILE__ 30
#define YY__ATOMIC 31
#define YY_VOID 32
#define YY_CHAR 33
#define YY_SHORT 34
#define YY_INT 35
#define YY_LONG 36
#define YY_FLOAT 37
#define YY_DOUBLE 38
#define YY_SIGNED 39
#define YY_UNSIGNED 40
#define YY__BOOL 41
#define YY__COMPLEX 42
#define YY_COMPLEX 43
#define YY___COMPLEX 44
#define YY___COMPLEX__ 45
#define YY_STRUCT 46
#define YY_UNION 47
#define YY__LBRACE 48
#define YY__RBRACE 49
#define YY__COLON 50
#define YY_ENUM 51
#define YY__EQUAL 52
#define YY__STAR 53
#define YY__LBRACK 54
#define YY__RBRACK 55
#define YY__POINT_POINT_POINT 56
#define YY___ATTRIBUTE 57
#define YY___ATTRIBUTE__ 58
#define YY___DECLSPEC 59
#define YY__ALIGNAS 16
#define YY_CONST 17
#define YY___CONST 18
#define YY___CONST__ 19
#define YY_RESTRICT 20
#define YY___RESTRICT 21
#define YY___RESTRICT__ 22
#define YY_VOLATILE 23
#define YY___VOLATILE 24
#define YY___VOLATILE__ 25
#define YY__ATOMIC 26
#define YY_VOID 27
#define YY_CHAR 28
#define YY_SHORT 29
#define YY_INT 30
#define YY_LONG 31
#define YY_FLOAT 32
#define YY_DOUBLE 33
#define YY_SIGNED 34
#define YY_UNSIGNED 35
#define YY__BOOL 36
#define YY__COMPLEX 37
#define YY_COMPLEX 38
#define YY___COMPLEX 39
#define YY___COMPLEX__ 40
#define YY_STRUCT 41
#define YY_UNION 42
#define YY__LBRACE 43
#define YY__RBRACE 44
#define YY__COLON 45
#define YY_ENUM 46
#define YY__EQUAL 47
#define YY__STAR 48
#define YY__LBRACK 49
#define YY__RBRACK 50
#define YY__POINT_POINT_POINT 51
#define YY___ATTRIBUTE 52
#define YY___ATTRIBUTE__ 53
#define YY___DECLSPEC 54
#define YY___CDECL 55
#define YY___STDCALL 56
#define YY___FASTCALL 57
#define YY___THISCALL 58
#define YY___VECTORCALL 59
#define YY__POINT 60
#define YY__QUERY 61
#define YY__BAR_BAR 62
@@ -158,11 +158,6 @@ static const char * sym_name[] = {
"__inline",
"__inline__",
"_Noreturn",
"__cdecl",
"__stdcall",
"__fastcall",
"__thiscall",
"__vectorcall",
"_Alignas",
"const",
"__const",
@@ -202,6 +197,11 @@ static const char * sym_name[] = {
"__attribute",
"__attribute__",
"__declspec",
"__cdecl",
"__stdcall",
"__fastcall",
"__thiscall",
"__vectorcall",
".",
"?",
"||",
@@ -369,6 +369,58 @@ _yy_state_start:
if (ch != '_') goto _yy_tunnel_9;
ret = YY___INLINE__;
goto _yy_state_390;
case 'a':
ch = *++YYPOS;
if (ch == 'l') {
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'g') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'n') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'o') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'f') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___ALIGNOF; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ALIGNOF__;
goto _yy_state_390;
} else if (ch == 's') {
ch = *++YYPOS;
if (ch != 'm') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ASM__;
goto _yy_state_390;
} else if (ch == 't') {
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'r') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'b') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'u') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___ATTRIBUTE; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ATTRIBUTE__;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
case 'c':
ch = *++YYPOS;
if (ch == 'd') {
@@ -414,20 +466,22 @@ _yy_state_start:
} else {
goto _yy_tunnel_9;
}
case 's':
case 'd':
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'd') goto _yy_tunnel_9;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'a') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___STDCALL;
if (ch != 's') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'p') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ret = YY___DECLSPEC;
goto _yy_state_390;
case 'f':
ch = *++YYPOS;
@@ -446,6 +500,52 @@ _yy_state_start:
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___FASTCALL;
goto _yy_state_390;
case 'r':
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 's') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch == 'i') {
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY___RESTICT;
goto _yy_state_390;
} else if (ch == 'r') {
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___RESTRICT; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___RESTRICT__;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
case 's':
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'd') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'a') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___STDCALL;
goto _yy_state_390;
case 't':
ch = *++YYPOS;
if (ch != 'h') goto _yy_tunnel_9;
@@ -506,106 +606,6 @@ _yy_state_start:
} else {
goto _yy_tunnel_9;
}
case 'a':
ch = *++YYPOS;
if (ch == 'l') {
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'g') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'n') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'o') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'f') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___ALIGNOF; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ALIGNOF__;
goto _yy_state_390;
} else if (ch == 's') {
ch = *++YYPOS;
if (ch != 'm') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ASM__;
goto _yy_state_390;
} else if (ch == 't') {
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'r') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'b') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'u') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___ATTRIBUTE; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ATTRIBUTE__;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
case 'd':
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 's') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'p') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ret = YY___DECLSPEC;
goto _yy_state_390;
case 'r':
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 's') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch == 'i') {
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY___RESTICT;
goto _yy_state_390;
} else if (ch == 'r') {
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___RESTRICT; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___RESTRICT__;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
default:
goto _yy_tunnel_9;
}
@@ -2012,7 +2012,7 @@ static int synpred_6(int sym) {
}
static int parse_declarations(int sym) {
while (YY_IN_SET(sym, (YY___EXTENSION__,YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\202\377\377\377\377\377\010\016\000\000\000\002\000")) {
while (YY_IN_SET(sym, (YY___EXTENSION__,YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\202\377\377\377\377\107\360\017\000\000\000\002\000")) {
zend_ffi_dcl common_dcl = ZEND_FFI_ATTR_INIT;
if (sym == YY___EXTENSION__) {
sym = get_sym();
@@ -2039,7 +2039,7 @@ static int parse_declarations(int sym) {
}
sym = get_sym();
}
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, &dcl);
}
if (sym == YY__EQUAL) {
@@ -2050,7 +2050,7 @@ static int parse_declarations(int sym) {
sym = get_sym();
dcl = common_dcl;
sym = parse_declarator(sym, &dcl, &name, &name_len);
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, &dcl);
}
if (sym == YY__EQUAL) {
@@ -2105,37 +2105,17 @@ static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl) {
sym = get_sym();
dcl->flags |= ZEND_FFI_DCL_NO_RETURN;
break;
case YY___CDECL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_CDECL);
break;
case YY___STDCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_STDCALL);
break;
case YY___FASTCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_FASTCALL);
break;
case YY___THISCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);
break;
case YY___VECTORCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);
break;
case YY__ALIGNAS:
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
if ((YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) && synpred_1(sym)) {
if ((YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) && synpred_1(sym)) {
zend_ffi_dcl align_dcl = ZEND_FFI_ATTR_INIT;
sym = parse_type_name(sym, &align_dcl);
zend_ffi_align_as_type(dcl, &align_dcl);
} else if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
} else if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
zend_ffi_val align_val;
sym = parse_constant_expression(sym, &align_val);
zend_ffi_align_as_val(dcl, &align_val);
@@ -2150,6 +2130,11 @@ static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl) {
case YY___ATTRIBUTE:
case YY___ATTRIBUTE__:
case YY___DECLSPEC:
case YY___CDECL:
case YY___STDCALL:
case YY___FASTCALL:
case YY___THISCALL:
case YY___VECTORCALL:
sym = parse_attributes(sym, dcl);
break;
case YY_CONST:
@@ -2187,7 +2172,7 @@ static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl) {
default:
yy_error_sym("unexpected", sym);
}
} while ((YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\200\377\377\377\377\377\010\016\000\000\000\002\000")) && (sym != YY_ID || !(dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS)));
} while ((YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\200\377\377\377\377\107\360\017\000\000\000\002\000")) && (sym != YY_ID || !(dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS)));
return sym;
}
@@ -2196,29 +2181,29 @@ static int parse_specifier_qualifier_list(int sym, zend_ffi_dcl *dcl) {
sym = get_sym();
}
do {
if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\000\000\000\000\377\377\010\000\000\000\000\002\000")) {
if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\000\000\000\370\377\107\000\000\000\000\000\002\000")) {
sym = parse_type_specifier(sym, dcl);
} else if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\300\377\000\000\000\000\000\000\000\000\000")) {
} else if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\376\007\000\000\000\000\000\000\000\000\000")) {
sym = parse_type_qualifier(sym, dcl);
} else if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
} else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, dcl);
} else {
yy_error_sym("unexpected", sym);
}
} while ((YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\377\377\010\016\000\000\000\002\000")) && (sym != YY_ID || zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text)));
} while ((YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\377\377\107\360\017\000\000\000\002\000")) && (sym != YY_ID || zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text)));
return sym;
}
static int parse_type_qualifier_list(int sym, zend_ffi_dcl *dcl) {
do {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\300\377\000\000\000\000\000\000\000\000\000")) {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\376\007\000\000\000\000\000\000\000\000\000")) {
sym = parse_type_qualifier(sym, dcl);
} else if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
} else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, dcl);
} else {
yy_error_sym("unexpected", sym);
}
} while (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000"));
} while (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000"));
return sym;
}
@@ -2341,7 +2326,7 @@ static int parse_struct_or_union_specifier(int sym, zend_ffi_dcl *dcl) {
} else {
yy_error_sym("unexpected", sym);
}
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, dcl);
}
if (sym == YY_ID) {
@@ -2372,7 +2357,7 @@ static int parse_struct_contents(int sym, zend_ffi_dcl *dcl) {
yy_error_sym("'{' expected, got", sym);
}
sym = get_sym();
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
sym = parse_struct_declaration(sym, dcl);
while (1) {
save_pos = yy_pos;
@@ -2390,7 +2375,7 @@ static int parse_struct_contents(int sym, zend_ffi_dcl *dcl) {
yy_error_sym("unexpected", sym2);
}
_yy_state_2_1:
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
alt2 = 3;
goto _yy_state_2;
} else if (sym2 == YY__RBRACE) {
@@ -2417,7 +2402,7 @@ _yy_state_2:
yy_error_sym("'}' expected, got", sym);
}
sym = get_sym();
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, dcl);
}
zend_ffi_adjust_struct_size(dcl);
@@ -2434,7 +2419,7 @@ static int parse_struct_declaration(int sym, zend_ffi_dcl *struct_dcl) {
while (sym == YY__COMMA) {
sym = get_sym();
zend_ffi_dcl field_dcl = common_field_dcl;
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, &field_dcl);
}
sym = parse_struct_declarator(sym, struct_dcl, &field_dcl);
@@ -2454,12 +2439,12 @@ static int parse_struct_declarator(int sym, zend_ffi_dcl *struct_dcl, zend_ffi_d
if (sym == YY__COLON) {
sym = get_sym();
sym = parse_constant_expression(sym, &bits);
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, field_dcl);
}
zend_ffi_add_bit_field(struct_dcl, name, name_len, field_dcl, &bits);
} else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__COMMA,YY__SEMICOLON,YY__RBRACE), "\140\000\000\000\000\000\002\016\000\000\000\000\000")) {
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
} else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__COMMA,YY__SEMICOLON,YY__RBRACE), "\140\000\000\000\000\020\360\017\000\000\000\000\000")) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, field_dcl);
}
zend_ffi_add_field(struct_dcl, name, name_len, field_dcl);
@@ -2482,7 +2467,7 @@ static int parse_enum_specifier(int sym, zend_ffi_dcl *dcl) {
}
sym = get_sym();
dcl->flags |= ZEND_FFI_DCL_ENUM;
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, dcl);
}
if (sym == YY_ID) {
@@ -2497,10 +2482,10 @@ static int parse_enum_specifier(int sym, zend_ffi_dcl *dcl) {
yy_error_sym("'}' expected, got", sym);
}
sym = get_sym();
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, dcl);
}
} else if (YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY__STAR,YY__LPAREN,YY__SEMICOLON,YY__COLON,YY__LBRACK,YY__RBRACE,YY__COMMA,YY__RPAREN,YY_EOF), "\371\377\377\377\377\377\156\016\000\000\000\002\000")) {
} else if (YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY__STAR,YY__LPAREN,YY__SEMICOLON,YY__COLON,YY__LBRACK,YY__RBRACE,YY__COMMA,YY__RPAREN,YY_EOF), "\371\377\377\377\377\167\363\017\000\000\000\002\000")) {
zend_ffi_declare_tag(name, name_len, dcl, 1);
} else {
yy_error_sym("unexpected", sym);
@@ -2513,7 +2498,7 @@ static int parse_enum_specifier(int sym, zend_ffi_dcl *dcl) {
yy_error_sym("'}' expected, got", sym);
}
sym = get_sym();
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, dcl);
}
} else {
@@ -2594,7 +2579,7 @@ static int parse_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_
sym = parse_ID(sym, name, name_len);
} else if (sym == YY__LPAREN) {
sym = get_sym();
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, &nested_dcl);
}
sym = parse_declarator(sym, &nested_dcl, name, name_len);
@@ -2621,7 +2606,7 @@ static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl) {
}
if ((sym == YY__LPAREN) && synpred_2(sym)) {
sym = get_sym();
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, &nested_dcl);
}
sym = parse_abstract_declarator(sym, &nested_dcl);
@@ -2646,7 +2631,7 @@ static int parse_parameter_declarator(int sym, zend_ffi_dcl *dcl, const char **n
}
if ((sym == YY__LPAREN) && synpred_3(sym)) {
sym = get_sym();
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000")) {
sym = parse_attributes(sym, &nested_dcl);
}
sym = parse_parameter_declarator(sym, &nested_dcl, name, name_len);
@@ -2675,7 +2660,7 @@ static int parse_pointer(int sym, zend_ffi_dcl *dcl) {
do {
sym = get_sym();
zend_ffi_make_pointer_type(dcl);
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000")) {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000")) {
sym = parse_type_qualifier_list(sym, dcl);
}
} while (sym == YY__STAR);
@@ -2687,9 +2672,9 @@ static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl, zend_
const unsigned char *save_pos;
const unsigned char *save_text;
int save_line;
int alt104;
int alt100;
int alt114;
int alt109;
int alt105;
int alt119;
zend_ffi_dcl dummy = ZEND_FFI_ATTR_INIT;
zend_ffi_val len = {.kind = ZEND_FFI_VAL_EMPTY};
HashTable *args = NULL;
@@ -2699,99 +2684,99 @@ static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl, zend_
save_pos = yy_pos;
save_text = yy_text;
save_line = yy_line;
alt100 = -2;
alt105 = -2;
sym2 = sym;
if (sym2 == YY_STATIC) {
alt100 = 101;
goto _yy_state_100;
} else if (YY_IN_SET(sym2, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000")) {
alt100 = 104;
goto _yy_state_100;
alt105 = 106;
goto _yy_state_105;
} else if (YY_IN_SET(sym2, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000")) {
alt105 = 109;
goto _yy_state_105;
} else if (sym2 == YY__STAR) {
sym2 = get_sym();
goto _yy_state_100_15;
goto _yy_state_105_20;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\004\030\377\376\000")) {
alt100 = 110;
goto _yy_state_100;
alt105 = 115;
goto _yy_state_105;
} else if (sym2 == YY__RBRACK) {
alt100 = 111;
goto _yy_state_100;
alt105 = 116;
goto _yy_state_105;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_100_15:
_yy_state_105_20:
if (sym2 == YY__RBRACK) {
alt100 = 109;
goto _yy_state_100;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
alt100 = 110;
goto _yy_state_100;
alt105 = 114;
goto _yy_state_105;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
alt105 = 115;
goto _yy_state_105;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_100:
_yy_state_105:
yy_pos = save_pos;
yy_text = save_text;
yy_line = save_line;
if (alt100 == 101) {
if (alt105 == 106) {
sym = get_sym();
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000")) {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\376\007\000\000\360\017\000\000\000\000\000")) {
sym = parse_type_qualifier_list(sym, &dummy);
}
sym = parse_assignment_expression(sym, &len);
} else if (alt100 == 104) {
} else if (alt105 == 109) {
sym = parse_type_qualifier_list(sym, &dummy);
save_pos = yy_pos;
save_text = yy_text;
save_line = yy_line;
alt104 = -2;
alt109 = -2;
sym2 = sym;
if (sym2 == YY_STATIC) {
alt104 = 105;
goto _yy_state_104;
alt109 = 110;
goto _yy_state_109;
} else if (sym2 == YY__STAR) {
sym2 = get_sym();
goto _yy_state_104_2;
goto _yy_state_109_2;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\004\030\377\376\000")) {
alt104 = 108;
goto _yy_state_104;
alt109 = 113;
goto _yy_state_109;
} else if (sym2 == YY__RBRACK) {
alt104 = 111;
goto _yy_state_104;
alt109 = 116;
goto _yy_state_109;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_104_2:
_yy_state_109_2:
if (sym2 == YY__RBRACK) {
alt104 = 107;
goto _yy_state_104;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
alt104 = 108;
goto _yy_state_104;
alt109 = 112;
goto _yy_state_109;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
alt109 = 113;
goto _yy_state_109;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_104:
_yy_state_109:
yy_pos = save_pos;
yy_text = save_text;
yy_line = save_line;
if (alt104 == 105) {
if (alt109 == 110) {
sym = get_sym();
sym = parse_assignment_expression(sym, &len);
} else if (alt104 == 111) {
} else if (alt109 == 116) {
attr |= ZEND_FFI_ATTR_INCOMPLETE_ARRAY;
} else if (alt104 == 107) {
} else if (alt109 == 112) {
sym = get_sym();
attr |= ZEND_FFI_ATTR_VLA;
} else if (alt104 == 108) {
} else if (alt109 == 113) {
sym = parse_assignment_expression(sym, &len);
} else {
yy_error_sym("unexpected", sym);
}
} else if (alt100 == 111 || alt100 == 109 || alt100 == 110) {
if (alt100 == 111) {
} else if (alt105 == 116 || alt105 == 114 || alt105 == 115) {
if (alt105 == 116) {
attr |= ZEND_FFI_ATTR_INCOMPLETE_ARRAY;
} else if (alt100 == 109) {
} else if (alt105 == 114) {
sym = get_sym();
attr |= ZEND_FFI_ATTR_VLA;
} else {
@@ -2811,45 +2796,45 @@ _yy_state_104:
zend_ffi_make_array_type(dcl, &len);
} else if (sym == YY__LPAREN) {
sym = get_sym();
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__POINT_POINT_POINT), "\002\000\300\377\377\377\010\017\000\000\000\002\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__POINT_POINT_POINT), "\002\000\376\377\377\107\370\017\000\000\000\002\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
sym = parse_parameter_declaration(sym, &args);
while (1) {
save_pos = yy_pos;
save_text = yy_text;
save_line = yy_line;
alt114 = -2;
alt119 = -2;
sym2 = sym;
if (sym2 == YY__COMMA) {
sym2 = get_sym();
goto _yy_state_114_1;
goto _yy_state_119_1;
} else if (sym2 == YY__RPAREN) {
alt114 = 120;
goto _yy_state_114;
alt119 = 125;
goto _yy_state_119;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_114_1:
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
alt114 = 115;
goto _yy_state_114;
_yy_state_119_1:
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\002\000\376\377\377\107\360\017\000\000\000\002\000")) {
alt119 = 120;
goto _yy_state_119;
} else if (sym2 == YY__POINT_POINT_POINT) {
alt114 = 117;
goto _yy_state_114;
alt119 = 122;
goto _yy_state_119;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_114:
_yy_state_119:
yy_pos = save_pos;
yy_text = save_text;
yy_line = save_line;
if (alt114 != 115) {
if (alt119 != 120) {
break;
}
sym = get_sym();
sym = parse_parameter_declaration(sym, &args);
}
if (alt114 == 117) {
if (alt119 == 122) {
sym = get_sym();
if (sym != YY__POINT_POINT_POINT) {
yy_error_sym("'...' expected, got", sym);
@@ -2901,55 +2886,79 @@ static int parse_attributes(int sym, zend_ffi_dcl *dcl) {
size_t name_len;
zend_ffi_val val;
do {
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__) {
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
sym = parse_attrib(sym, dcl);
while (sym == YY__COMMA) {
switch (sym) {
case YY___ATTRIBUTE:
case YY___ATTRIBUTE__:
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
sym = parse_attrib(sym, dcl);
}
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
sym = get_sym();
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
sym = get_sym();
} else if (sym == YY___DECLSPEC) {
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
do {
sym = parse_ID(sym, &name, &name_len);
if (sym == YY__LPAREN) {
sym = get_sym();
sym = parse_assignment_expression(sym, &val);
zend_ffi_add_msvc_attribute_value(dcl, name, name_len, &val);
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
while (sym == YY__COMMA) {
sym = get_sym();
sym = parse_attrib(sym, dcl);
}
} while (sym == YY_ID);
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
sym = get_sym();
} else {
yy_error_sym("unexpected", sym);
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
sym = get_sym();
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
sym = get_sym();
break;
case YY___DECLSPEC:
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
do {
sym = parse_ID(sym, &name, &name_len);
if (sym == YY__LPAREN) {
sym = get_sym();
sym = parse_assignment_expression(sym, &val);
zend_ffi_add_msvc_attribute_value(dcl, name, name_len, &val);
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
sym = get_sym();
}
} while (sym == YY_ID);
if (sym != YY__RPAREN) {
yy_error_sym("')' expected, got", sym);
}
sym = get_sym();
break;
case YY___CDECL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_CDECL);
break;
case YY___STDCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_STDCALL);
break;
case YY___FASTCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_FASTCALL);
break;
case YY___THISCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);
break;
case YY___VECTORCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);
break;
default:
yy_error_sym("unexpected", sym);
}
} while (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC);
} while (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL), "\000\000\000\000\000\000\360\017\000\000\000\000\000"));
return sym;
}
@@ -3006,7 +3015,7 @@ static int parse_initializer(int sym) {
yy_error_sym("'=' expected, got", sym);
}
sym = get_sym();
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
sym = parse_assignment_expression(sym, &dummy);
} else if (sym == YY__LBRACE) {
sym = get_sym();
@@ -3313,7 +3322,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
case YY_ID:
sym = parse_ID(sym, &name, &name_len);
zend_ffi_resolve_const(name, name_len, val);
while (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__POINT,YY__MINUS_GREATER,YY__PLUS_PLUS,YY__MINUS_MINUS), "\010\000\000\000\000\000\100\020\000\200\003\000\000")) {
while (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__POINT,YY__MINUS_GREATER,YY__PLUS_PLUS,YY__MINUS_MINUS), "\010\000\000\000\000\000\002\020\000\200\003\000\000")) {
switch (sym) {
case YY__LBRACK:
sym = get_sym();
@@ -3325,7 +3334,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
break;
case YY__LPAREN:
sym = get_sym();
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
sym = parse_expr_list(sym);
}
if (sym != YY__RPAREN) {
@@ -3427,7 +3436,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
}
sym = get_sym();
zend_ffi_expr_sizeof_type(val, &dcl);
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
sym = parse_unary_expression(sym, val);
zend_ffi_expr_sizeof_val(val);
} else {
@@ -3458,7 +3467,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
}
sym = get_sym();
zend_ffi_expr_alignof_type(val, &dcl);
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\001\000\004\030\377\376\000")) {
sym = parse_unary_expression(sym, val);
zend_ffi_expr_alignof_val(val);
} else {
-24
View File
@@ -1,24 +0,0 @@
--TEST--
FFI 300: FFI preloading on Windows
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php if (!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not available'); ?>
<?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip for Windows only'); ?>
--INI--
ffi.enable=1
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.preload={PWD}/preload.inc
--FILE--
<?php
$ffi = FFI::scope("TEST_300_WIN32");
$ffi->php_printf("Hello World from %s!\n", "PHP");
?>
--CLEAN--
<?php
$fn = __DIR__ . "/300-win32.h";
unlink($fn);
?>
--EXPECT--
Hello World from PHP!
+5
View File
@@ -5,6 +5,11 @@ FR #78270 (Usage of __vectorcall convention with FFI)
require_once('skipif.inc');
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
ob_start();
phpinfo(INFO_GENERAL);
$info = ob_get_clean();
if (preg_match('/Compiler => .*clang.*/', $info)) die("skip not for clang");
$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
try {
FFI::cdef(<<<EOC
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #78714 (funcs returning pointer can't use call convention spec)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
ffi.enable=1
--FILE--
<?php
$def = 'char * __cdecl get_zend_version(void);';
if (substr(PHP_OS, 0, 3) != 'WIN') {
$ffi = FFI::cdef($def);
} else {
$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
$ffi = FFI::cdef($def, $dll);
}
echo substr(FFI::string($ffi->get_zend_version()), 0, 4) . "\n";
?>
--EXPECT--
Zend
+4 -1
View File
@@ -1,7 +1,10 @@
--TEST--
Bug #78761 (Zend memory heap corruption with preload and casting)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php
require_once('skipif.inc');
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--INI--
opcache.enable_cli=1
opcache.preload={PWD}/bug78761_preload.php
+1 -4
View File
@@ -527,11 +527,9 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
zend_string *repl;
size_t rep_cnt = 0;
(void)setlocale(LC_CTYPE, "C");
opts |= PCRE2_MULTILINE;
convert_libmagic_pattern(&patt, (char*)pat, strlen(pat), opts);
if ((pce = pcre_get_compiled_regex_cache(Z_STR(patt))) == NULL) {
if ((pce = pcre_get_compiled_regex_cache_ex(Z_STR(patt), 0)) == NULL) {
zval_ptr_dtor(&patt);
rep_cnt = -1;
goto out;
@@ -553,7 +551,6 @@ file_replace(struct magic_set *ms, const char *pat, const char *rep)
zend_string_release_ex(res, 0);
out:
(void)setlocale(LC_CTYPE, "");
return rep_cnt;
}
+14 -4
View File
@@ -112,14 +112,24 @@ cdf_app_to_mime(const char *vbuf, const struct nv *nv)
{
size_t i;
const char *rv = NULL;
char *vbuf_lower;
(void)setlocale(LC_CTYPE, "C");
for (i = 0; nv[i].pattern != NULL; i++)
if (strcasestr(vbuf, nv[i].pattern) != NULL) {
vbuf_lower = zend_str_tolower_dup(vbuf, strlen(vbuf));
for (i = 0; nv[i].pattern != NULL; i++) {
char *pattern_lower;
int found;
pattern_lower = zend_str_tolower_dup(nv[i].pattern, strlen(nv[i].pattern));
found = (strstr(vbuf_lower, pattern_lower) != NULL);
efree(pattern_lower);
if (found) {
rv = nv[i].mime;
break;
}
(void)setlocale(LC_CTYPE, "");
}
efree(vbuf_lower);
return rv;
}
+6 -8
View File
@@ -469,27 +469,25 @@ flush:
private int
check_fmt(struct magic_set *ms, const char *fmt)
{
pcre2_code *pce;
uint32_t capture_count;
pcre_cache_entry *pce;
int rv = -1;
zend_string *pattern;
if (strchr(fmt, '%') == NULL)
return 0;
(void)setlocale(LC_CTYPE, "C");
pattern = zend_string_init("~%[-0-9\\.]*s~", sizeof("~%[-0-9\\.]*s~") - 1, 0);
if ((pce = pcre_get_compiled_regex(pattern, &capture_count)) == NULL) {
if ((pce = pcre_get_compiled_regex_cache_ex(pattern, 0)) == NULL) {
rv = -1;
} else {
pcre2_match_data *match_data = php_pcre_create_match_data(capture_count, pce);
pcre2_code *re = php_pcre_pce_re(pce);
pcre2_match_data *match_data = php_pcre_create_match_data(0, re);
if (match_data) {
rv = pcre2_match(pce, (PCRE2_SPTR)fmt, strlen(fmt), 0, 0, match_data, php_pcre_mctx()) > 0;
rv = pcre2_match(re, (PCRE2_SPTR)fmt, strlen(fmt), 0, 0, match_data, php_pcre_mctx()) > 0;
php_pcre_free_match_data(match_data);
}
}
zend_string_release_ex(pattern, 0);
(void)setlocale(LC_CTYPE, "");
zend_string_release(pattern);
return rv;
}
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #74170 locale information change after mime_content_type
--SKIPIF--
<?php
if (!class_exists('finfo'))
die('skip no fileinfo extension');
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
if (setlocale(LC_CTYPE, 'ru_RU.koi8r') === false)
die('skip ru_RU.koi8r locale is not available');
?>
--FILE--
<?php
var_dump(setlocale(LC_CTYPE, 'ru_RU.koi8r'));
var_dump(nl_langinfo(CODESET));
var_dump(mime_content_type(__DIR__ . '/resources/test.ppt'));
var_dump(nl_langinfo(CODESET));
--EXPECT--
string(11) "ru_RU.koi8r"
string(6) "KOI8-R"
string(29) "application/vnd.ms-powerpoint"
string(6) "KOI8-R"
+1
View File
@@ -1235,6 +1235,7 @@ PHP_MSHUTDOWN_FUNCTION(gd)
#if defined(HAVE_GD_FREETYPE) && defined(HAVE_GD_BUNDLED)
gdFontCacheMutexShutdown();
#endif
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
+1
View File
@@ -362,6 +362,7 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo
for ( y=0; y<src->sy; y++) {
for(x=0; x<src->sx; x++) {
new_r = new_g = new_b = 0;
pxl = f(srcback, x, y);
new_a = gdImageAlpha(srcback, pxl);
for (j=0; j<3; j++) {
+1 -1
View File
@@ -548,7 +548,7 @@ compress(int init_bits, gdIOCtxPtr outfile, gdImagePtr im, GifCtx *ctx)
output( (code_int)ctx->ClearCode, ctx );
#ifdef SIGNED_COMPARE_SLOW
while ( (c = GIFNextPixel( im )) != (unsigned) EOF ) {
while ( (c = GIFNextPixel( im, ctx )) != (unsigned) EOF ) {
#else /*SIGNED_COMPARE_SLOW*/
while ( (c = GIFNextPixel( im, ctx )) != EOF ) { /* } */
#endif /*SIGNED_COMPARE_SLOW*/
+6 -3
View File
@@ -2289,7 +2289,7 @@ int gdTransformAffineGetImage(gdImagePtr *dst,
* src_area - Rectangular region to rotate in the src image
*
* Returns:
* GD_TRUE if the affine is rectilinear or GD_FALSE
* GD_TRUE on success or GD_FALSE on failure
*/
int gdTransformAffineCopy(gdImagePtr dst,
int dst_x, int dst_y,
@@ -2306,7 +2306,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
gdPointF pt, src_pt;
gdRect bbox;
int end_x, end_y;
gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
gdInterpolationMethod interpolation_id_bak = src->interpolation_id;
/* These methods use special implementations */
if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) {
@@ -2346,7 +2346,10 @@ int gdTransformAffineCopy(gdImagePtr dst,
end_y = bbox.height + abs(bbox.y);
/* Get inverse affine to let us work with destination -> source */
gdAffineInvert(inv, affine);
if (gdAffineInvert(inv, affine) == GD_FALSE) {
gdImageSetInterpolationMethod(src, interpolation_id_bak);
return GD_FALSE;
}
src_offset_x = src_region->x;
src_offset_y = src_region->y;
+1 -1
View File
@@ -55,7 +55,7 @@ int gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src,
* <gdAffineIdentity>
*
* Returns:
* GD_TRUE if the affine is rectilinear or GD_FALSE
* GD_TRUE on success or GD_FALSE on failure
*/
int gdAffineInvert (double dst[6], const double src[6])
{
+1 -3
View File
@@ -1,11 +1,9 @@
--TEST--
Bug #47946 (ImageConvolution overwrites background)
--DESCRIPTION--
The expected image has black pixel artifacts, what is another issue, though
(perhaps #40158).
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream fix not yet released');
?>
--FILE--
<?php
Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

After

Width:  |  Height:  |  Size: 355 B

+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #79067 (gdTransformAffineCopy() may use unitialized values)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$matrix = [1, 1, 1, 1, 1, 1];
$src = imagecreatetruecolor(8, 8);
var_dump(imageaffine($src, $matrix));
?>
--EXPECT--
bool(false)
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug #79068 (gdTransformAffineCopy() changes interpolation method)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
require_once __DIR__ . '/func.inc';
$src = imagecreatetruecolor(100, 100);
imagefilledrectangle($src, 0, 0, 99, 99, 0xffffff);
imageline($src, 10, 10, 90, 90, 0x000000);
imagesetinterpolation($src, IMG_BSPLINE);
imageaffine($src, [1, 1, 1, 1, 1, 1]);
$dst = imagerotate($src, 80, 0xffffff);
test_image_equals_file(__DIR__ . '/bug79068.png', $dst);
?>
--EXPECT--
The images are equal.
Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

+3 -1
View File
@@ -51,7 +51,9 @@ void formatter_register_constants( INIT_FUNC_ARGS )
FORMATTER_EXPOSE_CLASS_CONST( DURATION );
FORMATTER_EXPOSE_CLASS_CONST( PATTERN_RULEBASED );
FORMATTER_EXPOSE_CLASS_CONST( IGNORE );
#if U_ICU_VERSION_MAJOR_NUM >= 53
FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_ACCOUNTING );
#endif
FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_STYLE", UNUM_DEFAULT );
/* UNumberFormatRoundingMode */
+2 -2
View File
@@ -1285,7 +1285,7 @@ PHP_FUNCTION(locale_filter_matches)
if( boolCanonical ){
/* canonicalize loc_range */
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
if( result <=0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize loc_range" , 0 );
RETURN_FALSE;
@@ -1293,7 +1293,7 @@ PHP_FUNCTION(locale_filter_matches)
/* canonicalize lang_tag */
can_lang_tag = get_icu_value_internal( lang_tag , LOC_CANONICALIZE_TAG , &result , 0);
if( result ==0) {
if( result <=0) {
intl_error_set( NULL, status,
"locale_filter_matches : unable to canonicalize lang_tag" , 0 );
RETURN_FALSE;
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #78804: Segmentation fault in Locale::filterMatches
--FILE--
<?php
if (Locale::filterMatches('en-US', 'und', true)) {
echo 'Matches';
} else {
echo 'Not matches';
}
?>
--EXPECT--
Not matches
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Request #78912 (INTL Support for accounting format)
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not available');
if (version_compare(INTL_ICU_VERSION, '53.0') < 0) die('skip for ICU >= 53.0');
?>
--FILE--
<?php
$nf = new NumberFormatter('en_US', NumberFormatter::CURRENCY_ACCOUNTING);
var_dump($nf->formatCurrency(-12345.67, 'USD'));
?>
--EXPECT--
string(12) "($12,345.67)"
+4
View File
@@ -355,6 +355,10 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
context = php_stream_context_from_zval(Z_ISUNDEF(LIBXML(stream_context))? NULL : &LIBXML(stream_context), 0);
ret_val = php_stream_open_wrapper_ex(path_to_open, (char *)mode, REPORT_ERRORS, NULL, context);
if (ret_val) {
/* Prevent from closing this by fclose() */
((php_stream*)ret_val)->flags |= PHP_STREAM_FLAG_NO_FCLOSE;
}
if (isescaped) {
xmlFree(resolved_path);
}
+2 -2
View File
@@ -145,10 +145,10 @@ static unsigned short cp950_pua_tbl[][4] = {
static inline int is_in_cp950_pua(int c1, int c) {
if ((c1 >= 0xfa && c1 <= 0xfe) || (c1 >= 0x8e && c1 <= 0xa0) ||
(c1 >= 0x81 && c1 <= 0x8d) || (c1 >= 0xc7 && c1 <= 0xc8)) {
return (c > 0x39 && c < 0x7f) || (c > 0xa0 && c < 0xff);
return (c >=0x40 && c <= 0x7e) || (c >= 0xa1 && c <= 0xfe);
}
if (c1 == 0xc6) {
return c > 0xa0 && c < 0xff;
return c >= 0xa1 && c <= 0xfe;
}
return 0;
}
Loaded 100 of 287 files, more files were not shown because too many files have changed in this diff. Show more