Compare commits

...
109 Commits
Author SHA1 Message Date
Derick Rethans 787a173064 Update NEWS for PHP 7.4.5 2020-04-14 12:54:27 +00:00
Derick Rethans e5c5832df8 Update header 2020-04-14 13:51:43 +01:00
Derick Rethans f10c944c3d Update NEWS 2020-04-14 10:51:01 +01:00
Stanislav Malyshev 4f606b5b8d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #79465 - use unsigneds as indexes.
  Fix bug #79330 - make all execution modes consistent in rejecting \0
2020-04-14 10:49:47 +01:00
Derick Rethans 855f008874 Update NEWS for PHP 7.4.5RC1 2020-03-31 13:53:42 +00:00
Christoph M. Becker b27a14529f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Next is 7.3.18
2020-03-31 10:24:15 +02:00
Christoph M. Becker 33226c3a17 Next is 7.3.18 2020-03-31 10:22:55 +02:00
Christoph M. Becker d533fa15e6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79413: session_create_id() fails for active sessions
2020-03-31 08:39:54 +02:00
Christoph M. Becker b510250b8e Fix #79413: session_create_id() fails for active sessions
The comment on `PS_VALIDATE_SID_FUNC(files)` is very clear that the
function is supposed to return `SUCCESS` if the session already exists.
So to detect a collision, we have to check for `SUCCESS`, not
`FAILURE`.

We also fix the wrong condition in session_regenerate_id() as well.
2020-03-31 08:38:23 +02:00
Nikita Popov b9b49cfb7b Don't check directory nlink in stat tests
It seems like on many filesystems nlink for directories is the
number of subdirectories (plus two, due to . and ..). However,
this is not a POSIX requirement, and some filesystems don't
implement it this way. This seems to be the case for whatever is
used on the Travis AArch64 builders now.
2020-03-30 10:54:03 +02:00
Christoph M. Becker a2f8c78183 Fix #74940: DateTimeZone loose comparison always true
Since `DateTimeZone` does not implement a `compare_objects` handler,
nor has any properties, two `DateTimeZone` instances always compare as
being equal, even if they designate totally different timezones.  Even
worse, after calling `var_dump()` on these objects, the actual
comparison may yield a correct result.

We therefore introduce a `compare_objects` handlers, which prevents
different behavior before/after `var_dump()`, and which allows us to
clearly define the intended semantics.
2020-03-30 09:03:40 +02:00
Christoph M. Becker 6f8045c47f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79427: Integer Overflow in shmop_open()
2020-03-30 08:57:49 +02:00
Christoph M. Becker a681b12820 Fix #79427: Integer Overflow in shmop_open()
If `shm.shm_segsz > ZEND_LONG_MAX` the assignment to `shmop->size` a
few lines below would overflow, so we catch that early and bail out if
necessary.
2020-03-30 08:56:49 +02:00
Andre Nathan 0b4e80b8c1 Allow numeric [UG]ID in FPM listen.{owner,group} 2020-03-29 20:20:01 +01:00
Remi Collet d66a063e0f NEWS 2020-03-29 14:23:28 +02:00
Remi Collet 2292ef93d5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79424 ext/zip: don't use gl_pathc after call to globfree
2020-03-29 14:23:03 +02:00
Max Rees 04920645f1 Fix #79424 ext/zip: don't use gl_pathc after call to globfree
This breaks on Linux with the musl libc, since it zeroes out gl_pathc during
globfree.
2020-03-29 14:22:31 +02:00
Christoph M. Becker cc0c5b9343 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing 'skip' to bug79332.phpt skip message
2020-03-26 23:15:55 +01:00
Lukas Berger 7f9b534e3a Add missing 'skip' to bug79332.phpt skip message
The skip message must start with the word 'skip', otherwise the test will not be skipped.

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

*After:*
Running selected tests.
SKIP Bug #79332 (php_istreams are never freed) [ext/com_dotnet/tests/bug79332.phpt] reason: com_dotnet extension not available
2020-03-26 23:14:10 +01:00
George Peter Banyard 6e88f19346 Explicitly declare the char as signed in zend_ffi_val.
This causes issues down the line as char are unsigned on some platforms,
e.g. ARM and cause a [-Wtype-limits] warning to be emitted.
2020-03-26 10:28:38 +03:00
Dmitry Stogov 91ee85c20c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
2020-03-25 17:31:33 +03:00
Dmitry Stogov 65120cfc09 Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script). 2020-03-25 17:31:06 +03:00
Nikita Popov 2b3b7f5cd9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without newline)
2020-03-25 10:51:23 +01:00
Christian Schneider c0840fec9c Fix bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without newline)
Closes GH-5292.
2020-03-25 10:50:35 +01:00
Nikita Popov 534e15b477 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add test file
2020-03-23 17:14:16 +01:00
Nikita Popov 2e8db5d6be Add test file
Forgot the git add again...
2020-03-23 17:13:57 +01:00
Nikita Popov dd9b5c8680 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Handle NULL caller_call_opline
2020-03-23 17:12:12 +01:00
Nikita Popov 34f1266a9c Handle NULL caller_call_opline
This can happen if there is an EXIT in the call arguments, in which
case the DO_CALL opcode may be eliminated as unreachable.
2020-03-23 17:12:01 +01:00
Christoph M. Becker 0afdf194f0 Fix leak on Windows as well
Cf. <http://git.php.net/?p=php-src.git;a=commit;h=db08ef0d3274b239a6b9e68d71d02bb6acb71d82>
2020-03-23 16:32:52 +01:00
Christoph M. Becker efbc962c92 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix test for Windows
2020-03-23 16:23:33 +01:00
Christoph M. Becker ba404f21e4 Fix test for Windows
Windows filenames may very well contain a colon, so we adjust the test
accordingly.
2020-03-23 16:22:45 +01:00
Christoph M. Becker a7bbfc95eb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79200: Some iconv functions cut Windows-1258
2020-03-23 14:13:42 +01:00
Christoph M. Becker 32a2644305 Fix #79200: Some iconv functions cut Windows-1258
To cater to potentially state-dependent encodings, we have to reset the
conversion descriptor into its initial shift state to properly finish
the conversion.  Furthermore, state-dependent encodings may not show
progress when comparing `in_left` before and after the conversion; we
rather have to see whether `out_left` has decreased.  Also we have to
cater to the fact that the final potentially state resetting call does
not signal failure, but we still have to break respective loops
afterwards.
2020-03-23 14:12:37 +01:00
Christoph M. Becker 4576da0aa7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79393: Null coalescing operator failing with SplFixedArray
2020-03-23 13:31:25 +01:00
Christoph M. Becker 47c745555c Fix #79393: Null coalescing operator failing with SplFixedArray
We favor the KISS principle over optimization[1] – SPL is already
special enough.

[1] <https://github.com/php/php-src/pull/2489/commits/352f3d4476a79bb86136b431719df7394e5a8d4e#r112498098>ff
2020-03-23 13:29:25 +01:00
Nikita Popov db08ef0d32 Fix RSA memory leak in mysqlnd auth 2020-03-23 11:55:22 +01:00
Remi Collet 347d18b48e unneeded after fix 2020-03-20 11:18:52 +01:00
Remi Collet 6c0f9c3fc6 NEWS 2020-03-20 11:17:29 +01:00
Remi Collet 98687abb1d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  NEWS
  Fix Bug #79296 ZipArchive::open fails on empty file
2020-03-20 11:16:38 +01:00
Remi Collet 51c57a9c67 NEWS 2020-03-20 11:16:08 +01:00
Remi Collet 8aab43c85d Fix Bug #79296 ZipArchive::open fails on empty file 2020-03-20 11:14:58 +01:00
Derick Rethans 673a3ceaa2 Mention which categories to use for patch releases 2020-03-20 09:31:37 +00:00
Christoph M. Becker 9e6d80dc8f Fix potential test conflict
Cf. <https://ci.appveyor.com/project/php/php-src/builds/31564684/job/k9u3xv860fao3n2e#L5578>
2020-03-20 08:56:40 +01:00
Christoph M. Becker 1d9e716a47 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79396: DateTime hour incorrect during DST jump forward
2020-03-19 08:51:55 +01:00
Nate Brunette d70058a139 Fix #79396: DateTime hour incorrect during DST jump forward
When you attempt to set the time to a non-existent time occuring during
a DST jump forward, the hour does not move forward correctly.
2020-03-19 08:50:34 +01:00
Christoph M. Becker 280485adc1 Improve FFI test suite for Windows
We add Windows support to four existing test cases, extract some useful
utility functions, and use them to simplify further test cases.

We also remove the Windows specific code from preload.inc, since
preloading isn't supported on Windows anyway.
2020-03-18 16:53:06 +01:00
Nikita Popov 10bf541fd9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Clarify session.cookie_samesite="None"
2020-03-18 16:00:05 +01:00
Nikita Popov c00cce3229 Clarify session.cookie_samesite="None" 2020-03-18 15:59:30 +01:00
Nikita Popov ba6834fa57 Make bug52820.phpt more robust
Use a more robust error condition...
2020-03-18 11:46:27 +01:00
Nikita Popov bf382a3cb6 Explicitly start mysql 2020-03-18 11:46:27 +01:00
Nikita Popov 372331fc6d Use "set -e" in some pipeline steps 2020-03-18 11:46:27 +01:00
Remi Collet 9659a86fc3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  bump verison to 7.2.30-dev
2020-03-17 11:29:03 +01:00
Remi Collet b114e3d953 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  bump verison to 7.2.30-dev
2020-03-17 11:28:47 +01:00
Remi Collet 3072b77c21 bump verison to 7.2.30-dev 2020-03-17 11:28:34 +01:00
Christoph M. Becker 1e63900cc0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix NEWS
2020-03-17 11:12:57 +01:00
Christoph M. Becker 9b8aa105ed Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix NEWS
2020-03-17 11:09:55 +01:00
Christoph M. Becker 6a4fff4682 Fix NEWS 2020-03-17 11:06:45 +01:00
Christoph M. Becker 4dce975e11 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  [ci skip] Update NEWS
  Fix test
  Fix bug #79329 - get_headers should not accept \0
  Fixed bug #79282
2020-03-17 10:58:58 +01:00
Christoph M. Becker 3588b6bba6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  [ci skip] Update NEWS
  Fix test
  Fix bug #79329 - get_headers should not accept \0
  Fixed bug #79282
2020-03-17 10:56:47 +01:00
Christoph M. Becker a64f48cff8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  [ci skip] Update NEWS
  Fix test
  Fix bug #79329 - get_headers should not accept \0
  Fixed bug #79282
  Fix #79371: mb_strtolower (UTF-32LE): stack-buffer-overflow
2020-03-17 10:30:57 +01:00
Stanislav Malyshev fc39bb9da9 [ci skip] Update NEWS 2020-03-16 22:40:48 -07:00
Stanislav Malyshev 1599f440a5 Fix test 2020-03-16 22:40:48 -07:00
Stanislav Malyshev 335547a04d Fix bug #79329 - get_headers should not accept \0 2020-03-16 22:40:48 -07:00
Stanislav Malyshev b9d32197cb Fixed bug #79282 2020-03-16 22:40:48 -07:00
Christoph M. Becker aa88f33f7d Fix #79283: Segfault in libmagic patch contains a buffer overflow
To solve this, we properly calculate the required string length upfront
instead of allocating an oversized string (`len * 4 + 4`).
2020-03-16 22:40:48 -07:00
Christoph M. Becker db848e1482 Fix #79371: mb_strtolower (UTF-32LE): stack-buffer-overflow
We make sure that negative values are properly compared.
2020-03-16 22:40:48 -07:00
Stanislav Malyshev e71fa03107 [ci skip] Update NEWS 2020-03-16 22:40:00 -07:00
Stanislav Malyshev 62e7b80267 Fix test 2020-03-16 22:40:00 -07:00
Stanislav Malyshev 69fdc14152 Fix bug #79329 - get_headers should not accept \0 2020-03-16 22:40:00 -07:00
Stanislav Malyshev 25238bdf60 Fixed bug #79282 2020-03-16 22:40:00 -07:00
Christoph M. Becker 1fdffd1c55 Fix #79371: mb_strtolower (UTF-32LE): stack-buffer-overflow
We make sure that negative values are properly compared.
2020-03-16 22:40:00 -07:00
Nikita Popov a57905dbac Don't specify ports in socket_export_stream-4.phpt
Let the system pick a free port instead...
2020-03-16 10:32:04 +01:00
Stanislav Malyshev c8d21d7728 [ci skip] Update NEWS 2020-03-15 19:38:31 -07:00
Stanislav Malyshev 2c081b7e26 Fix test 2020-03-15 17:55:28 -07:00
Stanislav Malyshev 0d139c5b94 Fix bug #79329 - get_headers should not accept \0 2020-03-15 17:30:44 -07:00
Stanislav Malyshev 41f66e2a2c Fixed bug #79282 2020-03-15 17:26:00 -07:00
Christoph M. Becker b48c05a982 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix typo in php.ini comment
2020-03-15 15:01:23 +01:00
Jacob Dreesen 68e2da6362 Fix typo in php.ini comment 2020-03-15 15:00:05 +01:00
Dmitry Stogov c5159b3832 Check asserts early 2020-03-12 22:26:30 +03:00
Dmitry Stogov b6492b4453 identation fix 2020-03-12 22:26:16 +03:00
Dmitry Stogov 3c6e9bed1a Call global code of preloaded script in global context 2020-03-12 22:19:47 +03:00
Dmitry Stogov 2dddab01ae Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script 2020-03-12 16:31:24 +03:00
Christoph M. Becker ddc3f3d595 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79199: curl_copy_handle() memory leak
2020-03-12 11:27:45 +01:00
Christoph M. Becker 2b5fc8e325 Fix #79199: curl_copy_handle() memory leak
`curl_copy_handle()` already registers a new resource, so we must not
increase the refcount of the original resource.
2020-03-12 11:23:53 +01:00
Christoph M. Becker 2b56735ea0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #61597: SXE properties may lack attributes and content
2020-03-12 10:56:13 +01:00
Christoph M. Becker 7c081db885 Fix #61597: SXE properties may lack attributes and content
We must not treat a node as string if it has attributes, unless it is
an entity declaration which is always treated as string by simplexml.
2020-03-12 10:52:28 +01:00
Dmitry Stogov fee614f66b Export FFI::__BIGGEST_ALIGNMENT__ 2020-03-12 11:43:01 +03:00
Dmitry Stogov ecdaf83f5f Allow to fetch function address 2020-03-12 11:40:48 +03:00
Xinchen Hui 22c83454d6 Folder mark missed 2020-03-12 15:43:15 +08:00
Dmitry Stogov c45552e32b Export FFI::__BIGGEST_ALIGNMENT__ 2020-03-11 15:29:58 +03:00
Dmitry Stogov e902e4acd9 Allow to fetch function address 2020-03-11 15:13:27 +03:00
Christoph M. Becker 8657f03084 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78210: Invalid pointer address
2020-03-11 11:31:26 +01:00
Christoph M. BeckerandNikita Popov 53797c206a Fix #78210: Invalid pointer address
This is actually about three distinct issues:

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

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

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

Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2020-03-11 11:30:15 +01:00
Christoph M. Becker a72b261db5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79364: When copy empty array, next key is unspecified
2020-03-11 08:55:28 +01:00
Christoph M. Becker 2462f2dab1 Fix #79364: When copy empty array, next key is unspecified
We must not forget to keep the `nNextFreeElement` when duplicating
empty arrays.
2020-03-11 08:54:05 +01:00
Peter Seiderer f73528f0e0 Check for sys/auxv.h before using it.
Fixes aarch64 compile with uclibc-ng (does not provide
sys/auxv.h header file).

Closes GH-5248.

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
2020-03-10 16:53:57 +01:00
Christoph M. Becker fea2994ff8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Enclose INI values containing {TMP} in quotes
2020-03-09 22:51:11 +01:00
Christoph M. Becker d5e206620b Enclose INI values containing {TMP} in quotes
At least on Windows, the temporary directory may contain tilde signs,
which would result in an INI parse error.
2020-03-09 22:49:08 +01:00
Nikita Popov 760faa12b2 Fixed bug #79357
Peculiarly, for once the cause was not SOAPs "interesting" error
handling, but a bug in the call trampoline for internal functions...
2020-03-09 15:01:31 +01:00
Christoph M. Becker 02beefd5af PHP-7.4 is now 7.4.5-dev 2020-03-06 17:49:55 +01:00
Christoph M. Becker a595b82665 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Skip test on Windows if privileges are insufficient
2020-03-06 16:40:14 +01:00
Christoph M. Becker dc4f42508d Skip test on Windows if privileges are insufficient 2020-03-06 16:38:49 +01:00
Nikita Popov 979978cb61 Fix community job
Marco broke things again.
2020-03-06 11:43:35 +01:00
Nikita Popov c3ab8fd3f8 Add test for bug #63816
This has been fixed in PHP 7.4, add a test for it.
2020-03-06 11:16:47 +01:00
Christoph M. Becker b761997de3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #75673: SplStack::unserialize() behavior
2020-03-06 09:11:10 +01:00
Christoph M. Becker b84277297a Fix #75673: SplStack::unserialize() behavior
Even though `SplStack::unserialize()` is not supposed to be called on
an already constructed instance, it is probably better if the method
clears the stack before actually unserializing.
2020-03-06 09:09:49 +01:00
Christoph M. Becker 04c9c4ae7d Fix intermittent test failures of windows_mb_path tests
Some of these tests create, use and later remove the same folder, so if
these are run in parallel, they may fail due to race conditions[1].  As
quick fix we add appropriate CONFLICTS clauses to prevent parallel
execution of the respective test groups.

[1] <https://ci.appveyor.com/project/php/php-src/builds/31213037/job/48rp13i0frf5t9hl#L5480>
2020-03-04 12:15:10 +01:00
Remi Collet b093bd6ae8 this test needs json 2020-03-03 13:06:31 +01:00
Derick Rethans dc3e3e64f2 PHP-7.4 is now 7.4.5-dev 2020-03-03 11:29:10 +00:00
186 changed files with 1519 additions and 341 deletions

No files matched your search

+70 -1
View File
@@ -1,7 +1,62 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.4.4
16 Apr 2020, PHP 7.4.5
- Core:
. Fixed bug #79364 (When copy empty array, next key is unspecified). (cmb)
. Fixed bug #78210 (Invalid pointer address). (cmb, Nikita)
- CURL:
. Fixed bug #79199 (curl_copy_handle() memory leak). (cmb)
- Date:
. Fixed bug #79396 (DateTime hour incorrect during DST jump forward). (Nate
Brunette)
. Fixed bug #74940 (DateTimeZone loose comparison always true). (cmb)
- FPM:
. Implement request #77062 (Allow numeric [UG]ID in FPM listen.{owner,group})
(Andre Nathan)
- Iconv:
. Fixed bug #79200 (Some iconv functions cut Windows-1258). (cmb)
- OPcache:
. Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script).
(Dmitry)
- Session:
. Fixed bug #79413 (session_create_id() fails for active sessions). (cmb)
- Shmop:
. Fixed bug #79427 (Integer Overflow in shmop_open()). (cmb)
- SimpleXML:
. Fixed bug #61597 (SXE properties may lack attributes and content). (cmb)
- SOAP:
. Fixed bug #79357 (SOAP request segfaults when any request parameter is
missing). (Nikita)
- Spl:
. Fixed bug #75673 (SplStack::unserialize() behavior). (cmb)
. Fixed bug #79393 (Null coalescing operator failing with SplFixedArray).
(cmb)
- Standard:
. Fixed bug #79330 (shell_exec() silently truncates after a null byte). (stas)
. Fixed bug #79410 (system() swallows last chunk if it is exactly 4095 bytes
without newline). (Christian Schneider)
. Fixed bug #79465 (OOB Read in urldecode()). (stas)
- Zip:
. Fixed Bug #79296 (ZipArchive::open fails on empty file). (Remi)
. Fixed bug #79424 (php_zip_glob uses gl_pathc after call to globfree).
(Max Rees)
19 Mar 2020, PHP 7.4.4
- Core:
. Fixed bug #79244 (php crashes during parsing INI file). (Laruence)
@@ -34,11 +89,23 @@ PHP NEWS
. Fixed bug #79311 (enchant_dict_suggest() fails on big endian architecture).
(cmb)
- EXIF:
. Fixed bug #79282 (Use-of-uninitialized-value in exif). (CVE-2020-7064)
(Nikita)
- Fileinfo:
. Fixed bug #79283 (Segfault in libmagic patch contains a buffer
overflow). (cmb)
- FPM:
. Fixed bug #77653 (operator displayed instead of the real error message).
(Jakub Zelenka)
. Fixed bug #79014 (PHP-FPM & Primary script unknown). (Jakub Zelenka)
- MBstring:
. Fixed bug #79371 (mb_strtolower (UTF-32LE): stack-buffer-overflow at
php_unicode_tolower_full). (CVE-2020-7065) (cmb)
- MySQLi:
. Fixed bug #64032 (mysqli reports different client_version). (cmb)
@@ -68,6 +135,8 @@ PHP NEWS
. Fixed bug #79294 (::columnType() may fail after SQLite3Stmt::reset()). (cmb)
- Standard:
. Fixed bug #79329 (get_headers() silently truncates after a null byte).
(CVE-2020-7066) (cmb)
. Fixed bug #79254 (getenv() w/o arguments not showing changes). (cmb)
. Fixed bug #79265 (Improper injection of Host header when using fopen for
http requests). (Miguel Xavier Penha Neto)
+45
View File
@@ -0,0 +1,45 @@
--TEST--
Bug #63816: implementation child interface and after parent cause fatal error
--FILE--
<?php
interface RootInterface
{
function foo();
}
interface FirstChildInterface extends RootInterface
{
function foo();
}
interface SecondChildInterface extends RootInterface
{
function foo();
}
class A implements FirstChildInterface, SecondChildInterface
{
function foo()
{
}
}
class B implements RootInterface, FirstChildInterface
{
function foo()
{
}
}
class C implements FirstChildInterface, RootInterface
{
function foo()
{
}
}
?>
===DONE===
--EXPECT--
===DONE===
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #79364 (When copy empty array, next key is unspecified)
--FILE--
<?php
$a = [1, 2];
unset($a[1], $a[0]);
$b = $a;
$a[] = 3;
$b[] = 4;
var_dump($a, $b);
?>
--EXPECT--
array(1) {
[2]=>
int(3)
}
array(1) {
[2]=>
int(4)
}
+1
View File
@@ -81,6 +81,7 @@ ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len);
ZEND_API int (*zend_post_startup_cb)(void) = NULL;
ZEND_API void (*zend_post_shutdown_cb)(void) = NULL;
ZEND_API int (*zend_preload_autoload)(zend_string *filename) = NULL;
void (*zend_on_timeout)(int seconds);
+3
View File
@@ -292,6 +292,9 @@ extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t f
extern ZEND_API int (*zend_post_startup_cb)(void);
extern ZEND_API void (*zend_post_shutdown_cb)(void);
/* Callback for loading of not preloaded part of the script */
extern ZEND_API int (*zend_preload_autoload)(zend_string *filename);
ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
/* If filename is NULL the default filename is used. */
+13 -3
View File
@@ -1072,11 +1072,21 @@ ZEND_API int do_bind_class(zval *lcname, zend_string *lc_parent_name) /* {{{ */
ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(lcname));
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));
return FAILURE;
} 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));
do {
ZEND_ASSERT(EG(current_execute_data)->func->op_array.fn_flags & ZEND_ACC_PRELOADED);
if (zend_preload_autoload
&& zend_preload_autoload(EG(current_execute_data)->func->op_array.filename) == SUCCESS) {
zv = zend_hash_find_ex(EG(class_table), Z_STR_P(rtd_key), 1);
if (EXPECTED(zv != NULL)) {
break;
}
}
zend_error_noreturn(E_ERROR, "Class %s wasn't preloaded", Z_STRVAL_P(lcname));
return FAILURE;
} while (0);
}
return FAILURE;
}
/* Register the derived class */
+1 -1
View File
@@ -2055,7 +2055,7 @@ ZEND_API HashTable* ZEND_FASTCALL zend_array_dup(HashTable *source)
target->nTableMask = HT_MIN_MASK;
target->nNumUsed = 0;
target->nNumOfElements = 0;
target->nNextFreeElement = 0;
target->nNextFreeElement = source->nNextFreeElement;
target->nInternalPointer = 0;
target->nTableSize = HT_MIN_SIZE;
HT_SET_DATA_ADDR(target, &uninitialized_bucket);
+12 -3
View File
@@ -7317,8 +7317,17 @@ ZEND_VM_HANDLER(146, ZEND_DECLARE_ANON_CLASS, ANY, ANY, CACHE_SLOT)
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");
do {
ZEND_ASSERT(EX(func)->op_array.fn_flags & ZEND_ACC_PRELOADED);
if (zend_preload_autoload
&& zend_preload_autoload(EX(func)->op_array.filename) == SUCCESS) {
zv = zend_hash_find_ex(EG(class_table), rtd_key, 1);
if (EXPECTED(zv != NULL)) {
break;
}
}
zend_error_noreturn(E_ERROR, "Anonymous class wasn't preloaded");
} while (0);
}
ZEND_ASSERT(zv != NULL);
ce = Z_CE_P(zv);
@@ -8301,10 +8310,10 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
}
if (ret == NULL) {
ZVAL_NULL(&retval);
ret = &retval;
}
ZVAL_NULL(ret);
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
fbc->internal_function.handler(call, ret);
+12 -3
View File
@@ -2449,8 +2449,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_ANON_CLASS_SPEC_HANDLE
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");
do {
ZEND_ASSERT(EX(func)->op_array.fn_flags & ZEND_ACC_PRELOADED);
if (zend_preload_autoload
&& zend_preload_autoload(EX(func)->op_array.filename) == SUCCESS) {
zv = zend_hash_find_ex(EG(class_table), rtd_key, 1);
if (EXPECTED(zv != NULL)) {
break;
}
}
zend_error_noreturn(E_ERROR, "Anonymous class wasn't preloaded");
} while (0);
}
ZEND_ASSERT(zv != NULL);
ce = Z_CE_P(zv);
@@ -2806,10 +2815,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
}
if (ret == NULL) {
ZVAL_NULL(&retval);
ret = &retval;
}
ZVAL_NULL(ret);
if (!zend_execute_internal) {
/* saves one function call if zend_execute_internal is not used */
fbc->internal_function.handler(call, ret);
+1 -1
View File
@@ -75,7 +75,7 @@ jobs:
- script: |
git clone https://github.com/amphp/amp.git --branch=master --depth=1
cd amp
php7.3 /usr/bin/composer install --no-progress --ignore-platform-reqs
php /usr/bin/composer install --no-progress --ignore-platform-reqs
export USE_ZEND_ALLOC=0
sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php
php vendor/bin/phpunit
+3
View File
@@ -70,6 +70,7 @@ jobs:
- script: make -j$(/usr/bin/nproc) >/dev/null
displayName: 'Make Build'
- script: |
set -e
sudo make install
sudo mkdir /etc/php.d
sudo chmod 777 /etc/php.d
@@ -79,6 +80,8 @@ jobs:
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
displayName: 'Install Build'
- script: |
set -e
sudo service mysql start
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
sudo -u postgres psql -c "CREATE DATABASE test;"
+1
View File
@@ -1,5 +1,6 @@
steps:
- script: |
set -e
sudo make install
sudo mkdir /etc/php.d
sudo chmod 777 /etc/php.d
+2
View File
@@ -18,6 +18,8 @@ jobs:
displayName: 'Make Build'
- template: install.yml
- script: |
set -e
sudo service mysql start
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
sudo -u postgres psql -c "CREATE DATABASE test;"
+1
View File
@@ -62,6 +62,7 @@ jobs:
echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini
displayName: 'Install Build'
- script: |
sudo service mysql start
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
displayName: 'Setup'
- template: test.yml
+2 -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.3-dev],[https://bugs.php.net],[php],[https://www.php.net])
AC_INIT([PHP],[7.4.5-dev],[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
@@ -440,6 +440,7 @@ resolv.h \
strings.h \
syslog.h \
sysexits.h \
sys/auxv.h \
sys/ioctl.h \
sys/file.h \
sys/mman.h \
+3 -2
View File
@@ -297,6 +297,8 @@
e.g. `ChangeLog-7.php` from the `NEWS` file
* You may want to try `php-web/bin/news2html` to automate this task.
* Go over the list and put every element on one line.
* Check for `&`, `<` and `>` and escape them if necessary.
* Remove all the names at the ends of lines.
@@ -312,13 +314,12 @@
V. `s/FR #\([0-9]\+\)/FR <?php bugl(\1); ?>/`
* You may want to try `php-web/bin/news2html` to automate this task.
6. Add a short notice to phpweb stating that there is a new release, and
highlight the major important things (security fixes) and when it is
important to upgrade.
* Call `php bin/createNewsEntry` in your local phpweb checkout.
* Use the "frontpage" and "releases" category.
* Add the content for the news entry.
7. Commit and push all the changes to their respective git repos
+1 -1
View File
@@ -2,7 +2,7 @@
Bug #79332 (php_istreams are never freed)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('com_dotnet extension not available');
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
?>
--FILE--
<?php
-2
View File
@@ -2367,8 +2367,6 @@ PHP_FUNCTION(curl_copy_handle)
}
#endif
Z_ADDREF_P(zid);
ZVAL_RES(return_value, zend_register_resource(dupch, le_curl));
dupch->res = Z_RES_P(return_value);
}
+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #79199 (curl_copy_handle() memory leak)
--SKIPIF--
<?php
if (!extension_loaded('curl')) die('skip curl extension not available');
?>
--FILE--
<?php
$mem_old = 0;
for($i = 0; $i < 50; ++$i) {
$c1 = curl_init();
$c2 = curl_copy_handle($c1);
curl_close($c2);
curl_close($c1);
$mem_new = memory_get_usage();
if ($mem_new <= $mem_old) {
break;
}
$mem_old = $mem_new;
}
echo $i < 50 ? "okay" : "leak", PHP_EOL;
?>
--EXPECT--
okay
+29
View File
@@ -680,6 +680,8 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi
static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot);
static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot);
static int date_object_compare_timezone(zval *tz1, zval *tz2);
/* {{{ Module struct */
zend_module_entry date_module_entry = {
STANDARD_MODULE_HEADER_EX,
@@ -2152,6 +2154,7 @@ static void date_register_classes(void) /* {{{ */
date_object_handlers_timezone.offset = XtOffsetOf(php_timezone_obj, std);
date_object_handlers_timezone.free_obj = date_object_free_storage_timezone;
date_object_handlers_timezone.clone_obj = date_object_clone_timezone;
date_object_handlers_timezone.compare_objects = date_object_compare_timezone;
date_object_handlers_timezone.get_properties_for = date_object_get_properties_for_timezone;
date_object_handlers_timezone.get_gc = date_object_get_gc_timezone;
date_object_handlers_timezone.get_debug_info = date_object_get_debug_info_timezone;
@@ -2380,6 +2383,31 @@ static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */
return &new_obj->std;
} /* }}} */
static int date_object_compare_timezone(zval *tz1, zval *tz2) /* {{{ */
{
php_timezone_obj *o1, *o2;
o1 = Z_PHPTIMEZONE_P(tz1);
o2 = Z_PHPTIMEZONE_P(tz2);
ZEND_ASSERT(o1->initialized && o2->initialized);
if (o1->type != o2->type) {
php_error_docref(NULL, E_WARNING, "Trying to compare different kinds of DateTimeZone objects");
return 1;
}
switch (o1->type) {
case TIMELIB_ZONETYPE_OFFSET:
return o1->tzi.utc_offset == o2->tzi.utc_offset ? 0 : 1;
case TIMELIB_ZONETYPE_ABBR:
return strcmp(o1->tzi.z.abbr, o2->tzi.z.abbr) ? 1 : 0;
case TIMELIB_ZONETYPE_ID:
return strcmp(o1->tzi.tz->name, o2->tzi.tz->name) ? 1 : 0;
EMPTY_SWITCH_DEFAULT_CASE();
}
} /* }}} */
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
{
switch (tzobj->type) {
@@ -3573,6 +3601,7 @@ static void php_date_time_set(zval *object, zend_long h, zend_long i, zend_long
dateobj->time->s = s;
dateobj->time->us = ms;
timelib_update_ts(dateobj->time, NULL);
timelib_update_from_sse(dateobj->time);
} /* }}} */
/* {{{ proto DateTime date_time_set(DateTime object, int hour, int minute[, int second[, int microseconds]])
+48 -42
View File
@@ -1,54 +1,60 @@
--TEST--
Test of compare object handler for DateTime objects
Test of compare object handler for DateTimeZone objects
--FILE--
<?php
// NB: DateTimeZone class does not define a customized compare class handler so standard object handler will be used
$timezones = array(
['+0200', '-0200'],
['EST', 'PST'],
['Europe/Amsterdam', 'Europe/Berlin']
);
echo "Simple test for DateTimeZone compare object handler\n";
//Set the default time zone
date_default_timezone_set("Europe/London");
class DateTimeZoneExt1 extends DateTimeZone {
foreach ($timezones as [$timezone1, $timezone2]) {
compare_timezones($timezone1, $timezone1);
compare_timezones($timezone1, $timezone2);
}
class DateTimeZoneExt2 extends DateTimeZone{
public $foo = "Hello";
private $bar = 99;
var_dump(new DateTimeZone('Europe/Berlin') == new DateTimeZone('CET'));
function compare_timezones($timezone1, $timezone2)
{
$tz1 = new DateTimeZone($timezone1);
$tz2 = new DateTimeZone($timezone2);
echo "compare $timezone1 with $timezone2\n";
echo "< ";
var_dump($tz1 < $tz2);
echo "= ";
var_dump($tz1 == $tz2);
echo "> ";
var_dump($tz1 > $tz2);
}
class DateTimeZoneExt3 extends DateTimeZoneExt2 {
}
$obj1 = new DateTimeZone("Europe/London");
$obj2 = new DateTimeZoneExt1("Europe/London");
$obj3 = new DateTimeZoneExt2("Europe/London");
$obj4 = new DateTimeZoneExt3("Europe/London");
echo "\n-- All the following tests should compare equal --\n";
var_dump($obj1 == $obj1);
echo "\n-- All the following tests should compare NOT equal --\n";
var_dump($obj1 == $obj2);
var_dump($obj1 == $obj3);
var_dump($obj1 == $obj4);
var_dump($obj2 == $obj3);
var_dump($obj2 == $obj4);
var_dump($obj3 == $obj4);
?>
===DONE===
--EXPECT--
Simple test for DateTimeZone compare object handler
--EXPECTF--
compare +0200 with +0200
< bool(false)
= bool(true)
> bool(false)
compare +0200 with -0200
< bool(false)
= bool(false)
> bool(false)
compare EST with EST
< bool(false)
= bool(true)
> bool(false)
compare EST with PST
< bool(false)
= bool(false)
> bool(false)
compare Europe/Amsterdam with Europe/Amsterdam
< bool(false)
= bool(true)
> bool(false)
compare Europe/Amsterdam with Europe/Berlin
< bool(false)
= bool(false)
> bool(false)
-- All the following tests should compare equal --
bool(true)
-- All the following tests should compare NOT equal --
Warning: main(): Trying to compare different kinds of DateTimeZone objects in %s on line %d
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
===DONE===
@@ -0,0 +1,24 @@
--TEST--
Test for setting Date/Time during a forward DST transition
--FILE--
<?php
date_default_timezone_set('America/Chicago');
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(2, 0)->format('Y-m-d H:i:s T/e - U') . "\n";
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(2, 30)->format('Y-m-d H:i:s T/e - U') . "\n";
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(3, 0)->format('Y-m-d H:i:s T/e - U') . "\n";
$date = new DateTime('2020-03-08 01:30:00');
echo $date->setTime(1, 59, 59)->format('Y-m-d H:i:s T/e - U') . "\n";
?>
--EXPECT--
2020-03-08 03:00:00 CDT/America/Chicago - 1583654400
2020-03-08 03:30:00 CDT/America/Chicago - 1583656200
2020-03-08 03:00:00 CDT/America/Chicago - 1583654400
2020-03-08 01:59:59 CST/America/Chicago - 1583654399
+6 -1
View File
@@ -3677,6 +3677,11 @@ static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf,
{
unsigned exif_value_2a, offset_of_ifd;
if (length < 2) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Missing TIFF alignment marker");
return;
}
/* set the thumbnail stuff to nothing so we can test to see if they get set up */
if (memcmp(CharBuf, "II", 2) == 0) {
ImageInfo->motorola_intel = 0;
@@ -3829,7 +3834,7 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo)
return FALSE;
}
sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL);
sn = exif_file_sections_add(ImageInfo, marker, itemlen, NULL);
Data = ImageInfo->file.list[sn].data;
/* Store first two pre-read bytes. */
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #79282: Use-of-uninitialized-value in exif
--FILE--
<?php
var_dump(exif_read_data('data://image/jpeg;base64,/9jhAAlFeGlmAAAg'));
?>
--EXPECTF--
Warning: exif_read_data(): Missing TIFF alignment marker in %s on line %d
Warning: exif_read_data(): File structure corrupted in %s on line %d
Warning: exif_read_data(): Invalid JPEG file in %s on line %d
bool(false)
+27 -6
View File
@@ -43,6 +43,11 @@
#endif
#endif
#ifndef __BIGGEST_ALIGNMENT__
/* XXX need something better, perhaps with regard to SIMD, etc. */
# define __BIGGEST_ALIGNMENT__ sizeof(size_t)
#endif
ZEND_DECLARE_MODULE_GLOBALS(ffi)
typedef enum _zend_ffi_tag_kind {
@@ -582,6 +587,7 @@ static uint64_t zend_ffi_bit_field_read(void *ptr, zend_ffi_field *field) /* {{{
return val;
}
/* }}} */
static void zend_ffi_bit_field_to_zval(void *ptr, zend_ffi_field *field, zval *rv) /* {{{ */
{
@@ -2354,7 +2360,7 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
if (ffi->symbols) {
sym = zend_hash_find_ptr(ffi->symbols, var_name);
if (sym && sym->kind != ZEND_FFI_SYM_VAR && sym->kind != ZEND_FFI_SYM_CONST) {
if (sym && sym->kind != ZEND_FFI_SYM_VAR && sym->kind != ZEND_FFI_SYM_CONST && sym->kind != ZEND_FFI_SYM_FUNC) {
sym = NULL;
}
}
@@ -2368,6 +2374,24 @@ static zval *zend_ffi_read_var(zval *object, zval *member, int read_type, void *
if (sym->kind == ZEND_FFI_SYM_VAR) {
zend_ffi_cdata_to_zval(NULL, sym->addr, ZEND_FFI_TYPE(sym->type), read_type, rv, (zend_ffi_flags)sym->is_const, 0);
} else if (sym->kind == ZEND_FFI_SYM_FUNC) {
zend_ffi_cdata *cdata;
zend_ffi_type *new_type = emalloc(sizeof(zend_ffi_type));
new_type->kind = ZEND_FFI_TYPE_POINTER;
new_type->attr = 0;
new_type->size = sizeof(void*);
new_type->align = _Alignof(void*);
new_type->pointer.type = ZEND_FFI_TYPE(sym->type);
cdata = emalloc(sizeof(zend_ffi_cdata));
zend_ffi_object_init(&cdata->std, zend_ffi_cdata_ce);
cdata->std.handlers = &zend_ffi_cdata_handlers;
cdata->type = ZEND_FFI_TYPE_MAKE_OWNED(new_type);
cdata->flags = ZEND_FFI_FLAG_CONST;
cdata->ptr_holder = sym->addr;
cdata->ptr = &cdata->ptr_holder;
ZVAL_OBJ(rv, &cdata->std);
} else {
ZVAL_LONG(rv, sym->value);
}
@@ -5016,6 +5040,8 @@ ZEND_MINIT_FUNCTION(ffi)
zend_ffi_handlers.get_properties = zend_fake_get_properties;
zend_ffi_handlers.get_gc = zend_fake_get_gc;
zend_declare_class_constant_long(zend_ffi_ce, "__BIGGEST_ALIGNMENT__", sizeof("__BIGGEST_ALIGNMENT__")-1, __BIGGEST_ALIGNMENT__);
INIT_NS_CLASS_ENTRY(ce, "FFI", "CData", NULL);
zend_ffi_cdata_ce = zend_register_internal_class(&ce);
zend_ffi_cdata_ce->ce_flags |= ZEND_ACC_FINAL;
@@ -6347,11 +6373,6 @@ void zend_ffi_set_abi(zend_ffi_dcl *dcl, uint16_t abi) /* {{{ */
}
/* }}} */
#ifndef __BIGGEST_ALIGNMENT__
/* XXX need something better, perhaps with regard to SIMD, etc. */
# define __BIGGEST_ALIGNMENT__ sizeof(size_t)
#endif
#define SIMPLE_ATTRIBUTES(_) \
_(cdecl) \
_(fastcall) \
+1 -1
View File
@@ -200,7 +200,7 @@ typedef struct _zend_ffi_val {
uint64_t u64;
int64_t i64;
zend_ffi_double d;
char ch;
signed char ch;
struct {
const char *str;
size_t len;
+2 -2
View File
@@ -61,8 +61,8 @@ test_size(32, "struct {char a; uint32_t b __attribute__((aligned(16)));}");
test_align(16, "struct {char a; uint32_t b __attribute__((aligned(16)));}");
if (substr(PHP_OS, 0, 3) != 'WIN') {
test_size(32, "struct {char a; uint32_t b __attribute__((aligned));}");
test_align(16, "struct {char a; uint32_t b __attribute__((aligned));}");
test_size(FFI::__BIGGEST_ALIGNMENT__ * 2, "struct {char a; uint32_t b __attribute__((aligned));}");
test_align(FFI::__BIGGEST_ALIGNMENT__, "struct {char a; uint32_t b __attribute__((aligned));}");
}
test_size(16, "struct __declspec(align(16)) {char a; uint32_t b;}");
+6 -10
View File
@@ -2,9 +2,10 @@
FFI 100: PHP symbols
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('utils.inc'); ?>
<?php
try {
FFI::cdef("extern void *zend_printf;");
ffi_cdef("extern void *zend_printf;", ffi_get_php_dll_name());
} catch (Throwable $e) {
die('skip PHP symbols not available');
}
@@ -13,14 +14,9 @@ try {
ffi.enable=1
--FILE--
<?php
// Check if target supports "fastcall" calling convention
try {
FFI::cdef("extern size_t __attribute__((fastcall)) (*zend_printf)(const char *format);");
$fastcall = "__attribute__((fastcall)) ";
} catch (Throwable $e) {
$fastcall = "";
}
$zend = FFI::cdef("
require_once('utils.inc');
$fastcall = ffi_get_fastcall_specifier();
$zend = ffi_cdef("
const char *get_zend_version(void);
//char *get_zend_version(void);
extern size_t (*zend_printf)(const char *format, ...);
@@ -29,7 +25,7 @@ $zend = FFI::cdef("
void $fastcall zend_str_tolower(char *str, size_t length);
");
", ffi_get_php_dll_name());
var_dump(trim(explode("\n",$zend->get_zend_version())[0]));
//var_dump(trim(FFI::string($zend->get_zend_version())));
var_dump($zend->zend_printf);
+55
View File
@@ -0,0 +1,55 @@
--TEST--
FFI 101: PHP symbols (function address)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('utils.inc'); ?>
<?php
try {
ffi_cdef("extern void *zend_printf;", ffi_get_php_dll_name());
} catch (Throwable $e) {
die('skip PHP symbols not available');
}
?>
--INI--
ffi.enable=1
--FILE--
<?php
require_once('utils.inc');
$fastcall = ffi_get_fastcall_specifier();
$zend = ffi_cdef("
const char *get_zend_version(void);
//char *get_zend_version(void);
extern size_t (*zend_printf)(const char *format, ...);
unsigned long $fastcall zend_hash_func(const char *str, size_t len);
void $fastcall zend_str_tolower(char *str, size_t length);
", ffi_get_php_dll_name());
$f = $zend->get_zend_version;
var_dump(trim(explode("\n",$f())[0]));
//var_dump(trim(FFI::string($zend->get_zend_version())));
var_dump($zend->zend_printf);
var_dump(($zend->zend_printf)("Hello %s!\n", "World"));
$f = $zend->zend_hash_func;
var_dump($f("file", strlen("file")));
$str = $zend->new("char[16]");
FFI::memcpy($str, "Hello World!", strlen("Hello World!"));
$f = $zend->zend_str_tolower;
$f($str, strlen("Hello World!"));
var_dump(FFI::string($str));
?>
--EXPECTF--
string(%d) "Zend Engine %s"
object(FFI\CData:uint%d_t(*)())#%d (1) {
[0]=>
object(FFI\CData:uint%d_t())#%d (0) {
}
}
Hello World!
int(13)
int(%i)
string(12) "hello world!"
+4 -2
View File
@@ -2,9 +2,10 @@
FFI 200: PHP callbacks
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('utils.inc'); ?>
<?php
try {
FFI::cdef("void* zend_write;");
FFI::cdef("void* zend_write;", ffi_get_php_dll_name());
} catch (Throwable $e) {
die('skip PHP symbols not available');
}
@@ -13,10 +14,11 @@ try {
ffi.enable=1
--FILE--
<?php
require_once('utils.inc');
$zend = FFI::cdef("
typedef int (*zend_write_func_t)(const char *str, size_t str_length);
extern zend_write_func_t zend_write;
");
", ffi_get_php_dll_name());
echo "Hello World!\n";
+2 -1
View File
@@ -7,10 +7,11 @@ FFI 301: FFI loading on Windows
ffi.enable=1
--FILE--
<?php
require_once('utils.inc');
$fn = __DIR__ . "/300-win32.h";
$cont = str_replace(
"PHP_DLL_NAME",
"php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll",
ffi_get_php_dll_name(),
file_get_contents("$fn.in")
);
file_put_contents($fn, $cont);
+4 -2
View File
@@ -3,8 +3,9 @@ Bug #77632 (FFI function pointers with variadics)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('utils.inc');
try {
FFI::cdef("extern void *zend_printf;");
FFI::cdef("extern void *zend_printf;", ffi_get_php_dll_name());
} catch (Throwable $_) {
die('skip PHP symbols not available');
}
@@ -13,7 +14,8 @@ try {
ffi.enable=1
--FILE--
<?php
$libc = FFI::cdef("extern size_t (*zend_printf)(const char *format, ...);");
require_once('utils.inc');
$libc = FFI::cdef("extern size_t (*zend_printf)(const char *format, ...);", ffi_get_php_dll_name());
$args = ["test from zend_printf\n"];
($libc->zend_printf)(...$args);
$args2 = ["Hello, %s from zend_printf\n", "world"];
+4 -4
View File
@@ -5,26 +5,26 @@ 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");
require_once('utils.inc');
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
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, $dll);
EOC, ffi_get_php_dll_name());
} catch (FFI\ParserException $ex) {
die('skip __vectorcall not supported');
}
?>
--FILE--
<?php
$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
require_once('utils.inc');
$ffi = FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, $dll);
EOC, ffi_get_php_dll_name());
var_dump($ffi->zend_atoi("17.4", 4));
?>
--EXPECT--
+2 -2
View File
@@ -5,11 +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");
$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
require_once('utils.inc');
try {
FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, $dll);
EOC, ffi_get_php_dll_name());
} catch (FFI\ParserException $ex) {
die('skip __vectorcall not supported');
}
+2 -6
View File
@@ -6,13 +6,9 @@ Bug #78714 (funcs returning pointer can't use call convention spec)
ffi.enable=1
--FILE--
<?php
require_once('utils.inc');
$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);
}
$ffi = ffi_cdef($def, ffi_get_php_dll_name());
echo substr(FFI::string($ffi->get_zend_version()), 0, 4) . "\n";
?>
--EXPECT--
+2 -2
View File
@@ -7,6 +7,7 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not available'
?>
--FILE--
<?php
require_once('utils.inc');
$header = <<<HEADER
struct bug79096 {
uint64_t a;
@@ -22,8 +23,7 @@ if (PHP_OS_FAMILY !== 'Windows') {
try {
$ffi = FFI::cdef($header, 'php_zend_test.dll');
} catch (FFI\Exception $ex) {
$dll = $dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
$ffi = FFI::cdef($header, $dll);
$ffi = FFI::cdef($header, ffi_get_php_dll_name());
}
}
+2 -13
View File
@@ -1,14 +1,3 @@
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
$fn = __DIR__ . "/300-win32.h";
$cont = str_replace(
"PHP_DLL_NAME",
"php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll",
file_get_contents("$fn.in")
);
file_put_contents($fn, $cont);
$ffi = FFI::load($fn);
/* Test should cleanup this. */
} else {
FFI::load(__DIR__ . "/300.h");
}
FFI::load(__DIR__ . "/300.h");
+30
View File
@@ -0,0 +1,30 @@
<?php
function ffi_cdef($code, $lib)
{
if (isset($lib)) {
return FFI::cdef($code, $lib);
} else {
return FFI::cdef($code);
}
}
function ffi_get_php_dll_name()
{
if (PHP_OS_FAMILY === 'Windows') {
return "php" . PHP_MAJOR_VERSION . (PHP_ZTS ? "ts" : "") . (PHP_DEBUG ? "_debug" : "") . ".dll";
} else {
return null;
}
}
function ffi_get_fastcall_specifier()
{
foreach (['__attribute__((fastcall))', '__fastcall', '__vectorcall'] as $spec) {
try {
ffi_cdef("extern size_t $spec zend_list_insert(void *ptr, int type);", ffi_get_php_dll_name());
return "$spec ";
} catch (Throwable $e) {}
}
return "";
}
+38 -24
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/apprentice.c 2020-03-02 15:04:23.670412600 +0100
+++ libmagic/apprentice.c 2020-02-27 11:45:38.445854000 +0100
@@ -29,6 +29,8 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
@@ -974,7 +974,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
--- libmagic.orig/ascmagic.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/ascmagic.c 2020-03-02 15:04:23.671413500 +0100
+++ libmagic/ascmagic.c 2020-02-26 23:18:22.605400700 +0100
@@ -96,7 +96,7 @@
rv = file_ascmagic_with_encoding(ms, &bb,
ubuf, ulen, code, type, text);
@@ -1005,7 +1005,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
}
diff -u libmagic.orig/buffer.c libmagic/buffer.c
--- libmagic.orig/buffer.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/buffer.c 2020-03-02 15:04:23.672412500 +0100
+++ libmagic/buffer.c 2020-02-27 11:45:38.445854000 +0100
@@ -31,19 +31,23 @@
#endif /* lint */
@@ -1062,7 +1062,7 @@ diff -u libmagic.orig/buffer.c libmagic/buffer.c
diff -u libmagic.orig/cdf.c libmagic/cdf.c
--- libmagic.orig/cdf.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/cdf.c 2020-03-02 15:04:23.674415200 +0100
+++ libmagic/cdf.c 2020-02-27 11:45:38.445854000 +0100
@@ -43,7 +43,17 @@
#include <err.h>
#endif
@@ -1341,7 +1341,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
#endif
diff -u libmagic.orig/cdf.h libmagic/cdf.h
--- libmagic.orig/cdf.h 2019-02-20 02:24:19.000000000 +0100
+++ libmagic/cdf.h 2020-03-02 15:04:23.675416900 +0100
+++ libmagic/cdf.h 2020-02-27 11:45:38.445854000 +0100
@@ -35,10 +35,10 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -1366,7 +1366,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
#define CDF_SECID_FREE -1
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/cdf_time.c 2020-03-02 15:04:23.676413000 +0100
+++ libmagic/cdf_time.c 2020-02-26 23:18:22.611402900 +0100
@@ -23,6 +23,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
@@ -1395,7 +1395,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
(void)snprintf(buf, 26, "*Bad* %#16.16" INT64_T_FORMAT "x\n",
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/compress.c 2020-03-02 15:04:23.676413000 +0100
+++ libmagic/compress.c 2020-02-27 11:45:38.445854000 +0100
@@ -45,13 +45,11 @@
#endif
#include <string.h>
@@ -1545,7 +1545,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
+#endif
diff -u libmagic.orig/der.c libmagic/der.c
--- libmagic.orig/der.c 2019-02-20 03:35:27.000000000 +0100
+++ libmagic/der.c 2020-03-02 15:04:23.677412900 +0100
+++ libmagic/der.c 2020-02-27 11:45:38.445854000 +0100
@@ -51,7 +51,9 @@
#include "magic.h"
#include "der.h"
@@ -1575,7 +1575,7 @@ diff -u libmagic.orig/der.c libmagic/der.c
snprintf(buf + z, blen - z, "%.2x", d[i]);
diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
--- libmagic.orig/elfclass.h 2019-02-20 02:30:19.000000000 +0100
+++ libmagic/elfclass.h 2020-03-02 15:04:23.679414300 +0100
+++ libmagic/elfclass.h 2020-02-26 23:18:22.613401700 +0100
@@ -41,7 +41,7 @@
return toomany(ms, "program headers", phnum);
flags |= FLAGS_IS_CORE;
@@ -1605,7 +1605,7 @@ diff -u libmagic.orig/elfclass.h libmagic/elfclass.h
CAST(int, elf_getu16(swap, elfhdr.e_shstrndx)),
diff -u libmagic.orig/encoding.c libmagic/encoding.c
--- libmagic.orig/encoding.c 2019-04-15 18:48:41.000000000 +0200
+++ libmagic/encoding.c 2020-03-02 15:04:23.680413600 +0100
+++ libmagic/encoding.c 2020-02-26 23:18:22.614402300 +0100
@@ -89,13 +89,13 @@
*code_mime = "binary";
@@ -1636,7 +1636,7 @@ diff -u libmagic.orig/encoding.c libmagic/encoding.c
}
diff -u libmagic.orig/file.h libmagic/file.h
--- libmagic.orig/file.h 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/file.h 2020-03-02 15:04:23.682414300 +0100
+++ libmagic/file.h 2020-02-27 11:45:38.445854000 +0100
@@ -33,18 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1923,7 +1923,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#endif
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c 2019-05-07 04:26:48.000000000 +0200
+++ libmagic/fsmagic.c 2020-03-02 15:04:23.683417500 +0100
+++ libmagic/fsmagic.c 2020-02-26 23:18:22.616403500 +0100
@@ -66,26 +66,10 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -2216,7 +2216,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
case S_IFSOCK:
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/funcs.c 2020-03-02 15:04:23.684415800 +0100
+++ libmagic/funcs.c 2020-02-27 11:45:38.445854000 +0100
@@ -31,7 +31,6 @@
#endif /* lint */
@@ -2572,7 +2572,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c 2019-05-07 04:27:11.000000000 +0200
+++ libmagic/magic.c 2020-03-02 15:04:23.686413600 +0100
+++ libmagic/magic.c 2020-02-26 23:18:22.621402800 +0100
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -3036,8 +3036,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
public const char *
magic_error(struct magic_set *ms)
diff -u libmagic.orig/magic.h libmagic/magic.h
--- libmagic.orig/magic.h 2020-03-02 15:06:39.235737800 +0100
+++ libmagic/magic.h 2020-03-02 15:04:23.686413600 +0100
--- libmagic.orig/magic.h 2020-03-02 15:24:27.253951700 +0100
+++ libmagic/magic.h 2020-02-26 23:18:22.622402300 +0100
@@ -124,6 +124,7 @@
const char *magic_getpath(const char *, int);
@@ -3048,7 +3048,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/print.c 2020-03-02 15:04:23.688414000 +0100
+++ libmagic/print.c 2020-02-26 23:18:22.625401800 +0100
@@ -28,6 +28,7 @@
/*
* print.c - debugging printout routines
@@ -3122,7 +3122,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
goto out;
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
--- libmagic.orig/readcdf.c 2019-03-12 21:43:05.000000000 +0100
+++ libmagic/readcdf.c 2020-03-02 15:04:23.689414500 +0100
+++ libmagic/readcdf.c 2020-02-27 11:45:38.445854000 +0100
@@ -31,7 +31,11 @@
#include <assert.h>
@@ -3241,7 +3241,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
if (i != -1)
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
--- libmagic.orig/softmagic.c 2019-05-17 04:24:59.000000000 +0200
+++ libmagic/softmagic.c 2020-03-02 15:04:23.690413500 +0100
+++ libmagic/softmagic.c 2020-03-02 15:23:10.176763300 +0100
@@ -43,6 +43,10 @@
#include <time.h>
#include "der.h"
@@ -3414,18 +3414,32 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
return rv;
case FILE_USE:
@@ -1926,6 +1904,47 @@
@@ -1926,6 +1904,61 @@
return file_strncmp(a, b, len, flags);
}
+public void
+convert_libmagic_pattern(zval *pattern, char *val, size_t len, uint32_t options)
+{
+ int i, j=0;
+ int i, j;
+ zend_string *t;
+
+ t = zend_string_alloc(len * 2 + 4, 0);
+ for (i = j = 0; i < len; i++) {
+ switch (val[i]) {
+ case '~':
+ j += 2;
+ break;
+ case '\0':
+ j += 4;
+ break;
+ default:
+ j++;
+ break;
+ }
+ }
+ t = zend_string_alloc(j + 4, 0);
+
+ j = 0;
+ ZSTR_VAL(t)[j++] = '~';
+
+ for (i = 0; i < len; i++, j++) {
@@ -3462,7 +3476,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int
magiccheck(struct magic_set *ms, struct magic *m)
{
@@ -2104,65 +2123,77 @@
@@ -2104,65 +2137,77 @@
break;
}
case FILE_REGEX: {
@@ -3594,7 +3608,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
case FILE_INDIRECT:
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
--- libmagic.orig/strcasestr.c 2014-09-11 17:05:33.000000000 +0200
+++ libmagic/strcasestr.c 2019-04-02 11:56:06.853152400 +0200
+++ libmagic/strcasestr.c 2019-11-29 08:49:38.434136600 +0100
@@ -39,6 +39,8 @@
#include "file.h"
+16 -2
View File
@@ -1907,11 +1907,25 @@ file_strncmp16(const char *a, const char *b, size_t len, uint32_t flags)
public void
convert_libmagic_pattern(zval *pattern, char *val, size_t len, uint32_t options)
{
int i, j=0;
int i, j;
zend_string *t;
t = zend_string_alloc(len * 2 + 4, 0);
for (i = j = 0; i < len; i++) {
switch (val[i]) {
case '~':
j += 2;
break;
case '\0':
j += 4;
break;
default:
j++;
break;
}
}
t = zend_string_alloc(j + 4, 0);
j = 0;
ZSTR_VAL(t)[j++] = '~';
for (i = 0; i < len; i++, j++) {
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #79283 (Segfault in libmagic patch contains a buffer overflow)
--SKIPIF--
<?php
if (!extension_loaded('fileinfo')) die('skip fileinfo extension not available');
?>
--FILE--
<?php
$magic_file = __DIR__ . '/bug79283.db';
file_put_contents($magic_file, "
0 regex \\0\\0\\0\\0 Test
");
$finfo = new finfo(FILEINFO_NONE, $magic_file);
var_dump($finfo->buffer("buffer\n"));
?>
--CLEAN--
<?php
unlink(__DIR__ . '/bug79283.db');
?>
--EXPECT--
string(10) "ASCII text"
+47 -38
View File
@@ -724,6 +724,7 @@ static php_iconv_err_t _php_iconv_strlen(size_t *pretval, const char *str, size_
size_t out_left;
size_t cnt;
int more;
*pretval = (size_t)-1;
@@ -743,25 +744,23 @@ static php_iconv_err_t _php_iconv_strlen(size_t *pretval, const char *str, size_
errno = 0;
out_left = 0;
more = nbytes > 0;
for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0; cnt+=2) {
size_t prev_in_left;
for (in_p = str, in_left = nbytes, cnt = 0; more;) {
out_p = buf;
out_left = sizeof(buf);
prev_in_left = in_left;
more = in_left > 0;
if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
if (prev_in_left == in_left) {
break;
}
iconv(cd, more ? (char **)&in_p : NULL, more ? &in_left : NULL, (char **) &out_p, &out_left);
if (out_left == sizeof(buf)) {
break;
} else {
ZEND_ASSERT((sizeof(buf) - out_left) % GENERIC_SUPERSET_NBYTES == 0);
cnt += (sizeof(buf) - out_left) / GENERIC_SUPERSET_NBYTES;
}
}
if (out_left > 0) {
cnt -= out_left / GENERIC_SUPERSET_NBYTES;
}
#if ICONV_SUPPORTS_ERRNO
switch (errno) {
case EINVAL:
@@ -810,6 +809,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
size_t cnt;
size_t total_len;
int more;
err = _php_iconv_strlen(&total_len, str, nbytes, enc);
if (err != PHP_ICONV_ERR_SUCCESS) {
@@ -864,18 +864,17 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
cd2 = (iconv_t)NULL;
errno = 0;
more = nbytes > 0 && len > 0;
for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0 && len > 0; ++cnt) {
size_t prev_in_left;
for (in_p = str, in_left = nbytes, cnt = 0; more; ++cnt) {
out_p = buf;
out_left = sizeof(buf);
prev_in_left = in_left;
more = in_left > 0 && len > 0;
if (iconv(cd1, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
if (prev_in_left == in_left) {
break;
}
iconv(cd1, more ? (char **)&in_p : NULL, more ? &in_left : NULL, (char **) &out_p, &out_left);
if (out_left == sizeof(buf)) {
break;
}
if ((zend_long)cnt >= offset) {
@@ -963,6 +962,8 @@ static php_iconv_err_t _php_iconv_strpos(size_t *pretval,
size_t ndl_buf_left;
size_t match_ofs;
int more;
size_t iconv_ret;
*pretval = (size_t)-1;
@@ -995,37 +996,38 @@ static php_iconv_err_t _php_iconv_strpos(size_t *pretval,
ndl_buf_p = ZSTR_VAL(ndl_buf);
ndl_buf_left = ZSTR_LEN(ndl_buf);
match_ofs = (size_t)-1;
more = haystk_nbytes > 0;
for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) {
size_t prev_in_left;
for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; more; ++cnt) {
out_p = buf;
out_left = sizeof(buf);
prev_in_left = in_left;
more = in_left > 0;
if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
if (prev_in_left == in_left) {
iconv_ret = iconv(cd, more ? (char **)&in_p : NULL, more ? &in_left : NULL, (char **) &out_p, &out_left);
if (out_left == sizeof(buf)) {
break;
}
#if ICONV_SUPPORTS_ERRNO
switch (errno) {
case EINVAL:
err = PHP_ICONV_ERR_ILLEGAL_CHAR;
break;
if (iconv_ret == (size_t)-1) {
switch (errno) {
case EINVAL:
err = PHP_ICONV_ERR_ILLEGAL_CHAR;
break;
case EILSEQ:
err = PHP_ICONV_ERR_ILLEGAL_SEQ;
break;
case EILSEQ:
err = PHP_ICONV_ERR_ILLEGAL_SEQ;
break;
case E2BIG:
break;
case E2BIG:
break;
default:
err = PHP_ICONV_ERR_UNKNOWN;
break;
}
#endif
break;
default:
err = PHP_ICONV_ERR_UNKNOWN;
break;
}
}
#endif
if (offset >= 0) {
if (cnt >= (size_t)offset) {
if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) {
@@ -1997,6 +1999,13 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
*next_pos = p1;
}
if (cd != (iconv_t)(-1)) {
_php_iconv_appendl(pretval, NULL, 0, cd);
}
if (cd_pl != (iconv_t)(-1)) {
_php_iconv_appendl(pretval, NULL, 0, cd_pl);
}
smart_str_0(pretval);
out:
if (cd != (iconv_t)(-1)) {
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #79200 (Some iconv functions cut Windows-1258)
--SKIPIF--
<?php
if (!extension_loaded('iconv')) die('skip iconv extension not available');
?>
--FILE--
<?php
var_dump(iconv_mime_decode('=?windows-1258?Q?test=20test?=', 0, 'UTF-8'));
var_dump(iconv_strlen('test test', 'WINDOWS-1258'));
var_dump(iconv_strpos('test test', 'test test', 0, 'WINDOWS-1258'));
var_dump(iconv_substr('test test', 0 , 9, 'WINDOWS-1258'));
?>
--EXPECT--
string(9) "test test"
int(9)
int(0)
string(9) "test test"
+1 -1
View File
@@ -315,7 +315,7 @@ static int convert_case_filter(int c, void *void_data)
/* Handle invalid characters early, as we assign special meaning to
* codepoints above 0xffffff. */
if (UNEXPECTED(c > 0xffffff)) {
if (UNEXPECTED((unsigned) c > 0xffffff)) {
(*data->next_filter->filter_function)(c, data->next_filter);
return 0;
}
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #79371 (mb_strtolower (UTF-32LE): stack-buffer-overflow)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
?>
--FILE--
<?php
$bytes = array(0xef, 0xbf, 0xbd, 0xef);
$str = implode(array_map("chr", $bytes));
var_dump(bin2hex(mb_strtolower($str, "UTF-32LE")));
?>
--EXPECT--
string(8) "3f000000"
@@ -89,7 +89,7 @@ if (!$IS_MYSQLND)
// F - file name
$trace = try_control_string($link, 't:O,' . $trace_file . ':F', $trace_file, 50);
// hopefully we'll never see a file name that's not covered by this regular expression...
if (!preg_match("@^\s*[/\w\\\\d\.\-]+\.[ch]@ismU", $trace))
if (!preg_match("@^\s*[/\w\\\\d\.:\-]+\.[ch]@ismU", $trace))
printf("[055] File names seem to be missing, first characters from trace are '%s'\n", substr($trace, 0, 80));
// -n - print function nesting depth
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
?>
--INI--
mysqlnd.debug=d:t:O,{TMP}/mysqlnd.trace
mysqlnd.debug="d:t:O,{TMP}/mysqlnd.trace"
--FILE--
<?php
require_once("connect.inc");
@@ -10,7 +10,7 @@ if (!$IS_MYSQLND) {
}
?>
--INI--
mysqlnd.debug=d:t:O,{TMP}/mysqlnd.trace
mysqlnd.debug="d:t:O,{TMP}/mysqlnd.trace"
mysqlnd.net_read_buffer_size=1
mysqlnd.mempool_default_size=1
mysqlnd.fetch_data_copy=0
+8
View File
@@ -728,6 +728,7 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
*/
if (server_public_key_len <= passwd_len + 41) {
/* password message is to long */
RSA_free(server_public_key);
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
DBG_ERR("password is too long");
DBG_RETURN(NULL);
@@ -808,6 +809,7 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
*/
if ((size_t) server_public_key_len <= passwd_len + 41) {
/* password message is to long */
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
DBG_ERR("password is too long");
DBG_RETURN(0);
@@ -817,6 +819,7 @@ mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_pub
ret = malloc(*auth_data_len);
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
NULL, 0, ret, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
DBG_RETURN(0);
}
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
@@ -1018,6 +1021,7 @@ mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t serv
*/
if (server_public_key_len <= passwd_len + 41) {
/* password message is to long */
RSA_free(server_public_key);
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
DBG_ERR("password is too long");
DBG_RETURN(0);
@@ -1025,6 +1029,7 @@ mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t serv
*crypted = emalloc(server_public_key_len);
RSA_public_encrypt(passwd_len + 1, (zend_uchar *) xor_str, *crypted, server_public_key, RSA_PKCS1_OAEP_PADDING);
RSA_free(server_public_key);
DBG_RETURN(server_public_key_len);
}
/* }}} */
@@ -1054,6 +1059,7 @@ mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t serv
*/
if ((size_t) server_public_key_len <= passwd_len + 41) {
/* password message is to long */
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
DBG_ERR("password is too long");
DBG_RETURN(0);
@@ -1062,8 +1068,10 @@ mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t serv
*crypted = emalloc(server_public_key_len);
if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
NULL, 0, *crypted, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
DBG_RETURN(0);
}
BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
DBG_RETURN(server_public_key_len);
}
/* }}} */
+6 -3
View File
@@ -295,8 +295,10 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_op
while (call_info) {
call_info->caller_init_opline -=
shiftlist[call_info->caller_init_opline - op_array->opcodes];
call_info->caller_call_opline -=
shiftlist[call_info->caller_call_opline - op_array->opcodes];
if (call_info->caller_call_opline) {
call_info->caller_call_opline -=
shiftlist[call_info->caller_call_opline - op_array->opcodes];
}
call_info = call_info->next_callee;
}
}
@@ -393,7 +395,8 @@ int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa)
zend_call_info *call_info = func_info->callee_info;
do {
if (call_info->caller_call_opline->opcode == ZEND_DO_ICALL
if (call_info->caller_call_opline
&& call_info->caller_call_opline->opcode == ZEND_DO_ICALL
&& call_info->callee_func
&& ZSTR_LEN(call_info->callee_func->common.function_name) == sizeof("in_array")-1
&& memcmp(ZSTR_VAL(call_info->callee_func->common.function_name), "in_array", sizeof("in_array")-1) == 0
+2 -1
View File
@@ -1288,7 +1288,8 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
}
call = ctx->call_map[opline - ctx->scdf.op_array->opcodes];
if (IS_TOP(op1) || !call || call->caller_call_opline->opcode != ZEND_DO_ICALL) {
if (IS_TOP(op1) || !call || !call->caller_call_opline
|| call->caller_call_opline->opcode != ZEND_DO_ICALL) {
return;
}
+7 -1
View File
@@ -177,6 +177,10 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
call_info->num_args = -1;
}
break;
case ZEND_EXIT:
/* In this case the DO_CALL opcode may have been dropped
* and caller_call_opline will be NULL. */
break;
}
opline++;
}
@@ -286,7 +290,9 @@ zend_call_info **zend_build_call_map(zend_arena **arena, zend_func_info *info, z
for (call = info->callee_info; call; call = call->next_callee) {
int i;
map[call->caller_init_opline - op_array->opcodes] = call;
map[call->caller_call_opline - op_array->opcodes] = call;
if (call->caller_call_opline) {
map[call->caller_call_opline - op_array->opcodes] = call;
}
for (i = 0; i < call->num_args; i++) {
if (call->arg_info[i].opline) {
map[call->arg_info[i].opline - op_array->opcodes] = call;
+17 -4
View File
@@ -1797,12 +1797,25 @@ static int zend_infer_ranges(const zend_op_array *op_array, zend_ssa *ssa) /* {{
}
} WHILE_WORKLIST_END();
/* Add all SCC entry variables into worklist for narrowing */
/* initialize missing ranges */
for (j = scc_var[scc]; j >= 0; j = next_scc_var[j]) {
if (!ssa->var_info[j].has_range) {
zend_inference_init_range(op_array, ssa, j, 1, ZEND_LONG_MIN, ZEND_LONG_MAX, 1);
} else if (ssa->vars[j].definition_phi &&
ssa->vars[j].definition_phi->pi < 0) {
FOR_EACH_VAR_USAGE(j, ADD_SCC_VAR);
}
}
/* widening (second round) */
WHILE_WORKLIST(worklist, worklist_len, j) {
if (zend_ssa_range_widening(op_array, ssa, j, scc)) {
FOR_EACH_VAR_USAGE(j, ADD_SCC_VAR);
}
} WHILE_WORKLIST_END();
/* Add all SCC entry variables into worklist for narrowing */
for (j = scc_var[scc]; j >= 0; j = next_scc_var[j]) {
if (ssa->vars[j].definition_phi
&& ssa->vars[j].definition_phi->pi < 0) {
/* narrowing Phi functions first */
zend_ssa_range_narrowing(op_array, ssa, j, scc);
}
@@ -4355,7 +4368,7 @@ void zend_inference_check_recursive_dependencies(zend_op_array *op_array)
memset(worklist, 0, sizeof(zend_ulong) * worklist_len);
call_info = info->callee_info;
while (call_info) {
if (call_info->recursive &&
if (call_info->recursive && call_info->caller_call_opline &&
info->ssa.ops[call_info->caller_call_opline - op_array->opcodes].result_def >= 0) {
zend_bitset_incl(worklist, info->ssa.ops[call_info->caller_call_opline - op_array->opcodes].result_def);
}
+71
View File
@@ -4242,6 +4242,75 @@ static void preload_load(void)
}
}
static int preload_autoload(zend_string *filename)
{
zend_persistent_script *persistent_script;
zend_op_array *op_array;
zend_execute_data *old_execute_data;
zend_class_entry *old_fake_scope;
zend_bool do_bailout = 0;
int ret = SUCCESS;
if (zend_hash_exists(&EG(included_files), filename)) {
return FAILURE;
}
persistent_script = zend_accel_hash_find(&ZCSG(hash), filename);
if (!persistent_script) {
return FAILURE;
}
zend_hash_add_empty_element(&EG(included_files), filename);
if (persistent_script->ping_auto_globals_mask) {
zend_accel_set_auto_globals(persistent_script->ping_auto_globals_mask);
}
op_array = zend_accel_load_script(persistent_script, 1);
if (!op_array) {
return FAILURE;
}
/* Execute in global context */
old_execute_data = EG(current_execute_data);
EG(current_execute_data) = NULL;
old_fake_scope = EG(fake_scope);
EG(fake_scope) = NULL;
zend_exception_save();
zend_try {
zend_execute(op_array, NULL);
} zend_catch {
do_bailout = 1;
} zend_end_try();
if (EG(exception)) {
ret = FAILURE;
}
zend_exception_restore();
EG(fake_scope) = old_fake_scope;
EG(current_execute_data) = old_execute_data;
while (old_execute_data) {
if (old_execute_data->func && (ZEND_CALL_INFO(old_execute_data) & ZEND_CALL_HAS_SYMBOL_TABLE)) {
if (old_execute_data->symbol_table == &EG(symbol_table)) {
zend_attach_symbol_table(old_execute_data);
}
break;
}
old_execute_data = old_execute_data->prev_execute_data;
}
destroy_op_array(op_array);
efree_size(op_array, sizeof(zend_op_array));
if (do_bailout) {
zend_bailout();
}
return ret;
}
static int accel_preload(const char *config)
{
zend_file_handle file_handle;
@@ -4534,6 +4603,8 @@ static int accel_preload(const char *config)
HANDLE_UNBLOCK_INTERRUPTIONS();
zend_shared_alloc_destroy_xlat_table();
zend_preload_autoload = preload_autoload;
} else {
CG(map_ptr_last) = orig_map_ptr_last;
}
+1 -1
View File
@@ -3,7 +3,7 @@ Bug #71443 (Segfault using built-in webserver with intl using symfony)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_cache={TMP}
opcache.file_cache="{TMP}"
opcache.file_cache_only=1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
+1 -1
View File
@@ -3,7 +3,7 @@ Bug #76275: Assertion failure in file cache when unserializing empty try_catch_a
--INI--
opcache.enabled=1
opcache.enable_cli=1
opcache.file_cache={TMP}
opcache.file_cache="{TMP}"
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
+1 -1
View File
@@ -8,7 +8,7 @@ if (substr(PHP_OS, 0, 3) !== 'WIN') die('skip this test is for Windows platforms
--INI--
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.file_cache={TMP}
opcache.file_cache="{TMP}"
opcache.file_cache_only=1
--FILE--
<?php
+2 -3
View File
@@ -20,6 +20,5 @@ var_dump(foo());
Warning: Can't preload unlinked class Foo: Unknown parent Bar in %spreload_bug78937.inc on line 6
Warning: Can't preload unlinked class class@anonymous: Unknown parent Bar in %spreload_bug78937.inc on line 3
Fatal error: Anonymous class wasn't preloaded in %spreload_bug78937.inc on line 3
object(class@anonymous)#%d (0) {
}
+2 -2
View File
@@ -21,5 +21,5 @@ var_dump(new Foo);
Warning: Can't preload unlinked class Foo: Unknown parent Bar in %spreload_bug78937.inc on line 6
Warning: Can't preload unlinked class class@anonymous: Unknown parent Bar in %spreload_bug78937.inc on line 3
Fatal error: Class foo wasn't preloaded in %spreload_bug78937.inc on line 6
object(Foo)#%d (0) {
}
+25
View File
@@ -0,0 +1,25 @@
--TEST--
Bug #79412 (Opcache chokes and uses 100% CPU on specific script)
--INI--
opcache.enable=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$limitPerRun = 10;
foreach ($foo as $bar) {
$count = 0;
foreach ($runs as $run) {
++$count;
if ($count >= $limitPerRun) {
break;
}
}
foo($limitPerRun);
}
?>
--EXPECTF--
Notice: Undefined variable: foo in %s on line %d
Warning: Invalid argument supplied for foreach() in %s on line %d
+19
View File
@@ -0,0 +1,19 @@
--TEST--
exit() may occur in a call argument
--FILE--
<?php
function test($c) {
if ($c) {
var_dump(var_dump(exit("exit\n")));
} else {
var_dump("test");
}
}
test(false);
test(true);
?>
--EXPECT--
string(4) "test"
exit
+2
View File
@@ -1,5 +1,7 @@
--TEST--
Bug #79241: Segmentation fault on preg_match()
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip json extension missing"; ?>
--FILE--
<?php
+1 -1
View File
@@ -3,7 +3,7 @@ Bug #69054 (Null dereference in readline_(read|write)_history() without paramete
--SKIPIF--
<?php if (!extension_loaded("readline") || !function_exists('readline_add_history')) die("skip"); ?>
--INI--
open_basedir={TMP}
open_basedir="{TMP}"
--FILE--
<?php readline_read_history(); ?>
==DONE==
+2 -2
View File
@@ -2232,7 +2232,7 @@ static PHP_FUNCTION(session_regenerate_id)
RETURN_FALSE;
}
if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == FAILURE) {
PS(mod)->s_validate_sid(&PS(mod_data), PS(id)) == SUCCESS) {
zend_string_release_ex(PS(id), 0);
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
@@ -2294,7 +2294,7 @@ static PHP_FUNCTION(session_create_id)
break;
} else {
/* Detect collision and retry */
if (PS(mod)->s_validate_sid(&PS(mod_data), new_id) == FAILURE) {
if (PS(mod)->s_validate_sid(&PS(mod_data), new_id) == SUCCESS) {
zend_string_release_ex(new_id, 0);
new_id = NULL;
continue;
+1 -1
View File
@@ -6,7 +6,7 @@ Bug #32330 (session_destroy, "Failed to initialize storage module", custom sessi
session.use_trans_sid=0
session.use_cookies=1
session.name=sid
session.save_path={TMP}
session.save_path="{TMP}"
session.gc_probability=1
session.gc_divisor=1
session.save_handler=files
+1 -1
View File
@@ -50,7 +50,7 @@ class MySessionHandler implements SessionHandlerInterface, SessionIdInterface, S
public function validateId($key)
{
return false;
return true;
}
}
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #79413 (session_create_id() fails for active sessions)
--SKIPIF--
<?php
if (!extension_loaded('session')) die('skip session extension not available');
?>
--FILE--
<?php
session_start();
$old = session_id();
$new = session_create_id();
var_dump($new !== $old);
?>
--EXPECT--
bool(true)
@@ -3,7 +3,7 @@ Test session_set_save_handler() function: create_sid
--INI--
session.save_handler=files
session.name=PHPSESSID
session.save_path={TMP}
session.save_path="{TMP}"
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
+5
View File
@@ -207,6 +207,11 @@ PHP_FUNCTION(shmop_open)
goto err;
}
if (shm.shm_segsz > ZEND_LONG_MAX) {
php_error_docref(NULL, E_WARNING, "shared memory segment too large to attach");
goto err;
}
shmop->addr = shmat(shmop->shmid, 0, shmop->shmatflg);
if (shmop->addr == (char*) -1) {
php_error_docref(NULL, E_WARNING, "unable to attach to shared memory segment '%s'", strerror(errno));
+1 -1
View File
@@ -981,7 +981,7 @@ static void _get_base_node_value(php_sxe_object *sxe_ref, xmlNodePtr node, zval
php_sxe_object *subnode;
xmlChar *contents;
if (node->children && node->children->type == XML_TEXT_NODE && !xmlIsBlankNode(node->children)) {
if ((!node->properties || node->type == XML_ENTITY_DECL) && node->children && node->children->type == XML_TEXT_NODE && !xmlIsBlankNode(node->children)) {
contents = xmlNodeListGetString(node->doc, node->children, 1);
if (contents) {
ZVAL_STRING(value, (char *)contents);
+31 -1
View File
@@ -51,7 +51,37 @@ object(SimpleXMLElement)#%d (3) {
["elem1"]=>
array(2) {
[0]=>
string(36) "There is some text.Here is some more"
object(SimpleXMLElement)#%d (3) {
["@attributes"]=>
array(2) {
["attr1"]=>
string(5) "first"
["attr2"]=>
string(6) "second"
}
["comment"]=>
object(SimpleXMLElement)#%d (0) {
}
["elem2"]=>
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
array(2) {
["att25"]=>
string(2) "25"
["att42"]=>
string(2) "42"
}
["elem3"]=>
object(SimpleXMLElement)#%d (1) {
["elem4"]=>
object(SimpleXMLElement)#%d (1) {
["test"]=>
object(SimpleXMLElement)#%d (0) {
}
}
}
}
}
[1]=>
object(SimpleXMLElement)#%d (1) {
["@attributes"]=>
+23 -2
View File
@@ -28,8 +28,29 @@ object(SimpleXMLElement)#%d (3) {
string(5) "elem1"
}
["elem1"]=>
string(10) "Bla bla 1."
object(SimpleXMLElement)#%d (3) {
["@attributes"]=>
array(1) {
["attr1"]=>
string(5) "first"
}
["comment"]=>
object(SimpleXMLElement)#%d (0) {
}
["elem2"]=>
string(35) "
Here we have some text data.
"
}
["elem11"]=>
string(10) "Bla bla 2."
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
array(1) {
["attr2"]=>
string(6) "second"
}
[0]=>
string(10) "Bla bla 2."
}
}
===DONE===
+23 -3
View File
@@ -22,7 +22,7 @@ foreach ($html->body->span as $obj) {
Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in %s on line %d
Warning: DOMDocument::loadHTML(): error parsing attribute name in Entity, line: 1 in %s on line %d
object(SimpleXMLElement)#%d (3) {
object(SimpleXMLElement)#5 (3) {
["@attributes"]=>
array(2) {
["title"]=>
@@ -31,9 +31,29 @@ object(SimpleXMLElement)#%d (3) {
string(0) ""
}
[0]=>
string(1) "x"
object(SimpleXMLElement)#4 (2) {
["@attributes"]=>
array(2) {
["title"]=>
string(0) ""
["y"]=>
string(0) ""
}
[0]=>
string(1) "x"
}
[1]=>
string(1) "x"
object(SimpleXMLElement)#6 (2) {
["@attributes"]=>
array(2) {
["title"]=>
string(0) ""
["z"]=>
string(0) ""
}
[0]=>
string(1) "x"
}
}
string(0) ""
string(0) ""
+30
View File
@@ -0,0 +1,30 @@
--TEST--
Bug #61597 (SXE properties may lack attributes and content)
--SKIPIF--
<?php
if (!extension_loaded('simplexml')) die('skip simplexml extension not available');
?>
--FILE--
<?php
$xml = <<<'EOX'
<?xml version="1.0"?>
<data>
<datum file-key="8708124062829849862">corn</datum>
</data>
EOX;
var_dump(simplexml_load_string($xml));
?>
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
["datum"]=>
object(SimpleXMLElement)#%d (2) {
["@attributes"]=>
array(1) {
["file-key"]=>
string(19) "8708124062829849862"
}
[0]=>
string(4) "corn"
}
}
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #79357: SOAP request segfaults when any request parameter is missing
--FILE--
<?php
$sc = new SoapClient(__DIR__ . '/bug79357.wsdl');
$res = $sc->Add(['intA'=>1]);
var_dump($res);
?>
--EXPECTF--
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'intB' property in %s:%d
Stack trace:
#0 %s(%d): SoapClient->__call('Add', Array)
#1 {main}
thrown in %s on line %d
+52
View File
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="Add">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="intA" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="intB" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="AddResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="AddResult" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="AddSoapIn">
<wsdl:part name="parameters" element="tns:Add" />
</wsdl:message>
<wsdl:message name="AddSoapOut">
<wsdl:part name="parameters" element="tns:AddResponse" />
</wsdl:message>
<wsdl:portType name="CalculatorSoap">
<wsdl:operation name="Add">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Adds two integers. This is a test WebService. ©DNE Online</wsdl:documentation>
<wsdl:input message="tns:AddSoapIn" />
<wsdl:output message="tns:AddSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CalculatorSoap" type="tns:CalculatorSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Add">
<soap:operation soapAction="http://tempuri.org/Add" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Calculator">
<wsdl:port name="CalculatorSoap" binding="tns:CalculatorSoap">
<soap:address location="http://www.dneonline.com/calculator.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
@@ -30,34 +30,34 @@ function test($stream, $sock) {
echo "normal\n";
$sock0 = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($sock0, '0.0.0.0', 58380);
socket_bind($sock0, '0.0.0.0');
$stream0 = socket_export_stream($sock0);
test($stream0, $sock0);
echo "\nunset stream\n";
$sock1 = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($sock1, '0.0.0.0', 58381);
socket_bind($sock1, '0.0.0.0');
$stream1 = socket_export_stream($sock1);
unset($stream1);
test(null, $sock1);
echo "\nunset socket\n";
$sock2 = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($sock2, '0.0.0.0', 58382);
socket_bind($sock2, '0.0.0.0');
$stream2 = socket_export_stream($sock2);
unset($sock2);
test($stream2, null);
echo "\nclose stream\n";
$sock3 = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($sock3, '0.0.0.0', 58383);
socket_bind($sock3, '0.0.0.0');
$stream3 = socket_export_stream($sock3);
fclose($stream3);
test($stream3, $sock3);
echo "\nclose socket\n";
$sock4 = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($sock4, '0.0.0.0', 58484);
socket_bind($sock4, '0.0.0.0');
$stream4 = socket_export_stream($sock4);
socket_close($sock4);
test($stream4, $sock4);
+6
View File
@@ -1185,6 +1185,12 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
return;
}
while (intern->llist->count > 0) {
zval tmp;
spl_ptr_llist_pop(intern->llist, &tmp);
zval_ptr_dtor(&tmp);
}
s = p = (const unsigned char*)buf;
PHP_VAR_UNSERIALIZE_INIT(var_hash);
+4 -13
View File
@@ -337,25 +337,16 @@ static inline zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_o
}
/* }}} */
static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int check_empty);
static zval *spl_fixedarray_object_read_dimension(zval *object, zval *offset, int type, zval *rv) /* {{{ */
{
spl_fixedarray_object *intern;
intern = Z_SPLFIXEDARRAY_P(object);
if (type == BP_VAR_IS && intern->fptr_offset_has) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(object, intern->std.ce, &intern->fptr_offset_has, "offsetexists", rv, offset);
if (UNEXPECTED(Z_ISUNDEF_P(rv))) {
zval_ptr_dtor(offset);
return NULL;
}
if (!i_zend_is_true(rv)) {
zval_ptr_dtor(offset);
zval_ptr_dtor(rv);
return &EG(uninitialized_zval);
}
zval_ptr_dtor(rv);
if (type == BP_VAR_IS && !spl_fixedarray_object_has_dimension(object, offset, 0)) {
return &EG(uninitialized_zval);
}
if (intern->fptr_offset_get) {
+11
View File
@@ -1,5 +1,16 @@
--TEST--
Bug #68825 (Exception in DirectoryIterator::getLinkTarget())
--SKIPIF--
<?php
if (PHP_OS_FAMILY === 'Windows') {
$fn = "bug68825.lnk";
$ret = exec("mklink $fn " . __FILE__ .' 2>&1', $out);
@unlink($fn);
if (strpos($ret, 'privilege')) {
die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
}
}
?>
--FILE--
<?php
$dir = __DIR__ . '/bug68825';
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #75673 (SplStack::unserialize() behavior)
--FILE--
<?php
$stack = new SplStack();
$stack->push("one");
$stack->push("two");
$serialized = $stack->serialize();
var_dump($stack->count());
$stack->unserialize($serialized);
var_dump($stack->count());
$stack->unserialize($serialized);
var_dump($stack->count());
?>
--EXPECT--
int(2)
int(2)
int(2)
+25
View File
@@ -0,0 +1,25 @@
--TEST--
Bug #79393 (Null coalescing operator failing with SplFixedArray)
--FILE--
<?php
$foo = new SplFixedArray(5);
$foo[0] = 'bar1';
$foo[1] = 'bar2';
$foo[2] = 0;
$foo[3] = false;
$foo[4] = '';
var_dump($foo[0] ?? null);
var_dump($foo[1] ?? null);
var_dump($foo[2] ?? null);
var_dump($foo[3] ?? null);
var_dump($foo[4] ?? null);
var_dump($foo[5] ?? null);
?>
--EXPECT--
string(4) "bar1"
string(4) "bar2"
int(0)
bool(false)
string(0) ""
NULL
@@ -4,7 +4,7 @@ SQLite3::loadExtension with empty extension test
Jelle Lampaert
#Belgian Testfest 2009
--INI--
sqlite3.extension_dir={TMP}
sqlite3.extension_dir="{TMP}"
--SKIPIF--
<?php
require_once(__DIR__ . '/skipif.inc');
+2 -2
View File
@@ -20,7 +20,7 @@
#include "basic_functions.h"
#include "crc32.h"
#if defined(__aarch64__)
#if defined(__aarch64__) && defined(HAVE_SYS_AUXV_H)
# include <arm_acle.h>
# if defined(__linux__)
# include <sys/auxv.h>
@@ -85,7 +85,7 @@ PHP_NAMED_FUNCTION(php_if_crc32)
crc = crcinit^0xFFFFFFFF;
#if defined(__aarch64__)
#if defined(__aarch64__) && defined(HAVE_SYS_AUXV_H)
if (has_crc32_insn()) {
crc = crc32_aarch64(crc, p, nr);
RETURN_LONG(crc^0xFFFFFFFF);
+16
View File
@@ -159,6 +159,13 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value)
b = buf;
}
if (bufl) {
/* output remaining data in buffer */
if (type == 1 && buf != b) {
PHPWRITE(buf, bufl);
if (php_output_get_level() < 1) {
sapi_flush();
}
}
/* strip trailing whitespaces if we have not done so already */
if ((type == 2 && buf != b) || type != 2) {
l = bufl;
@@ -530,6 +537,15 @@ PHP_FUNCTION(shell_exec)
Z_PARAM_STRING(command, command_len)
ZEND_PARSE_PARAMETERS_END();
if (!command_len) {
php_error_docref(NULL, E_WARNING, "Cannot execute a blank command");
RETURN_FALSE;
}
if (strlen(command) != command_len) {
php_error_docref(NULL, E_WARNING, "NULL byte detected. Possible attack");
RETURN_FALSE;
}
#ifdef PHP_WIN32
if ((in=VCWD_POPEN(command, "rt"))==NULL) {
#else
+1 -1
View File
@@ -354,7 +354,7 @@ PHP_FUNCTION(stream_socket_sendto)
}
}
RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, (int)flags, target_addr ? &sa : NULL, sl));
RETURN_LONG(php_stream_xport_sendto(stream, data, datalen, (int)flags, target_addr_len ? &sa : NULL, sl));
}
/* }}} */
@@ -9,7 +9,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') {
--CREDITS--
Dave Kelsey <d_kelsey@uk.ibm.com>
--INI--
open_basedir={TMP}
open_basedir="{TMP}"
--FILE--
<?php
$a=glob("./*.jpeg");
+1 -1
View File
@@ -9,7 +9,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
--CREDITS--
Dave Kelsey <d_kelsey@uk.ibm.com>
--INI--
open_basedir={TMP}
open_basedir="{TMP}"
--FILE--
<?php
$a=glob("./*.jpeg");
+6 -6
View File
@@ -7,7 +7,7 @@ if (!function_exists('zend_leak_variable'))
/* unfortunately no standard function does a cast to FILE*, so we need
* curl to test this */
if (!extension_loaded("curl")) exit("skip curl extension not loaded");
$handle=curl_init('http://127.0.0.1:37349/');
$handle=curl_init('file:///i_dont_exist/');
curl_setopt($handle, CURLOPT_VERBOSE, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
@@ -15,7 +15,7 @@ if (!curl_setopt($handle, CURLOPT_STDERR, fopen("php://memory", "w+")))
--FILE--
<?php
function do_stuff($url) {
$handle=curl_init('http://127.0.0.1:37349/');
$handle=curl_init('file:///i_dont_exist/');
curl_setopt($handle, CURLOPT_VERBOSE, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_STDERR, $o = fopen($url, "w+"));
@@ -42,22 +42,22 @@ echo "\nDone.\n";
--EXPECTF--
temp stream (close after):
About to rewind!
* %ATrying 127.0.0.1...%AConnection refused%A
* Couldn't open file /i_dont_exist/
* Closing connection%A%d
memory stream (close after):
About to rewind!
* %ATrying 127.0.0.1...%AConnection refused%A
* Couldn't open file /i_dont_exist/
* Closing connection%A%d
temp stream (leak):
About to rewind!
* %ATrying 127.0.0.1...%AConnection refused%A
* Couldn't open file /i_dont_exist/
* Closing connection%A%d
memory stream (leak):
About to rewind!
* %ATrying 127.0.0.1...%AConnection refused%A
* Couldn't open file /i_dont_exist/
* Closing connection%A%d
Done.
@@ -39,8 +39,8 @@ $new_stat = stat($dirname);
// compare self stats
var_dump( compare_self_stat($old_stat) );
var_dump( compare_self_stat($new_stat) );
// compare the stats
$affected_members = array(3, 9, 10, 'nlink', 'mtime', 'ctime');
// compare the stat
$affected_members = array(9, 10, 'mtime', 'ctime');
clearstatcache();
var_dump(compare_stats($old_stat, $new_stat, $affected_members, "<"));
@@ -1,67 +0,0 @@
--TEST--
Test lstat() and stat() functions: usage variations - deleting file/subdir
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. Not valid for Windows');
}
?>
--FILE--
<?php
/* Prototype: array lstat ( string $filename );
Description: Gives information about a file or symbolic link
Prototype: array stat ( string $filename );
Description: Gives information about a file
*/
$file_path = __DIR__;
require "$file_path/file.inc";
/* test the effects on stats by deleting file/subdir from a dir
*/
echo "*** Testing stat() for comparing stats after the deletion of subdir and file ***\n";
/* first create the dir/subdir and files, record the stat */
@rmdir("$file_path/lstat_stat_variation9/"); // ensure that dir doesn't exists
mkdir("$file_path/lstat_stat_variation9/"); // temp dir
// creating and deleting subdir and files in the dir
$dirname = "$file_path/lstat_stat_variation9";
@rmdir("$dirname/lstat_stat_variation9_subdir"); // ensure that dir doesn't exists
mkdir("$dirname/lstat_stat_variation9_subdir");
$file_handle = fopen("$dirname/lstat_stat_variation9a.tmp", "w");
fclose($file_handle);
$old_stat = stat($dirname);
/* now delete the surdir and file and record the stat */
unlink("$dirname/lstat_stat_variation9a.tmp");
rmdir("$dirname/lstat_stat_variation9_subdir");
// comparing stats after the deletion of subdir and file
$new_stat = stat($dirname);
// compare self stats
var_dump( compare_self_stat($old_stat) );
var_dump( compare_self_stat($new_stat) );
// compare the stats
$affected_members = array(3, 'nlink');
var_dump(compare_stats($old_stat, $new_stat, $affected_members, ">"));
echo "\n--- Done ---";
?>
--CLEAN--
<?php
$file_path = __DIR__;
$dirname = "$file_path/lstat_stat_variation9";
rmdir($dirname);
?>
--EXPECT--
*** Testing stat() for comparing stats after the deletion of subdir and file ***
bool(true)
bool(true)
bool(true)
--- Done ---
@@ -16,7 +16,7 @@ skip_if_no_required_exts();
include __DIR__ . DIRECTORY_SEPARATOR . "util.inc";
$prefix = __DIR__ . DIRECTORY_SEPARATOR . "testBug54028" . DIRECTORY_SEPARATOR;
$prefix = __DIR__ . DIRECTORY_SEPARATOR . "testBug54028_2" . DIRECTORY_SEPARATOR;
$dirs = array("a", "ソ", "ゾ", "şŞıİğĞ", "多国語", "王", "汚れて掘る");
@@ -9,6 +9,8 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts("zip");
?>
--CONFLICTS--
bug71509
--FILE--
<?PHP
// åöä
@@ -10,6 +10,8 @@ skip_if_no_required_exts();
skip_if_wrong_cp(950, "ansi");
?>
--CONFLICTS--
file_big5
--INI--
defalut_charset=big5
--FILE--
@@ -10,6 +10,8 @@ skip_if_no_required_exts();
skip_if_wrong_cp(950, "ansi");
?>
--CONFLICTS--
dir_big5
--INI--
internal_encoding=big5
--FILE--
@@ -10,6 +10,8 @@ skip_if_no_required_exts();
skip_if_wrong_cp(950, "ansi");
?>
--CONFLICTS--
file_big5
--INI--
defalut_charset=cp950
--FILE--
@@ -9,6 +9,8 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts();
?>
--CONFLICTS--
file_big5
--FILE--
<?php
/*
@@ -9,6 +9,8 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts();
?>
--CONFLICTS--
dir_big5
--FILE--
<?php
/*
@@ -9,6 +9,8 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts();
?>
--CONFLICTS--
file_big5
--FILE--
<?php
/*
@@ -9,6 +9,8 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
skip_if_no_required_exts();
?>
--CONFLICTS--
file_cp1250
--FILE--
<?php
/*
Loaded 100 of 186 files, more files were not shown because too many files have changed in this diff. Show more