Compare commits

..
Author SHA1 Message Date
Sara Golemon 09aa799e64 Update versions for PHP 7.2.9RC1 2018-07-31 12:32:45 +00:00
Sara Golemon ee87db285f Update NEWS for PHP 7.2.9RC1 2018-07-31 12:32:44 +00:00
Anatol Belski 095a30e11b Update NEWS [ci skip] 2018-07-30 19:43:23 +02:00
Anatol Belski e111ef5626 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update NEWS [ci skip]
2018-07-30 19:42:45 +02:00
Anatol Belski 2870178720 Update NEWS [ci skip] 2018-07-30 19:42:10 +02:00
Anatol Belski d207d6a57f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75402 Possible Memory Leak using PDO::CURSOR_SCROLL option
2018-07-30 18:28:53 +02:00
Anatol Belski cc69950b15 Fixed bug #75402 Possible Memory Leak using PDO::CURSOR_SCROLL option 2018-07-30 18:27:59 +02:00
Christoph M. Becker ce66492a13 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle
2018-07-26 13:26:58 +02:00
Christoph M. Becker ed7e3bc70a Fix #76665: SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle
We need to ensure that a zval IS_DOUBLE before we access it as such.
In this case we apply common type juggling to do so.
2018-07-26 13:15:19 +02:00
Christoph M. Becker a96ca13963 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #76643: Segmentation fault when using `output_add_rewrite_var`
2018-07-24 12:28:22 +02:00
Christoph M. Becker 40bd84d3e3 Fix #76643: Segmentation fault when using output_add_rewrite_var
We have to check whether _SERVER is actually an array before we're
going to use it as such.
2018-07-24 12:20:13 +02:00
Xinchen Hui 033dac7a6f Update NEWs 2018-07-24 11:35:43 +08:00
Xinchen Hui 2a181b5ea0 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #68553 (array_column: null values in $index_key become incrementing keys in result)
2018-07-24 11:35:22 +08:00
Xinchen Hui 38d97557da Fixed bug #68553 (array_column: null values in $index_key become incrementing keys in result) 2018-07-24 11:34:57 +08:00
Xinchen Hui c20a97df6d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed pefree_size (efree_size will be expaned to do {} while () form)
2018-07-23 15:48:52 +08:00
Xinchen Hui 2139c2c2de Fixed pefree_size (efree_size will be expaned to do {} while () form) 2018-07-23 15:48:14 +08:00
Christoph M. Becker 33eb30274f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #52974: jewish.c: compile error under Windows with GBK charset
2018-07-22 17:59:38 +02:00
Christoph M. Becker 99fdf5916e Fix #52974: jewish.c: compile error under Windows with GBK charset
jewish.c includes ISO-8859-8 encoded Hebrew Hebrew month names, which
may cause compile errors, and is generally confusing.  We replace the
literal month names with appropriate escape sequences.
2018-07-22 17:42:10 +02:00
Anatol Belski 2073e96ec5 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update binary SDK version for AppVeyor
2018-07-19 18:37:38 +02:00
Anatol Belski 9e54d9d692 Update binary SDK version for AppVeyor 2018-07-19 18:35:54 +02:00
Ferenc Kovacs ca618a4f10 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-19 16:57:50 +02:00
Ferenc Kovacs 0510b47894 Merge branch 'PHP-7.0' into PHP-7.1 2018-07-19 16:57:18 +02:00
Ferenc Kovacs e5b27b9916 Merge branch 'PHP-5.6' into PHP-7.0 2018-07-19 16:56:32 +02:00
Ferenc Kovacs 1ba3314335 5.6.38 will be next 2018-07-19 16:54:58 +02:00
Anatol Belski b494d94f16 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  7.0.32 next
2018-07-17 12:37:51 +02:00
Anatol Belski dfc2e3a2ac Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  7.0.32 next
2018-07-17 12:37:02 +02:00
Anatol Belski d011da9d1a 7.0.32 next 2018-07-17 12:36:13 +02:00
Anatol Belski c4106d4569 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Update NEWS
2018-07-17 11:59:17 +02:00
Anatol Belski 1127163996 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  [ci skip] Update NEWS
2018-07-17 11:58:43 +02:00
Anatol Belski b52c4fcbcd [ci skip] Update NEWS 2018-07-17 11:58:00 +02:00
Remi Collet e069b0beba NEWS 2018-07-17 06:07:28 +02:00
Stanislav Malyshev ebd5f56442 Fix test 2018-07-16 18:52:01 -07:00
Stanislav Malyshev a536d6d61b Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76459 windows linkinfo lacks openbasedir check
  Add NEWS
  Fixed bug #76459 windows linkinfo lacks openbasedir check
  Fix bug #76557: heap-buffer-overflow (READ of size 48) while reading exif data
  Fix bug #76423 - Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c
2018-07-16 16:53:57 -07:00
Stanislav Malyshev 4e92cd172a Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #76459 windows linkinfo lacks openbasedir check
  Add NEWS
  Fixed bug #76459 windows linkinfo lacks openbasedir check
  Fix bug #76557: heap-buffer-overflow (READ of size 48) while reading exif data
  Fix bug #76423 - Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c
2018-07-16 16:52:36 -07:00
Stanislav Malyshev bddf8140e4 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Add NEWS
  Fixed bug #76459 windows linkinfo lacks openbasedir check
  Fix bug #76557: heap-buffer-overflow (READ of size 48) while reading exif data
  Fix bug #76423 - Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c
2018-07-16 15:13:13 -07:00
Anatol Belski f151e048ed Fixed bug #76459 windows linkinfo lacks openbasedir check 2018-07-16 15:11:56 -07:00
Stanislav Malyshev b73a108543 Add NEWS 2018-07-16 14:26:31 -07:00
Anatol Belski 289cb0f77c Fixed bug #76459 windows linkinfo lacks openbasedir check 2018-07-16 14:21:02 -07:00
Stanislav Malyshev 3462efa386 Fix bug #76557: heap-buffer-overflow (READ of size 48) while reading exif data
Use MAKERNOTE length as data size.
2018-07-16 14:17:51 -07:00
Stanislav Malyshev 1baeae4270 Fix bug #76423 - Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c 2018-07-16 14:16:58 -07:00
Christoph M. Becker 8efd3c3387 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #73817: Incorrect entries in get_html_translation_table
2018-07-15 23:19:37 +02:00
Christoph M. Becker 0f8c1ee76d Fix #73817: Incorrect entries in get_html_translation_table
Due to incorrect string termination and length handling, several HTML
entities missed the trailing semicolon.

We also fix the obviously wrong expectations in two already existing
tests.
2018-07-15 23:06:38 +02:00
Anatol Belski dee191ee07 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Improve test
2018-07-13 20:14:44 +02:00
Anatol Belski 141072a838 Improve test
Ensure the filename is non existent indeed.
2018-07-13 20:13:51 +02:00
Anatol Belski f28aeaee05 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed RecursiveDirectoryIterator with long path or with edge case length
2018-07-12 19:57:08 +02:00
Anatol Belski 99fe18503a Fixed RecursiveDirectoryIterator with long path or with edge case length
The search path needs to be appended with the wild card. Till now, an
edge case existed, so then if a path is 259 bytes long, which is smaller
_MAX_PATH, the suffix would cause the final search path to become longer
than _MAX_PATH. It is an edge case, when the starting path happens to
have a specific length. If the starting path was longer than _MAX_PATH
or the addition of "\\*" would not exceed _MAX_PATH, the function was
correct. Except for rewind, which was broken in the case of the long
path.
2018-07-12 19:49:32 +02:00
Christoph M. Becker 77ced46dea Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix Travis build
2018-07-12 13:46:10 +02:00
Christoph M. Becker 236ae06e0b Fix Travis build
As of commit f9d1d1f[1] we require `sudo`, so we tell Travis about it.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=f9d1d1f>
2018-07-12 13:45:30 +02:00
Anatol Belski 9443c61928 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix macro
2018-07-12 11:37:13 +02:00
Anatol Belski cc7b000d2c Fix macro 2018-07-12 11:35:00 +02:00
Anatol Belski cc266045a5 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix condition
2018-07-11 13:13:56 +02:00
Anatol Belski 98102648cb Fix condition
It looks like the real length limit is 247 bytes, not 248 as documented.
2018-07-11 13:09:20 +02:00
Anatol Belski a766f65ca3 [ci skip] Update NEWS 2018-07-10 11:51:49 +02:00
Anatol Belski c23736216d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Update NEWS
2018-07-10 11:51:11 +02:00
Anatol Belski 9026562c79 [ci skip] Update NEWS 2018-07-10 11:50:33 +02:00
Anatol Belski ebb590b625 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #76524 - ZipArchive memory leak
2018-07-10 11:19:54 +02:00
timurib 08f08858f3 Fix bug #76524 - ZipArchive memory leak
Bugfix #76524: Free up zip internal state and adjust the tests for Windows

Bugfix #76524: Fix possible use after free for libzip 1.3.1

Bugfix #76524: Make the test independent of platform
2018-07-10 11:18:37 +02:00
Anatol Belski 474292c3e4 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Sync callback signature with libxml2 2.9.8
2018-07-09 21:24:51 +02:00
Anatol Belski a820aab9da Sync callback signature with libxml2 2.9.8 2018-07-09 21:21:41 +02:00
Anatol Belski a6e8c73c43 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Add missing flag
2018-07-09 15:14:30 +02:00
Anatol Belski 2c43fb49d6 Add missing flag 2018-07-09 15:12:52 +02:00
Anatol Belski 545a29d0cb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix C++11 and up compatibility for zend_finite and more
2018-07-08 20:32:52 +02:00
Anatol Belski ad790bea2e Fix C++11 and up compatibility for zend_finite and more
C++11 puts isfinite, isinf, isnan and a lot of other stuff into the
std namespace. Thus, if a C++11 or newer source is compiled, these
symbols won't be available. A good solution would be to include cmath,
but depending on a particular compiler that might remove even more
stuff from the global namespace, so such a fix should only target master.
For now, just keep these defines same for C++11 and upper, as the actual
C++ code should use symbols from the std namespace anyway. This
especially concerns older GCC versions like at least 4 and 5, which are
used by default in the LTS Linux distros.
2018-07-08 20:20:08 +02:00
Dylan K. Taylor 77a841db48 Fixed regex for checking libzip static lib
This bug caused linking issues in debug mode (see bug [#76564](https://bugs.php.net/bug.php?id=76564))

This issue affects PHP 7.2 and master.
2018-07-07 17:32:16 +02:00
Nikita Popov 5d0d812a53 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-07 12:08:02 +02:00
cdoco 47fb17b108 Fixed bug #76366 (references in sub-array for filtering breaks the filter) 2018-07-07 12:07:43 +02:00
Anatol Belski d207fd449c [ci skip] Update NEWS 2018-07-06 17:45:01 +02:00
Anatol Belski 1ae888d984 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Update NEWS
2018-07-06 17:44:37 +02:00
Anatol Belski ea24847620 [ci skip] Update NEWS 2018-07-06 17:43:48 +02:00
Anatol Belski d85651d58d Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix event log handling in startup phase
  Fix bug #76488 Memory leak when fetching a BLOB field
  Fix year
  Bump version
2018-07-06 16:08:17 +02:00
Anatol Belski 246cb03e26 Fix event log handling in startup phase
The log header can be saved in the globals on startup. At the same
time, the log header can be changed per request. In case that
happened, wrong pointer will be free'd on shutdown. It can happen at
any point when zend_error() or similar is called at startup, like for
example in the case of the ini deprecation warnings. Thus, ZMM cannot
be used here.
2018-07-06 16:07:28 +02:00
sim1984 3847a6fcb6 Fix bug #76488 Memory leak when fetching a BLOB field
Add a phpt test
2018-07-06 16:07:28 +02:00
Sara Golemon 137f22ad36 Fix year 2018-07-06 10:02:20 -04:00
Sara Golemon 268e801cb1 Bump version 2018-07-06 10:02:00 -04:00
Nikita Popov f3dc67b255 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-05 19:11:25 +02:00
Nikita Popov 791f07e4f0 Fix string.strip_tags filter
Was segfaulting if no allowed tags are specified and performing an
out of bounds read if they were.
2018-07-05 19:08:00 +02:00
Anatol Belski e5ef7cbe87 Fixed bug #76564 ext/zip link issues
Add zlib for linking directly, so then ext/zlib is not required.
2018-07-03 15:45:01 +02:00
Remi Collet 8bf21adb8c bump to 7.2.9-dev 2018-07-03 13:52:04 +02:00
Nikita Popov 9bbb9e537c Merge branch 'PHP-7.1' into PHP-7.2 2018-07-02 18:57:25 +02:00
Nikita Popov c97b8bbf82 Fixed bug #75231
The behavior is now consistent with ReflectionMethod.
2018-07-02 18:56:27 +02:00
Nikita Popov 3a236d0587 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-02 17:59:15 +02:00
Nikita Popov 787593b708 Fix test after serialization change
And move it to a more appropriate location.
2018-07-02 17:58:26 +02:00
Nikita Popov 09bb2527e9 Merge branch 'PHP-7.1' into PHP-7.2 2018-07-02 17:29:32 +02:00
Nikita Popov c793885b76 Fixed bug #74670
Validate that "C" serialization payload is followed by "}" prior to
calling the unserialize() handler. This mitigates issues caused by
unserialize() not correctly handling strings that are not NUL
terminated. Making sure that there is a "}" at the end avoids the
problem.
2018-07-02 17:27:43 +02:00
Anatol Belski 26a33a96fa Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update libs_version.txt
2018-07-02 12:12:02 +02:00
Anatol Belski f8258325b4 Update libs_version.txt 2018-07-02 12:09:54 +02:00
Christoph M. Becker 39d668e927 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Make newly introduced bug76556.phpt more resilient
2018-07-01 00:21:34 +02:00
Christoph M. Becker a72bab1b9a Make newly introduced bug76556.phpt more resilient
Obviously, different compilers mangle the C++ class name differently.
We should neither expect a prefix nor a suffix.
2018-07-01 00:20:32 +02:00
Christoph M. Becker ae163d9a36 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #76556: get_debug_info handler for BreakIterator shows wrong type
2018-06-30 23:17:54 +02:00
Christoph M. Becker 1118fca75d Fix #76556: get_debug_info handler for BreakIterator shows wrong type
We use the retrieved type for the "type" element instead of the text.
This has been confused during the PHP 7 upgrade[1].

[1] http://git.php.net/?p=php-src.git;a=commit;h=1d793348067e5769144c0f7efd86428a4137baec
2018-06-30 23:15:02 +02:00
Nikita Popov 0f1726e45d Merge branch 'PHP-7.1' into PHP-7.2 2018-06-30 20:11:39 +02:00
Nikita Popov 9b0df97a42 Fix handling of void return type on internal functions 2018-06-30 20:10:57 +02:00
Nikita Popov 34deda13a8 Merge branch 'PHP-7.1' into PHP-7.2 2018-06-30 19:50:40 +02:00
Nikita Popov 2eb6a541a9 Fix typo in compound dim assign op inference
Thankfully a harmless one, just makes inference results worse.
2018-06-30 19:50:07 +02:00
Christoph M. Becker e2285eb542 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #71848: getimagesize with $imageinfo returns false
2018-06-30 16:40:32 +02:00
Christoph M. Becker ae04110032 Fix #71848: getimagesize with $imageinfo returns false
Some JFIF images contain empty APP segments, i.e. those which consist
only of the marker bytes and the length, but without actual content.
It appears to be doubtful to have empty APP segments, but we should
apply the robustness principle, and accept these, instead of simply
failing in this case.

We choose to add empty APP segments to $imageinfo with an empty string
as value, instead of NULL, or even to omit these segments altogether.

This patch also fixes the potential issue that php_stream_read() might
not read the supposed number of bytes, which could result in garbage to
be added to the read value.
2018-06-30 16:29:30 +02:00
Nikita Popov deb1bad80f Merge branch 'PHP-7.1' into PHP-7.2 2018-06-29 23:23:02 +02:00
Nikita Popov 962706d16c Fix nullable type pretty-printing 2018-06-29 23:22:41 +02:00
Anatol Belski 15ad5d31d1 [ci skip] Update NEWS 2018-06-29 20:11:55 +02:00
Anatol Belski ef274e0b60 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Update NEWS
2018-06-29 20:11:23 +02:00
Anatol Belski fb09f1341f [ci skip] Update NEWS 2018-06-29 20:10:54 +02:00
Anatol Belski 486f18f09e Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76548 pg_fetch_result did not fetch the next row
2018-06-29 18:35:44 +02:00
Anatol Belski cb97fd3097 Fixed bug #76548 pg_fetch_result did not fetch the next row 2018-06-29 18:34:53 +02:00
Nikita Popov 00c0d7702c Merge branch 'PHP-7.1' into PHP-7.2 2018-06-28 23:05:09 +02:00
Marcus Schwarz bf5a802f5a Fixed bug #76532 (excessive memory usage in mb_strimwidth) 2018-06-28 23:02:28 +02:00
Anatol Belski c5276ad380 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Update SDK version for AppVeyor
2018-06-28 15:58:20 +02:00
Anatol Belski f6430e3fe2 Update SDK version for AppVeyor 2018-06-28 15:56:27 +02:00
Anatol Belski e835916f65 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Sync versions for VC++ 15.8
2018-06-28 13:28:46 +02:00
Anatol Belski 88b5df91f6 Sync versions for VC++ 15.8 2018-06-28 13:23:19 +02:00
Anatol Belski b35f45ded2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Don't ignore commits on NEWS, etc. on AppVeyor
2018-06-28 10:54:59 +02:00
Anatol Belski 19b4fa17d3 Don't ignore commits on NEWS, etc. on AppVeyor
[ci skip] can be used explicitly, and otherwise it might ignore commits
with a code change.
2018-06-28 10:53:23 +02:00
Xinchen Hui 809a7b5f8f Update NEWS 2018-06-28 12:38:14 +08:00
Xinchen Hui 5d7f9dcca7 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76536 (PHP crashes with core dump when throwing exception in error handler). (Laruence)
2018-06-28 12:37:58 +08:00
Xinchen Hui 1f6b842af4 Fixed bug #76536 (PHP crashes with core dump when throwing exception in error handler). (Laruence) 2018-06-28 12:37:33 +08:00
Xinchen Hui 7b98d056d3 Update NEWS 2018-06-27 13:07:53 +08:00
Xinchen Hui 3521661bd1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76534 (PHP hangs on 'illegal string offset on string references with an error handler)

Conflicts:
	Zend/zend_execute.c
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2018-06-27 13:07:36 +08:00
Xinchen Hui d1b1866a3a Fixed bug #76534 (PHP hangs on 'illegal string offset on string references with an error handler) 2018-06-27 13:05:11 +08:00
Christoph M. Becker 2458dab466 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix arginfo wrt. optional/required parameters
2018-06-25 11:54:45 +02:00
Christoph M. Becker 6b5597f7d8 Fix arginfo wrt. optional/required parameters
All parameters of phpdbg_color(), phpdbg_exec() and phpdbg_prompt() are
required.  We mark them as such.
2018-06-25 11:52:17 +02:00
Anatol Belski 096fd88dcb Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Prepare tests for ICU 62.1
2018-06-25 11:31:21 +02:00
Anatol Belski 5af0db88fa Prepare tests for ICU 62.1 2018-06-25 11:30:14 +02:00
Nikita Popov 14b22704c7 Merge branch 'PHP-7.1' into PHP-7.2 2018-06-24 22:28:57 +02:00
Nikita Popov 701460ba84 Fixed bug #76502 2018-06-24 22:26:45 +02:00
Nikita Popov ed9d1b708b Fixed bug #76520 2018-06-22 16:22:04 +02:00
Dmitry Stogov 4a4c72a82a Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Added parenthesis
2018-06-22 12:04:39 +03:00
Dmitry Stogov 1f726c9925 Added parenthesis 2018-06-22 12:04:23 +03:00
Jakub Zelenka d95ee27551 Make new openssl ext tests in 7.2 consitent 2018-06-21 17:02:44 +01:00
Jakub Zelenka 77bd405959 Merge branch 'PHP-7.1' into PHP-7.2 2018-06-21 16:47:08 +01:00
Jakub Zelenka b20bcbc363 Use unix NL in all openssl ext tests 2018-06-21 16:43:32 +01:00
Jakub Zelenka 3c42f64e6e Make code in openssl ext tests more consistent
Mainly use spaces for indent and fix some other CS issues. Also
drop checks for unsupported OpenSSL library versions.
2018-06-21 16:38:19 +01:00
Xinchen Hui e62c6e7dbe Update NEWS 2018-06-21 17:26:45 +08:00
Xinchen Hui 939e1095f2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys)
2018-06-21 17:26:27 +08:00
Xinchen Hui 6531719da5 Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys) 2018-06-21 17:26:05 +08:00
Stanislav Malyshev 011be49dda Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Revert "ICU 59+ requires C++11 and errors out without the option"
2018-06-20 10:41:59 -07:00
Stanislav Malyshev bcf2e10ae7 Revert "ICU 59+ requires C++11 and errors out without the option"
This reverts commit 5dd1ef90ca.
2018-06-20 10:41:41 -07:00
Nikita Popov 44f4d2be01 Merge branch 'PHP-7.1' into PHP-7.2 2018-06-20 12:30:19 +02:00
Nikita Popov 69dee5c732 Fixed bug #73342
Directly listen on socket, instead of duping it to STDIN and
listening on that.
2018-06-20 12:28:15 +02:00
Stanislav Malyshev 61a4fc4e44 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  ICU 59+ requires C++11 and errors out without the option
2018-06-17 16:42:49 -07:00
Stanislav Malyshev 5dd1ef90ca ICU 59+ requires C++11 and errors out without the option 2018-06-17 16:42:41 -07:00
Pedro Magalhães 13e9a471d7 Fix #76300 - Dont attempt to change visibility of a parent private 2018-06-17 15:53:55 -07:00
Xinchen Hui f31ba7cb53 Fixed bug #76477 (Opcache causes empty return value) 2018-06-15 16:31:31 +08:00
Dmitry Stogov dad8bd5851 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed invalid free introduced by d6e81f0bfd (avoid keeping "invalid" pointer)
2018-06-14 02:40:59 +03:00
Dmitry Stogov 11507c0e1b Fixed invalid free introduced by d6e81f0bfd (avoid keeping "invalid" pointer) 2018-06-14 02:38:39 +03:00
Nikita Popov d04a1e8d70 Merge branch 'PHP-7.1' into PHP-7.2 2018-06-13 23:48:28 +02:00
Nikita Popov e77077edeb Make $locale parameter to BreakIterator ctors optional
It's documented as such and already accepts null.
2018-06-13 23:47:20 +02:00
Jakub Zelenka dd622f9ca9 Port FPM test 023 and 024 to the new FPM testing 2018-06-12 18:09:27 +01:00
Jakub Zelenka bc58ba750f Merge branch 'PHP-7.1' into PHP-7.2 2018-06-12 18:03:01 +01:00
Jakub Zelenka ea592e6b6c Rewrite FPM tests 2018-06-12 17:59:28 +01:00
Anatol Belski 827cb0484e [ci skip] Update NEWS 2018-06-12 18:07:35 +02:00
Anatol Belski 87cb883563 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  [ci skip] Update NEWS
2018-06-12 18:07:11 +02:00
Anatol Belski 62554efffe [ci skip] Update NEWS 2018-06-12 18:06:41 +02:00
Anatol Belski 5f1190684f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76462 Undefined property: DateInterval::$f
2018-06-12 15:31:01 +02:00
Anatol Belski 7212829435 Fixed bug #76462 Undefined property: DateInterval::$f 2018-06-12 15:30:14 +02:00
Remi Collet eb2a3c6c65 NEWS 2018-06-12 09:35:52 +02:00
Remi Collet 075e685439 Add OPSYS_CPM constant as documented and to match libzip naming 2018-06-12 09:31:41 +02:00
Anatol Belski 7dcfa839c9 Remove inappropriate FreeLibrary call 2018-06-11 13:49:42 +02:00
Nikita Popov 3d7284d09e Merge branch 'PHP-7.1' into PHP-7.2 2018-06-10 21:21:11 +02:00
Nikita Popov 6c9db02ff7 Fix mysqlnd build without openssl
Cherry-pick of 968eb0b38c, as these
changes were also introduced in lower branches.
2018-06-10 21:20:28 +02:00
Jakub Zelenka bca6d373fc Merge branch 'PHP-7.1' into PHP-7.2 2018-06-10 14:33:28 +01:00
Anatol Belski 66badcdc0c Fix test portability 2018-06-09 20:57:17 +02:00
Christoph M. Becker 3fdde65617 Fix #76409: heap use after free in _php_stream_free
We must not close the stream in exif_read_from_impl(), since it is the
responsibility of the (caller's) caller to do so, if it actually opened
the stream.

We simplify the reproduce script, which is actually about supplying a
path to a directory (opposed to a regular file), and use `.` instead of
`/` to also make it work on Windows.
2018-06-09 17:52:05 +02:00
Nikita Popov e029019275 Deduplicate code using php_timezone_to_string()
Looks like this usage was overlooked when the function was
introduced.
2018-06-08 23:10:43 +02:00
David Carlier ad52ec3db8 cast to int to disable compilation warnings. 2018-06-08 23:08:42 +02:00
Keyur Govande 695b8192c7 Avoid leaking the urandom fd
When Apache is reloaded, it unloads the extension, but the open file descriptor to /dev/urandom is left hanging around and is leaked. This fixes the bug.

Duplicate of https://github.com/jedisct1/libsodium-php/pull/173
2018-06-08 23:01:57 +02:00
Jakub Zelenka f9d1d1f36f Enable IPv6 in Travis 2018-06-08 20:09:33 +01:00
Joe Watkins e9b8193b24 bump versions 2018-06-07 08:19:43 +02:00
Anatol Belski 0bafb530d6 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix VC compilation as variable size array is not supported
  Fix MySQL 8 auth
2018-06-06 11:14:15 +02:00
Anatol Belski f96df64cb2 Fix VC compilation as variable size array is not supported 2018-06-06 11:13:28 +02:00
Johannes Schlüter 04db3d0f7a Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1 2018-06-06 00:24:41 +02:00
Johannes Schlüter d6e81f0bfd Fix MySQL 8 auth 2018-06-06 00:17:34 +02:00
Sara Golemon 917222f395 NEWS for 7.2.8 2018-06-05 12:07:52 -04:00
261 changed files with 6543 additions and 2928 deletions

No files matched your search

+1 -7
View File
@@ -8,12 +8,6 @@ branches:
- PHP-5.6
- PHP-7.0
skip_commits:
files:
- NEWS
- UPGRADING*
- README.*
clone_depth: 64
cache:
@@ -23,7 +17,7 @@ environment:
PHP_BUILD_CACHE_BASE_DIR: c:\build-cache
PHP_BUILD_OBJ_DIR: c:\obj
PHP_BUILD_CACHE_SDK_DIR: c:\build-cache\sdk
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.5
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.7
PHP_BUILD_CRT: vc15
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
+3 -1
View File
@@ -1,6 +1,6 @@
dist: trusty
language: c
sudo: false
sudo: required
addons:
apt:
packages:
@@ -50,6 +50,8 @@ before_script:
- ccache --version
- ccache --zero-stats
- export USE_CCACHE=1
# Enable IPv6
- sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
# Compile PHP
- ./travis/compile.sh
# Setup Extensions
+97 -1
View File
@@ -1,6 +1,102 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
07 Jun 2018, PHP 7.2.7RC1
02 Aug 2018, PHP 7.2.9RC1
- Calendar:
. Fixed bug #52974 (jewish.c: compile error under Windows with GBK charset).
(cmb)
- Filter:
. Fixed bug #76366 (References in sub-array for filtering breaks the filter).
(ZiHang Gao)
- PDO_Firebird:
. Fixed bug #76488 (Memory leak when fetching a BLOB field). (Simonov Denis)
- PDO_PgSQL:
. Fixed bug #75402 (Possible Memory Leak using PDO::CURSOR_SCROLL option).
(Anatol)
- SQLite3:
. Fixed #76665 (SQLite3Stmt::bindValue() with SQLITE3_FLOAT doesn't juggle).
(cmb)
- Standard:
. Fixed bug #73817 (Incorrect entries in get_html_translation_table). (cmb)
. Fixed bug #68553 (array_column: null values in $index_key become incrementing
keys in result). (Laruence)
. Fixed bug #76643 (Segmentation fault when using `output_add_rewrite_var`).
(cmb)
- Zip:
. Fixed bug #76524 (ZipArchive memory leak (OVERWRITE flag and empty archive)).
(Timur Ibragimov)
19 Jul 2018, PHP 7.2.8
- Core:
. Fixed bug #76534 (PHP hangs on 'illegal string offset on string references
with an error handler). (Laruence)
. Fixed bug #76520 (Object creation leaks memory when executed over HTTP).
(Nikita)
. Fixed bug #76502 (Chain of mixed exceptions and errors does not serialize
properly). (Nikita)
- Date:
. Fixed bug #76462 (Undefined property: DateInterval::$f). (Anatol)
- EXIF:
. Fixed bug #76409 (heap use after free in _php_stream_free). (cmb)
. Fixed bug #76423 (Int Overflow lead to Heap OverFlow in
exif_thumbnail_extract of exif.c). (Stas)
. Fixed bug #76557 (heap-buffer-overflow (READ of size 48) while reading exif
data). (Stas)
- FPM:
. Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
non-blocking). (Nikita)
- GMP:
. Fixed bug #74670 (Integer Underflow when unserializing GMP and possible
other classes). (Nikita)
- intl:
. Fixed bug #76556 (get_debug_info handler for BreakIterator shows wrong
type). (cmb)
- mbstring:
. Fixed bug #76532 (Integer overflow and excessive memory usage
in mb_strimwidth). (MarcusSchwarz)
- Opcache:
. Fixed bug #76477 (Opcache causes empty return value).
(Nikita, Laruence)
- PGSQL:
. Fixed bug #76548 (pg_fetch_result did not fetch the next row). (Anatol)
- phpdbg:
. Fix arginfo wrt. optional/required parameters. (cmb)
- Reflection:
. Fixed bug #76536 (PHP crashes with core dump when throwing exception in
error handler). (Laruence)
. Fixed bug #75231 (ReflectionProperty#getValue() incorrectly works with
inherited classes). (Nikita)
- Standard:
. Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys).
(Laruence)
. Fixed bug #71848 (getimagesize with $imageinfo returns false). (cmb)
- Win32:
. Fixed bug #76459 (windows linkinfo lacks openbasedir check). (Anatol)
- ZIP:
. Fixed bug #76461 (OPSYS_Z_CPM defined instead of OPSYS_CPM).
(Dennis Birkholz, Remi)
07 Jun 2018, PHP 7.2.7
- Core:
. Fixed bug #76337 (segfault when opcache enabled + extension use
+3 -3
View File
@@ -60,7 +60,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#include <math.h>
#ifndef zend_isnan
#if HAVE_DECL_ISNAN
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
#define zend_isnan(a) isnan(a)
#elif defined(HAVE_FPCLASS)
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -69,7 +69,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#endif
#endif
#if HAVE_DECL_ISINF
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
#define zend_isinf(a) isinf(a)
#elif defined(INFINITY)
/* Might not work, but is required by ISO C99 */
@@ -80,7 +80,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#define zend_isinf(a) 0
#endif
#if HAVE_DECL_ISFINITE
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
#define zend_finite(a) isfinite(a)
#elif defined(HAVE_FINITE)
#define zend_finite(a) finite(a)
+2 -2
View File
@@ -20,7 +20,7 @@ assert(0 && ($a = function () {
yield from $x;
}));
assert(0 && ($a = function &(array &$a, X $b = null) use ($c,&$d) : X {
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
abstract class A extends B implements C, D {
const X = 12;
const Y = self::X, Z = "aaa";
@@ -161,7 +161,7 @@ Warning: assert(): assert(0 && ($a = function () {
yield from $x;
})) failed in %sexpect_015.php on line %d
Warning: assert(): assert(0 && ($a = function &(array &$a, X $b = null) use($c, &$d): X {
Warning: assert(): assert(0 && ($a = function &(array &$a, ?X $b = null) use($c, &$d): ?X {
abstract class A extends B implements C, D {
const X = 12;
const Y = self::X, Z = 'aaa';
+36
View File
@@ -0,0 +1,36 @@
--TEST--
Bug #76502: Chain of mixed exceptions and errors does not serialize properly
--FILE--
<?php
$examples = [
"Exception(Exception())" => new Exception("outer", 0, new Exception("inner")),
"Error(Error())" => new Error("outer", 0, new Error("inner")),
"Error(Exception())" => new Error("outer", 0, new Exception("inner")),
"Exception(Error())" => new Exception("outer", 0, new Error("inner"))
];
foreach ($examples as $name => $example) {
$processed = unserialize(serialize($example));
$processedPrev = $processed->getPrevious();
echo "---- $name ----\n";
echo "before: ", get_class($example), ".previous == ",
get_class($example->getPrevious()), "\n";
echo "after : ", get_class($processed), ".previous == ",
$processedPrev ? get_class($processedPrev) : "null", "\n";
}
?>
--EXPECT--
---- Exception(Exception()) ----
before: Exception.previous == Exception
after : Exception.previous == Exception
---- Error(Error()) ----
before: Error.previous == Error
after : Error.previous == Error
---- Error(Exception()) ----
before: Error.previous == Exception
after : Error.previous == Exception
---- Exception(Error()) ----
before: Exception.previous == Error
after : Exception.previous == Error
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #76534 (PHP hangs on 'illegal string offset on string references with an error handler)
--FILE--
<?php
set_error_handler(function ($severity, $message, $file, $line) {
throw new \Exception($message);
});
$x = "foo";
$y = &$x["bar"];
?>
--EXPECTF--
Fatal error: Uncaught Exception: Illegal string offset 'bar' in %sbug76534.php:%d
Stack trace:
#0 %sbug76534.php(%d): {closure}(2, 'Illegal string ...', '%s', %d, Array)
#1 {main}
thrown in %sbug76534.php on line %d
+8 -1
View File
@@ -195,7 +195,14 @@ ZEND_API void * __zend_realloc(void *p, size_t len) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
#define pemalloc(size, persistent) ((persistent)?__zend_malloc(size):emalloc(size))
#define safe_pemalloc(nmemb, size, offset, persistent) ((persistent)?_safe_malloc(nmemb, size, offset):safe_emalloc(nmemb, size, offset))
#define pefree(ptr, persistent) ((persistent)?free(ptr):efree(ptr))
#define pefree_size(ptr, size, persistent) ((persistent)?free(ptr):efree_size(ptr, size))
#define pefree_size(ptr, size, persistent) do { \
if (persistent) { \
free(ptr); \
} else { \
efree_size(ptr, size);\
} \
} while (0)
#define pecalloc(nmemb, size, persistent) ((persistent)?__zend_calloc((nmemb), (size)):ecalloc((nmemb), (size)))
#define perealloc(ptr, size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc((ptr), (size)))
#define perealloc2(ptr, size, copy_size, persistent) ((persistent)?__zend_realloc((ptr), (size)):erealloc2((ptr), (size), (copy_size)))
+6
View File
@@ -1076,6 +1076,9 @@ tail_call:
zend_ast_export_ex(str, decl->child[1], 0, indent);
if (decl->child[3]) {
smart_str_appends(str, ": ");
if (decl->child[3]->attr & ZEND_TYPE_NULLABLE) {
smart_str_appendc(str, '?');
}
zend_ast_export_ns_name(str, decl->child[3], 0, indent);
}
if (decl->child[2]) {
@@ -1610,6 +1613,9 @@ simple_list:
break;
case ZEND_AST_PARAM:
if (ast->child[0]) {
if (ast->child[0]->attr & ZEND_TYPE_NULLABLE) {
smart_str_appendc(str, '?');
}
zend_ast_export_ns_name(str, ast->child[0], 0, indent);
smart_str_appendc(str, ' ');
}
+2 -2
View File
@@ -968,8 +968,8 @@ static zend_always_inline int zend_check_arg_send_type(const zend_function *zf,
#define ZEND_RETURN_REF 1
#define ZEND_RETURNS_FUNCTION 1<<0
#define ZEND_RETURNS_VALUE 1<<1
#define ZEND_RETURNS_FUNCTION (1<<0)
#define ZEND_RETURNS_VALUE (1<<1)
#define ZEND_ARRAY_ELEMENT_REF (1<<0)
#define ZEND_ARRAY_NOT_PACKED (1<<1)
+1 -1
View File
@@ -323,7 +323,7 @@ ZEND_METHOD(exception, __wakeup)
CHECK_EXC_TYPE(ZEND_STR_TRACE, IS_ARRAY);
pvalue = zend_read_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1, 1, &value);
if (pvalue && Z_TYPE_P(pvalue) != IS_NULL && (Z_TYPE_P(pvalue) != IS_OBJECT ||
!instanceof_function(Z_OBJCE_P(pvalue), i_get_exception_base(object)) ||
!instanceof_function(Z_OBJCE_P(pvalue), zend_ce_throwable) ||
pvalue == object)) {
zend_unset_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1);
}
+9 -4
View File
@@ -990,9 +990,12 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
zend_class_entry *ce = NULL;
void *dummy_cache_slot = NULL;
if (UNEXPECTED(ZEND_TYPE_CODE(ret_info->type) == IS_VOID && Z_TYPE_P(ret) != IS_NULL)) {
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
return 0;
if (ZEND_TYPE_CODE(ret_info->type) == IS_VOID) {
if (UNEXPECTED(Z_TYPE_P(ret) != IS_NULL)) {
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
return 0;
}
return 1;
}
if (UNEXPECTED(!zend_check_type(ret_info->type, ret, &ce, &dummy_cache_slot, NULL, NULL, 1))) {
@@ -1651,7 +1654,9 @@ fetch_from_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, type EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
ZVAL_ERROR(result);
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+1
View File
@@ -142,6 +142,7 @@ void init_executor(void) /* {{{ */
EG(in_autoload) = NULL;
EG(autoload_func) = NULL;
EG(error_handling) = EH_NORMAL;
EG(flags) = EG_FLAGS_INITIAL;
zend_vm_stack_init();
+3 -1
View File
@@ -916,7 +916,9 @@ ZEND_VM_C_LABEL(assign_dim_op_convert_to_array):
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
+24 -8
View File
@@ -17661,7 +17661,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -20685,7 +20687,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -21999,7 +22003,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -24605,7 +24611,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -35400,7 +35408,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -39558,7 +39568,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -41917,7 +41929,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
@@ -45591,7 +45605,9 @@ assign_dim_op_convert_to_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, BP_VAR_RW EXECUTE_DATA_CC);
zend_wrong_string_offset(EXECUTE_DATA_C);
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset(EXECUTE_DATA_C);
}
}
UNDEF_RESULT();
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
+4 -4
View File
@@ -68,7 +68,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#include <math.h>
#ifndef zend_isnan
#if HAVE_DECL_ISNAN
#if HAVE_DECL_ISNAN && (!defined(__cplusplus) || __cplusplus < 201103L)
#define zend_isnan(a) isnan(a)
#elif defined(HAVE_FPCLASS)
#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN))
@@ -77,7 +77,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#endif
#endif
#if HAVE_DECL_ISINF
#if HAVE_DECL_ISINF && (!defined(__cplusplus) || __cplusplus < 201103L)
#define zend_isinf(a) isinf(a)
#elif defined(INFINITY)
/* Might not work, but is required by ISO C99 */
@@ -88,7 +88,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#define zend_isinf(a) 0
#endif
#if HAVE_DECL_ISFINITE
#if HAVE_DECL_ISFINITE && (!defined(__cplusplus) || __cplusplus < 201103L)
#define zend_finite(a) isfinite(a)
#elif defined(HAVE_FINITE)
#define zend_finite(a) finite(a)
@@ -107,7 +107,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=2
PHP_RELEASE_VERSION=7
PHP_RELEASE_VERSION=9
PHP_EXTRA_VERSION="RC1"
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
+25 -25
View File
@@ -340,38 +340,38 @@ char *JewishMonthName[14] =
char *JewishMonthHebNameLeap[14] =
{
"",
"תשרי",
"חשון",
"כסלו",
"טבת",
"שבט",
"אדר א'",
"אדר ב'",
"ניסן",
"אייר",
"סיון",
"תמוז",
"אב",
"אלול"
"\xFA\xF9\xF8\xE9",
"\xE7\xF9\xE5\xEF",
"\xEB\xF1\xEC\xE5",
"\xE8\xE1\xFA",
"\xF9\xE1\xE8",
"\xE0\xE3\xF8 \xE0'",
"\xE0\xE3\xF8 \xE1'",
"\xF0\xE9\xF1\xEF",
"\xE0\xE9\xE9\xF8",
"\xF1\xE9\xe5\xEF",
"\xFA\xEE\xE5\xE6",
"\xE0\xE1",
"\xE0\xEC\xE5\xEC"
};
/* names for regular year */
char *JewishMonthHebName[14] =
{
"",
"תשרי",
"חשון",
"כסלו",
"טבת",
"שבט",
"\xFA\xF9\xF8\xE9",
"\xE7\xF9\xE5\xEF",
"\xEB\xF1\xEC\xE5",
"\xE8\xE1\xFA",
"\xF9\xE1\xE8",
"",
"אדר",
"ניסן",
"אייר",
"סיון",
"תמוז",
"אב",
"אלול"
"\xE0\xE3\xF8",
"\xF0\xE9\xF1\xEF",
"\xE0\xE9\xE9\xF8",
"\xF1\xE9\xE5\xEF",
"\xFA\xEE\xE5\xE6",
"\xE0\xE1",
"\xE0\xEC\xE5\xEC"
};
/************************************************************************
+53
View File
@@ -0,0 +1,53 @@
--TEST--
Test all hebrew month names
--SKIPIF--
<?php
if (!extension_loaded('calendar')) die('skip calendar extension not available');
?>
--FILE--
<?php
for ($year = 5000; $year <= 5001; $year++) {
$leap = ($year === 5001) ? 'leap' : 'normal';
echo "$leap year $year\n";
for ($month = 1; $month <= 13; $month++) {
$jd = jewishtojd($month, 1, $year);
$hebrew = jdtojewish($jd, true);
$hex = bin2hex($hebrew);
echo "$hex\n";
}
echo "\n";
}
?>
===DONE===
--EXPECT--
normal year 5000
e020faf9f8e920e4
e020e7f9e5ef20e4
e020ebf1ece520e4
e020e8e1fa20e4
e020f9e1e820e4
e020e0e3f820e02720e4
e020e0e3f820e12720e4
e020f0e9f1ef20e4
e020e0e9e9f820e4
e020f1e9e5ef20e4
e020faeee5e620e4
e020e0e120e4
e020e0ece5ec20e4
leap year 5001
e020faf9f8e920e4e0
e020e7f9e5ef20e4e0
e020ebf1ece520e4e0
e020e8e1fa20e4e0
e020f9e1e820e4e0
e020e0e3f820e4e0
e020e0e3f820e4e0
e020f0e9f1ef20e4e0
e020e0e9e9f820e4e0
e020f1e9e5ef20e4e0
e020faeee5e620e4e0
e020e0e120e4e0
e020e0ece5ec20e4e0
===DONE===
+26 -44
View File
@@ -2358,48 +2358,6 @@ static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */
return &new_obj->std;
} /* }}} */
static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
{
HashTable *props;
zval zv;
php_timezone_obj *tzobj;
tzobj = Z_PHPTIMEZONE_P(object);
props = zend_std_get_properties(object);
if (!tzobj->initialized) {
return props;
}
ZVAL_LONG(&zv, tzobj->type);
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
switch (tzobj->type) {
case TIMELIB_ZONETYPE_ID:
ZVAL_STRING(&zv, tzobj->tzi.tz->name);
break;
case TIMELIB_ZONETYPE_OFFSET: {
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
tzobj->tzi.utc_offset < 0 ? '-' : '+',
abs(tzobj->tzi.utc_offset / 3600),
abs(((tzobj->tzi.utc_offset % 3600) / 60)));
ZVAL_NEW_STR(&zv, tmpstr);
}
break;
case TIMELIB_ZONETYPE_ABBR:
ZVAL_STRING(&zv, tzobj->tzi.z.abbr);
break;
}
zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
return props;
} /* }}} */
static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
{
switch (tzobj->type) {
@@ -2412,8 +2370,8 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
utc_offset < 0 ? '-' : '+',
abs(utc_offset / 3600),
abs(((utc_offset % 3600) / 60)));
abs((int)(utc_offset / 3600)),
abs((int)(utc_offset % 3600) / 60));
ZVAL_NEW_STR(zv, tmpstr);
}
@@ -2424,6 +2382,29 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv)
}
}
static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */
{
HashTable *props;
zval zv;
php_timezone_obj *tzobj;
tzobj = Z_PHPTIMEZONE_P(object);
props = zend_std_get_properties(object);
if (!tzobj->initialized) {
return props;
}
ZVAL_LONG(&zv, tzobj->type);
zend_hash_str_update(props, "timezone_type", sizeof("timezone_type")-1, &zv);
php_timezone_to_string(tzobj, &zv);
zend_hash_str_update(props, "timezone", sizeof("timezone")-1, &zv);
return props;
} /* }}} */
static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */
{
HashTable *ht, *props;
@@ -4298,6 +4279,7 @@ static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int
zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 ||
zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) {
/* Fallback to read_property. */
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #76462 Undefined property: DateInterval::$f
--FILE--
<?php
$buggy = new DateInterval('P0Y');
$buggy->f += 0.01;
$ok = new DateInterval('P0Y');
$ok->f = $ok->f + 0.01;
var_dump($buggy->f);
var_dump($ok->f);
?>
--EXPECT--
float(0.01)
float(0.01)
+5 -1
View File
@@ -42,7 +42,11 @@ struct _notationIterator {
xmlNotation *notation;
};
static void itemHashScanner (void *payload, void *data, xmlChar *name) /* {{{ */
#if LIBXML_VERSION >= 20908
static void itemHashScanner (void *payload, void *data, const xmlChar *name) /* {{{ */
#else
static void itemHashScanner (void *payload, void *data, xmlChar *name)
#endif
{
nodeIterator *priv = (nodeIterator *)data;
+10 -4
View File
@@ -2944,7 +2944,10 @@ static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, siz
return;
}
/* Check to make sure we are not going to go past the ExifLength */
if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) {
if (ImageInfo->Thumbnail.size > length
|| (ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length
|| ImageInfo->Thumbnail.offset > length - ImageInfo->Thumbnail.size
) {
EXIF_ERRLOG_THUMBEOF(ImageInfo)
return;
}
@@ -3126,7 +3129,8 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
#endif
const maker_note_type *maker_note;
char *dir_start;
int data_len;
for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) {
if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) {
#ifdef EXIF_DEBUG
@@ -3180,6 +3184,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
switch (maker_note->offset_mode) {
case MN_OFFSET_MAKER:
offset_base = value_ptr;
data_len = value_len;
break;
#ifdef KALLE_0
case MN_OFFSET_GUESS:
@@ -3197,6 +3202,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
return FALSE;
}
offset_base = value_ptr + offset_diff;
data_len = value_len - offset_diff;
break;
#endif
default:
@@ -3211,7 +3217,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
for (de=0;de<NumDirEntries;de++) {
if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de,
offset_base, IFDlength, displacement, section_index, 0, maker_note->tag_table)) {
offset_base, data_len, displacement, section_index, 0, maker_note->tag_table)) {
return FALSE;
}
}
@@ -4324,7 +4330,7 @@ static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, i
zend_string *base;
if ((st.st_mode & S_IFMT) != S_IFREG) {
exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file");
php_stream_close(ImageInfo->infile);
ImageInfo->infile = NULL;
return FALSE;
}
+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #76409 (heap use after free in _php_stream_free)
--SKIPIF--
<?php
if (!extension_loaded('exif')) die('skip exif extension not available');
?>
--FILE--
<?php
exif_read_data('.');
?>
===DONE===
--EXPECTF--
Warning: exif_read_data(): %s in %s on line %d
===DONE===
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #76423 (Int Overflow lead to Heap OverFlow in exif_thumbnail_extract of exif.c)
--SKIPIF--
<?php
if (!extension_loaded('exif')) die('skip exif extension not available');
?>
--FILE--
<?php
exif_read_data(__DIR__ . '/bug76423.jpg', 0, true, true);
?>
===DONE===
--EXPECTF--
Warning: exif_read_data(%s.jpg): Thumbnail goes IFD boundary or end of file reached in %s on line %d
Warning: exif_read_data(%s.jpg): File structure corrupted in %s on line %d
Warning: exif_read_data(%s.jpg): Invalid JPEG file in %s on line %d
===DONE===
Binary file not shown.
+79
View File
@@ -0,0 +1,79 @@
--TEST--
Bug 76557 (heap-buffer-overflow (READ of size 48) while reading exif data)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
var_dump(exif_read_data(dirname(__FILE__) . "/bug76557.jpg"));
?>
DONE
--EXPECTF--
Warning: exif_read_data(bug76557.jpg): Process tag(x010F=Make ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x8769=Exif_IFD_Po): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x927C=MakerNote ): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal format code 0x3030, suppose BYTE in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Process tag(x3030=UndefinedTa): Illegal pointer offset(x30303030 + x30303030 = x60606060 > x00EE) in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): File structure corrupted in %sbug76557.php on line %d
Warning: exif_read_data(bug76557.jpg): Invalid JPEG file in %sbug76557.php on line %d
bool(false)
DONE
+3
View File
@@ -621,6 +621,9 @@ static void php_filter_call(zval *filtered, zend_long filter, zval *filter_args,
}
if ((option = zend_hash_str_find(HASH_OF(filter_args), "options", sizeof("options") - 1)) != NULL) {
/* avoid reference type */
ZVAL_DEREF(option);
if (filter != FILTER_CALLBACK) {
if (Z_TYPE_P(option) == IS_ARRAY) {
options = option;
+40
View File
@@ -0,0 +1,40 @@
--TEST--
Bug #76366 (references in sub-array for filtering breaks the filter)
--SKIPIF--
<?php
if (!extension_loaded('filter')) die('skip filter extension not available');
?>
--FILE--
<?php
#array to filter
$data = ['foo' => 6];
#filter args
$args = [
'foo'=> [
'filter' => FILTER_VALIDATE_INT,
'flags' => FILTER_FORCE_ARRAY
]
];
$args['foo']['options'] = [];
#create reference
$options = &$args['foo']['options'];
#set options
$options['min_range'] = 1;
$options['max_range'] = 5;
#show the filter result
var_dump(filter_var_array($data, $args));
?>
--EXPECT--
array(1) {
["foo"]=>
array(1) {
[0]=>
bool(false)
}
}
+10
View File
@@ -0,0 +1,10 @@
--TEST--
Bug #74670: Integer Underflow when unserializing GMP and possible other classes
--FILE--
<?php
$str = 'C:3:"GMP":4:{s:6666666666:""}';
var_dump(unserialize($str));
?>
--EXPECTF--
Notice: unserialize(): Error at offset 13 of 29 bytes in %s on line %d
bool(false)
+1 -1
View File
@@ -18,7 +18,7 @@ try {
} catch (Exception $e) { var_dump($e->getMessage()); }
try {
unserialize('C:3:"GMP":8:{s:2:"42";}');
unserialize('C:3:"GMP":9:{s:2:"42";}');
} catch (Exception $e) { var_dump($e->getMessage()); }
?>
@@ -167,7 +167,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
}
ZVAL_STRING(&val, const_cast<char*>(typeid(*biter).name()));
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &bio->text);
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &val);
return debug_info;
}
@@ -51,7 +51,7 @@ static void _breakiter_factory(const char *func_name,
UErrorCode status = UErrorCode();
intl_error_reset(NULL);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!",
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!",
&locale_str, &dummy) == FAILURE) {
spprintf(&msg, 0, "%s: bad arguments", func_name);
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, msg, 1);
+5 -11
View File
@@ -12,35 +12,29 @@ ini_set("intl.default_locale", "ja");
$m = array('createWordInstance', 'createLineInstance', 'createCharacterInstance',
'createSentenceInstance', 'createTitleInstance');
$t = 'Frase 1... Frase 2'.
$t = 'Frase 1... Frase 2';
$o1 = $o2 = null;
foreach ($m as $method) {
echo "===== $method =====\n";
$o1 = call_user_func(array('IntlBreakIterator', $method), 'ja');
var_dump($o1 == $o2);
$o2 = call_user_func(array('IntlBreakIterator', $method), NULL);
var_dump($o1 == $o2);
$o1 = IntlBreakIterator::$method('ja');
$o2 = IntlBreakIterator::$method(NULL);
$o3 = IntlBreakIterator::$method();
var_dump($o1 == $o2 && $o2 == $o3);
echo "\n";
}
--EXPECT--
===== createWordInstance =====
bool(false)
bool(true)
===== createLineInstance =====
bool(false)
bool(true)
===== createCharacterInstance =====
bool(false)
bool(true)
===== createSentenceInstance =====
bool(false)
bool(true)
===== createTitleInstance =====
bool(false)
bool(true)
@@ -22,22 +22,22 @@ Warning: IntlBreakIterator::createWordInstance() expects parameter 1 to be strin
Warning: IntlBreakIterator::createWordInstance(): breakiter_create_word_instance: bad arguments in %s on line %d
NULL
Warning: IntlBreakIterator::createSentenceInstance() expects exactly 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createSentenceInstance() expects at most 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createSentenceInstance(): breakiter_create_sentence_instance: bad arguments in %s on line %d
NULL
Warning: IntlBreakIterator::createCharacterInstance() expects exactly 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createCharacterInstance() expects at most 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createCharacterInstance(): breakiter_create_character_instance: bad arguments in %s on line %d
NULL
Warning: IntlBreakIterator::createTitleInstance() expects exactly 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createTitleInstance() expects at most 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createTitleInstance(): breakiter_create_title_instance: bad arguments in %s on line %d
NULL
Warning: IntlBreakIterator::createLineInstance() expects exactly 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createLineInstance() expects at most 1 parameter, 2 given in %s on line %d
Warning: IntlBreakIterator::createLineInstance(): breakiter_create_line_instance: bad arguments in %s on line %d
NULL
+1
View File
@@ -3,6 +3,7 @@ Bug #62070: Collator::getSortKey() returns garbage
--SKIPIF--
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '53.1') < 0) die('skip for ICU >= 53.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
--FILE--
<?php
$s1 = 'Hello';
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Bug #62070: Collator::getSortKey() returns garbage
--SKIPIF--
<?php if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
--FILE--
<?php
$s1 = 'Hello';
$coll = collator_create('en_US');
$res = collator_get_sort_key($coll, $s1);
echo urlencode($res);
--EXPECT--
82%40%40F%01%09%01%DC%08
+23
View File
@@ -0,0 +1,23 @@
--TEST--
Bug #76556 (get_debug_info handler for BreakIterator shows wrong type)
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not available');
?>
--FILE--
<?php
$it = IntlBreakIterator::createCharacterInstance();
$it->setText('foo');
var_dump($it);
?>
===DONE===
--EXPECTF--
object(IntlRuleBasedBreakIterator)#%d (3) {
["valid"]=>
bool(true)
["text"]=>
string(3) "foo"
["type"]=>
string(%d) "%SRuleBasedBreakIterator%S"
}
===DONE===
@@ -3,6 +3,7 @@ collator_get_sort_key() icu >= 56.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '56.1') < 0) die('skip for ICU >= 56.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
--FILE--
<?php
@@ -0,0 +1,98 @@
--TEST--
collator_get_sort_key() icu >= 62.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
--FILE--
<?php
/*
* Get sort keys using various locales
*/
function sort_arrays( $locale, $data )
{
$res_str = '';
$coll = ut_coll_create( $locale );
foreach($data as $value) {
$res_val = ut_coll_get_sort_key( $coll, $value );
$res_str .= "source: ".$value."\n".
"key: ".bin2hex($res_val)."\n";
}
return $res_str;
}
function ut_main()
{
$res_str = '';
// Regular strings keys
$test_params = array(
'abc', 'abd', 'aaa',
'аа', 'а', 'z',
'', null , '3',
'y' , 'i' , 'k'
);
$res_str .= sort_arrays( 'en_US', $test_params );
// Sort a non-ASCII array using ru_RU locale.
$test_params = array(
'абг', 'абв', 'жжж', 'эюя'
);
$res_str .= sort_arrays( 'ru_RU', $test_params );
// Sort an array using Lithuanian locale.
$res_str .= sort_arrays( 'lt_LT', $test_params );
return $res_str . "\n";
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
source: abc
key: 2a2c2e01070107
source: abd
key: 2a2c3001070107
source: aaa
key: 2a2a2a01070107
source: аа
key: 61060601060106
source: а
key: 610601050105
source: z
key: 5c01050105
source:
key: 0101
source:
key: 0101
source: 3
key: 1901050105
source: y
key: 5a01050105
source: i
key: 3a01050105
source: k
key: 3e01050105
source: абг
key: 27060c1001070107
source: абв
key: 27060c0e01070107
source: жжж
key: 272c2c2c01070107
source: эюя
key: 27eef0f401070107
source: абг
key: 61060c1001070107
source: абв
key: 61060c0e01070107
source: жжж
key: 612c2c2c01070107
source: эюя
key: 61eef0f401070107
+2 -1
View File
@@ -1,8 +1,9 @@
--TEST--
numfmt_format() icu >= 61.1
numfmt_format() icu >= 61.1 && < 62.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '61.1') < 0) die('skip for ICU >= 61.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
--FILE--
<?php
+130
View File
@@ -0,0 +1,130 @@
--TEST--
numfmt_format() icu >= 62.1
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
--FILE--
<?php
/*
* Format a number using misc locales/patterns.
*/
/*
* TODO: doesn't pass on ICU 3.6 because 'ru' and 'de' locales changed
* currency and percent formatting.
*/
function ut_main()
{
$styles = array(
NumberFormatter::PATTERN_DECIMAL => '##.#####################',
NumberFormatter::DECIMAL => '',
NumberFormatter::CURRENCY => '',
NumberFormatter::PERCENT => '',
NumberFormatter::SCIENTIFIC => '',
NumberFormatter::SPELLOUT => '@@@@@@@',
NumberFormatter::ORDINAL => '',
NumberFormatter::DURATION => '',
NumberFormatter::PATTERN_RULEBASED => '#####.###',
1234999, // bad one
);
$integer = array(
NumberFormatter::ORDINAL => '',
NumberFormatter::DURATION => '',
);
$locales = array(
'en_US',
'ru_UA',
'de',
'fr',
'en_UK'
);
$str_res = '';
$number = 1234567.891234567890000;
foreach( $locales as $locale )
{
$str_res .= "\nLocale is: $locale\n";
foreach( $styles as $style => $pattern )
{
$fmt = ut_nfmt_create( $locale, $style, $pattern );
if(!$fmt) {
$str_res .= "Bad formatter!\n";
continue;
}
$str_res .= dump( isset($integer[$style])?ut_nfmt_format( $fmt, $number, NumberFormatter::TYPE_INT32):ut_nfmt_format( $fmt, $number ) ) . "\n";
}
}
return $str_res;
}
include_once( 'ut_common.inc' );
// Run the test
ut_run();
?>
--EXPECTREGEX--
Locale is: en_US
'1234567.8912345\d+'
'1,234,567.891'
'\$1,234,567.89'
'123,456,789%'
'1.2345678912345\d+E6'
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?'
'1,234,567(th|ᵗʰ)'
'342:56:07'
'#####.###'
'USD 1,234,567.89'
Locale is: ru_UA
'1234567.8912345\d+'
'1 234 567,891'
'1 234 567,89 ?(грн\.|₴)'
'123 456 789 ?%'
'1.2345678912345\d+E6'
'один миллион двести тридцать четыре тысячи пятьсот шестьдесят семь целых восемьдесят девять миллионов сто двадцать три тысячи четыреста пятьдесят семь стомиллионных'
'1 234 567.?'
'1 234 567'
'#####.###'
'1 234 567,89 UAH'
Locale is: de
'1234567.8912345\d+'
'1.234.567,891'
'1.234.567,89 XXX'
'123\.456\.789 %'
'1.2345678912345\d+E6'
'eine Million zwei­hundert­vier­und­dreißig­tausend­fünf­hundert­sieben­und­sechzig Komma acht neun eins zwei drei vier fünf( sechs)? sieben( neun)?'
'1.234.567.?'
'1.234.567'
'#####.###'
'1.234.567,89 XXX'
Locale is: fr
'1234567.8912345\d+'
'1 234 567,891'
'1 234 567,89 XXX'
'123 456 789 ?%'
'1.2345678912345\d+E6'
'un million deux cent trente-quatre mille cinq cent soixante-sept virgule huit neuf un deux trois quatre cinq( six)? sept( neuf)?'
'1 234 567e'
'1 234 567'
'#####.###'
'1 234 567,89 XXX'
Locale is: en_UK
'1234567.8912345\d+'
'1,234,567.891'
'XXX 1,234,567.89'
'123,456,789%'
'1.2345678912345\d+E6'
'one million,? two hundred (and )?thirty-four thousand,? five hundred (and )?sixty-seven point eight nine one two three four five( six)? seven( nine)?'
'1,234,567(th|ᵗʰ)'
'342:56:07'
'#####.###'
'XXX 1,234,567.89'
@@ -42,9 +42,9 @@ include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
--EXPECTF--
en_UK: '£1,234,567.89'
en_US: '$1,234,567.89'
ru: '1 234 567,89 р.'
uk: '1 234 567,89 ₴'
en: 'UAH1,234,567.89'
en: 'UAH%A1,234,567.89'
@@ -3,6 +3,7 @@ numfmt_get_locale()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '58.1') < 0) die('skip for ICU >= 58.1'); ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
--FILE--
<?php
@@ -0,0 +1,50 @@
--TEST--
numfmt_get_locale()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
--FILE--
<?php
/*
* Get locale.
*/
function ut_main()
{
$locales = array(
'en_UK',
'en_US',
'fr_CA',
);
$loc_types = array(
Locale::ACTUAL_LOCALE => 'actual',
Locale::VALID_LOCALE => 'valid',
);
$res_str = '';
foreach( $locales as $locale )
{
$fmt = ut_nfmt_create( $locale, NumberFormatter::DECIMAL );
$res_str .= "$locale: ";
foreach( $loc_types as $loc_type => $loc_type_name )
$res_str .= sprintf( " %s=%s",
$loc_type_name,
dump( ut_nfmt_get_locale( $fmt, $loc_type ) ) );
$res_str .= "\n";
}
return $res_str;
}
include_once( 'ut_common.inc' );
// Run the test
ut_run();
?>
--EXPECT--
en_UK: actual='en' valid='en'
en_US: actual='en_US' valid='en_US'
fr_CA: actual='fr_CA' valid='fr_CA'
@@ -2,6 +2,7 @@
numfmt_get/set_pattern()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') >= 0) die('skip for ICU < 62.1'); ?>
--FILE--
<?php
@@ -0,0 +1,53 @@
--TEST--
numfmt_get/set_pattern()
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
<?php if (version_compare(INTL_ICU_VERSION, '62.1') < 0) die('skip for ICU >= 62.1'); ?>
--FILE--
<?php
/*
* Get/set pattern.
*/
function ut_main()
{
$res_str = '';
$test_value = 12345.123456;
$fmt = ut_nfmt_create( "en_US", NumberFormatter::PATTERN_DECIMAL );
// Get default patten.
$res_str .= "Default pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
$res_str .= "Formatting result: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
// Set a new pattern.
$res = ut_nfmt_set_pattern( $fmt, "0.0" );
if( $res === false )
$res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
// Check if the pattern has been changed.
$res = ut_nfmt_get_pattern( $fmt );
if( $res === false )
$res_str .= ut_nfmt_get_error_message( $fmt ) . " (" . ut_nfmt_get_error_code( $fmt ) . ")\n";
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
ut_nfmt_set_pattern($fmt, str_repeat('@', 200));
$res_str .= "New pattern: '" . ut_nfmt_get_pattern( $fmt ) . "'\n";
$res_str .= "Formatted number: " . ut_nfmt_format( $fmt, $test_value ) . "\n";
return $res_str;
}
include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
Default pattern: '#'
Formatting result: 12345.123456
New pattern: '0.0'
Formatted number: 12345.1
New pattern: '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'
Formatted number: 12345.123456000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
@@ -88,7 +88,7 @@ include_once( 'ut_common.inc' );
ut_run();
?>
--EXPECT--
--EXPECTF--
Symbol 'DECIMAL_SEPARATOR_SYMBOL'
Default symbol: [.]
New symbol: [_._]
@@ -132,7 +132,7 @@ A number formatted with the new symbol: 1.2345123456E4
Symbol 'CURRENCY_SYMBOL'
Default symbol: [$]
New symbol: [_$_]
A number formatted with the new symbol: _$_12,345.12
A number formatted with the new symbol: _$_%A12,345.12
Symbol 'INTL_CURRENCY_SYMBOL'
Default symbol: [USD]
+1 -1
View File
@@ -1875,7 +1875,7 @@ mbfl_strimwidth(
mbfl_string_init(result);
result->no_language = string->no_language;
result->no_encoding = string->no_encoding;
mbfl_memory_device_init(&pc.device, width, 0);
mbfl_memory_device_init(&pc.device, MIN(string->len, width), 0);
/* output code filter */
pc.decoder = mbfl_convert_filter_new(
+7
View File
@@ -113,6 +113,13 @@
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
/*
* convenience macros
*/
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
/*
* buffering converter
*/
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #76532 (Integer overflow and excessive memory usage in mb_strimwidth)
--SKIPIF--
<?php require 'skipif.inc'; ?>
--FILE--
<?php
$string_to_trim = '得很幸福。有一天,一个长得很丑的老人带着一只木马来到王';
$width = 2147483647;
var_dump(mb_strimwidth($string_to_trim, 0, $width));
?>
--EXPECT--
string(81) "得很幸福。有一天,一个长得很丑的老人带着一只木马来到王"
+286 -7
View File
@@ -89,6 +89,7 @@ mysqlnd_run_authentication(
}
}
{
zend_uchar * switch_to_auth_protocol_data = NULL;
size_t switch_to_auth_protocol_data_len = 0;
@@ -113,10 +114,11 @@ mysqlnd_run_authentication(
DBG_INF_FMT("salt(%d)=[%.*s]", plugin_data_len, plugin_data_len, plugin_data);
/* The data should be allocated with malloc() */
if (auth_plugin) {
scrambled_data =
auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len,
plugin_data, plugin_data_len, session_options,
conn->protocol_frame_codec->data, mysql_flags);
scrambled_data = auth_plugin->methods.get_auth_data(
NULL, &scrambled_data_len, conn, user, passwd,
passwd_len, plugin_data, plugin_data_len,
session_options, conn->protocol_frame_codec->data,
mysql_flags);
}
if (conn->error_info->error_no) {
@@ -127,6 +129,7 @@ mysqlnd_run_authentication(
charset_no,
first_call,
requested_protocol,
auth_plugin, plugin_data, plugin_data_len,
scrambled_data, scrambled_data_len,
&switch_to_auth_protocol, &switch_to_auth_protocol_len,
&switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
@@ -248,6 +251,9 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
unsigned int server_charset_no,
zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,
struct st_mysqlnd_authentication_plugin * auth_plugin,
const zend_uchar * const orig_auth_plugin_data,
const size_t orig_auth_plugin_data_len,
const zend_uchar * const auth_plugin_data,
const size_t auth_plugin_data_len,
char ** switch_to_auth_protocol,
@@ -318,6 +324,11 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
conn->charset = mysqlnd_find_charset_nr(auth_packet->charset_no);
}
if (auth_plugin && auth_plugin->methods.handle_server_response) {
auth_plugin->methods.handle_server_response(auth_plugin, conn,
orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len);
}
if (FAIL == PACKET_READ(auth_resp_packet) || auth_resp_packet->response_code >= 0xFE) {
if (auth_resp_packet->response_code == 0xFE) {
/* old authentication with new server !*/
@@ -613,7 +624,8 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_native_auth_plugin =
}
},
{/* methods */
mysqlnd_native_auth_get_auth_data
mysqlnd_native_auth_get_auth_data,
NULL
}
};
@@ -662,7 +674,8 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_pam_authentication_plugin
}
},
{/* methods */
mysqlnd_pam_auth_get_auth_data
mysqlnd_pam_auth_get_auth_data,
NULL
}
};
@@ -846,17 +859,283 @@ static struct st_mysqlnd_authentication_plugin mysqlnd_sha256_authentication_plu
}
},
{/* methods */
mysqlnd_sha256_auth_get_auth_data
mysqlnd_sha256_auth_get_auth_data,
NULL
}
};
#endif
/*************************************** CACHING SHA2 Password *******************************/
#undef L64
#include "ext/hash/php_hash.h"
#include "ext/hash/php_hash_sha.h"
#define SHA256_LENGTH 32
/* {{{ php_mysqlnd_scramble_sha2 */
void php_mysqlnd_scramble_sha2(zend_uchar * const buffer, const zend_uchar * const scramble, const zend_uchar * const password, const size_t password_len)
{
PHP_SHA256_CTX context;
zend_uchar sha1[SHA256_LENGTH];
zend_uchar sha2[SHA256_LENGTH];
/* Phase 1: hash password */
PHP_SHA256Init(&context);
PHP_SHA256Update(&context, password, password_len);
PHP_SHA256Final(sha1, &context);
/* Phase 2: hash sha1 */
PHP_SHA256Init(&context);
PHP_SHA256Update(&context, (zend_uchar*)sha1, SHA256_LENGTH);
PHP_SHA256Final(sha2, &context);
/* Phase 3: hash scramble + sha2 */
PHP_SHA256Init(&context);
PHP_SHA256Update(&context, (zend_uchar*)sha2, SHA256_LENGTH);
PHP_SHA256Update(&context, scramble, SCRAMBLE_LENGTH);
PHP_SHA256Final(buffer, &context);
/* let's crypt buffer now */
php_mysqlnd_crypt(buffer, (const zend_uchar *)sha1, (const zend_uchar *)buffer, SHA256_LENGTH);
}
/* }}} */
/* {{{ mysqlnd_native_auth_get_auth_data */
static zend_uchar *
mysqlnd_caching_sha2_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
size_t * auth_data_len,
MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
const MYSQLND_PFC_DATA * const pfc_data,
zend_ulong mysql_flags
)
{
zend_uchar * ret = NULL;
DBG_ENTER("mysqlnd_caching_sha2_get_auth_data");
DBG_INF_FMT("salt(%d)=[%.*s]", auth_plugin_data_len, auth_plugin_data_len, auth_plugin_data);
*auth_data_len = 0;
DBG_INF("First auth step: send hashed password");
/* copy scrambled pass*/
if (passwd && passwd_len) {
ret = malloc(SHA256_LENGTH + 1);
*auth_data_len = SHA256_LENGTH;
php_mysqlnd_scramble_sha2((zend_uchar*)ret, auth_plugin_data, (zend_uchar*)passwd, passwd_len);
ret[SHA256_LENGTH] = '\0';
DBG_INF_FMT("hash(%d)=[%.*s]", *auth_data_len, *auth_data_len, ret);
}
DBG_RETURN(ret);
}
/* }}} */
#ifdef MYSQLND_HAVE_SSL
static RSA *
mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn)
{
RSA * ret = NULL;
const MYSQLND_PFC_DATA * const pfc_data = conn->protocol_frame_codec->data;
const char * fname = (pfc_data->sha256_server_public_key && pfc_data->sha256_server_public_key[0] != '\0')?
pfc_data->sha256_server_public_key:
MYSQLND_G(sha256_server_public_key);
php_stream * stream;
DBG_ENTER("mysqlnd_cached_sha2_get_key");
DBG_INF_FMT("options_s256_pk=[%s] MYSQLND_G(sha256_server_public_key)=[%s]",
pfc_data->sha256_server_public_key? pfc_data->sha256_server_public_key:"n/a",
MYSQLND_G(sha256_server_public_key)? MYSQLND_G(sha256_server_public_key):"n/a");
if (!fname || fname[0] == '\0') {
MYSQLND_PACKET_CACHED_SHA2_RESULT *req_packet = NULL;
MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE *pk_resp_packet = NULL;
do {
DBG_INF("requesting the public key from the server");
req_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
pk_resp_packet = conn->payload_decoder_factory->m.get_sha256_pk_request_response_packet(conn->payload_decoder_factory, FALSE);
req_packet->request = 1;
if (! PACKET_WRITE(req_packet)) {
DBG_ERR_FMT("Error while sending public key request packet");
php_error(E_WARNING, "Error while sending public key request packet. PID=%d", getpid());
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
break;
}
if (FAIL == PACKET_READ(pk_resp_packet) || NULL == pk_resp_packet->public_key) {
DBG_ERR_FMT("Error while receiving public key");
php_error(E_WARNING, "Error while receiving public key. PID=%d", getpid());
SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT);
break;
}
DBG_INF_FMT("Public key(%d):\n%s", pk_resp_packet->public_key_len, pk_resp_packet->public_key);
/* now extract the public key */
{
BIO * bio = BIO_new_mem_buf(pk_resp_packet->public_key, pk_resp_packet->public_key_len);
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
BIO_free(bio);
}
} while (0);
PACKET_FREE(req_packet);
PACKET_FREE(pk_resp_packet);
DBG_INF_FMT("ret=%p", ret);
DBG_RETURN(ret);
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE,
"caching_sha2_server_public_key is not set for the connection or as mysqlnd.sha256_server_public_key");
DBG_ERR("server_public_key is not set");
DBG_RETURN(NULL);
} else {
zend_string * key_str;
DBG_INF_FMT("Key in a file. [%s]", fname);
stream = php_stream_open_wrapper((char *) fname, "rb", REPORT_ERRORS, NULL);
if (stream) {
if ((key_str = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0)) != NULL) {
BIO * bio = BIO_new_mem_buf(ZSTR_VAL(key_str), ZSTR_LEN(key_str));
ret = PEM_read_bio_RSA_PUBKEY(bio, NULL, NULL, NULL);
BIO_free(bio);
DBG_INF("Successfully loaded");
DBG_INF_FMT("Public key:%*.s", ZSTR_LEN(key_str), ZSTR_VAL(key_str));
zend_string_release(key_str);
}
php_stream_close(stream);
}
}
DBG_RETURN(ret);
}
#endif
/* {{{ mysqlnd_caching_sha2_get_key */
static size_t
mysqlnd_caching_sha2_get_and_use_key(MYSQLND_CONN_DATA *conn,
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
unsigned char **crypted,
const char * const passwd,
const size_t passwd_len)
{
#ifdef MYSQLND_HAVE_SSL
static RSA *server_public_key;
server_public_key = mysqlnd_caching_sha2_get_key(conn);
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
if (server_public_key) {
int server_public_key_len;
char xor_str[passwd_len + 1];
memcpy(xor_str, passwd, passwd_len);
xor_str[passwd_len] = '\0';
mysqlnd_xor_string(xor_str, passwd_len, (char *) auth_plugin_data, auth_plugin_data_len);
server_public_key_len = RSA_size(server_public_key);
/*
Because RSA_PKCS1_OAEP_PADDING is used there is a restriction on the passwd_len.
RSA_PKCS1_OAEP_PADDING is recommended for new applications. See more here:
http://www.openssl.org/docs/crypto/RSA_public_encrypt.html
*/
if ((size_t) server_public_key_len - 41 <= passwd_len) {
/* password message is to long */
SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long");
DBG_ERR("password is too long");
DBG_RETURN(0);
}
*crypted = emalloc(server_public_key_len);
RSA_public_encrypt(passwd_len + 1, (zend_uchar *) xor_str, *crypted, server_public_key, RSA_PKCS1_OAEP_PADDING);
DBG_RETURN(server_public_key_len);
}
DBG_RETURN(0);
#else
DBG_ENTER("mysqlnd_caching_sha2_get_and_use_key(");
php_error_docref(NULL, E_WARNING, "PHP was built without openssl extension, can't send password encrypted");
DBG_RETURN(0);
#endif
}
/* }}} */
/* {{{ mysqlnd_native_auth_get_auth_data */
static void
mysqlnd_caching_sha2_handle_server_response(struct st_mysqlnd_authentication_plugin *self,
MYSQLND_CONN_DATA * conn,
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const char * const passwd,
const size_t passwd_len)
{
DBG_ENTER("mysqlnd_caching_sha2_handle_server_response");
MYSQLND_PACKET_CACHED_SHA2_RESULT *result_packet;
result_packet = conn->payload_decoder_factory->m.get_cached_sha2_result_packet(conn->payload_decoder_factory, FALSE);
if (FAIL == PACKET_READ(result_packet)) {
DBG_VOID_RETURN;
}
switch (result_packet->response_code) {
case 3:
DBG_INF("fast path suceeded");
PACKET_FREE(result_packet);
DBG_VOID_RETURN;
case 4:
if (conn->vio->data->ssl || conn->unix_socket.s) {
DBG_INF("fast path failed, doing full auth via SSL");
result_packet->password = (zend_uchar *)passwd;
result_packet->password_len = passwd_len + 1;
PACKET_WRITE(result_packet);
} else {
DBG_INF("fast path failed, doing full auth without SSL");
result_packet->password_len = mysqlnd_caching_sha2_get_and_use_key(conn, auth_plugin_data, auth_plugin_data_len, &result_packet->password, passwd, passwd_len);
PACKET_WRITE(result_packet);
efree(result_packet->password);
}
PACKET_FREE(result_packet);
DBG_VOID_RETURN;
case 2:
// The server tried to send a key, which we didn't expect
// fall-through
default:
php_error_docref(NULL, E_WARNING, "Unexpected server respose while doing caching_sha2 auth: %i", result_packet->response_code);
}
PACKET_FREE(result_packet);
DBG_VOID_RETURN;
}
/* }}} */
static struct st_mysqlnd_authentication_plugin mysqlnd_caching_sha2_auth_plugin =
{
{
MYSQLND_PLUGIN_API_VERSION,
"auth_plugin_caching_sha2_password",
MYSQLND_VERSION_ID,
PHP_MYSQLND_VERSION,
"PHP License 3.01",
"Johannes Schlüter <johannes.schlueter@php.net>",
{
NULL, /* no statistics , will be filled later if there are some */
NULL, /* no statistics */
},
{
NULL /* plugin shutdown */
}
},
{/* methods */
mysqlnd_caching_sha2_get_auth_data,
mysqlnd_caching_sha2_handle_server_response
}
};
/* {{{ mysqlnd_register_builtin_authentication_plugins */
void
mysqlnd_register_builtin_authentication_plugins(void)
{
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_native_auth_plugin);
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_pam_authentication_plugin);
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_caching_sha2_auth_plugin);
#ifdef MYSQLND_HAVE_SSL
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_sha256_authentication_plugin);
#endif
+3 -20
View File
@@ -31,26 +31,9 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
unsigned int server_charset_no,
zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,
const zend_uchar * const auth_plugin_data,
const size_t auth_plugin_data_len,
char ** switch_to_auth_protocol,
size_t * switch_to_auth_protocol_len,
zend_uchar ** switch_to_auth_protocol_data,
size_t * switch_to_auth_protocol_data_len
);
enum_func_status
mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
const char * const user,
const char * const passwd,
const size_t passwd_len,
const char * const db,
const size_t db_len,
const MYSQLND_SESSION_OPTIONS * const session_options,
zend_ulong mysql_flags,
unsigned int server_charset_no,
zend_bool use_full_blown_auth_packet,
const char * const auth_protocol,
struct st_mysqlnd_authentication_plugin * auth_plugin,
const zend_uchar * const orig_auth_plugin_data,
const size_t orig_auth_plugin_data_len,
const zend_uchar * const auth_plugin_data,
const size_t auth_plugin_data_len,
char ** switch_to_auth_protocol,
+4
View File
@@ -678,9 +678,13 @@ MYSQLND_METHOD(mysqlnd_conn_data, connect)(MYSQLND_CONN_DATA * conn,
{
const MYSQLND_CSTRING scheme = { transport.s, transport.l };
/* This will be overwritten below with a copy, but we can use it during authentication */
conn->unix_socket.s = (char *)socket_or_pipe.s;
if (FAIL == conn->m->connect_handshake(conn, &scheme, &username, &password, &database, mysql_flags)) {
conn->unix_socket.s = NULL;
goto err;
}
conn->unix_socket.s = NULL;
}
{
+1
View File
@@ -631,6 +631,7 @@ enum mysqlnd_packet_type
PROT_CHG_USER_RESP_PACKET,
PROT_SHA256_PK_REQUEST_PACKET,
PROT_SHA256_PK_REQUEST_RESPONSE_PACKET,
PROT_CACHED_SHA2_RESULT_PACKET,
PROT_LAST /* should always be last */
};
+10
View File
@@ -970,6 +970,7 @@ struct st_mysqlnd_packet_chg_user_resp;
struct st_mysqlnd_packet_auth_pam;
struct st_mysqlnd_packet_sha256_pk_request;
struct st_mysqlnd_packet_sha256_pk_request_response;
struct st_mysqlnd_packet_cached_sha2_result;
typedef struct st_mysqlnd_packet_greet * (*func_mysqlnd_protocol_payload_decoder_factory__get_greet_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
typedef struct st_mysqlnd_packet_auth * (*func_mysqlnd_protocol_payload_decoder_factory__get_auth_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
@@ -986,6 +987,7 @@ typedef struct st_mysqlnd_packet_prepare_response *(*func_mysqlnd_protocol_paylo
typedef struct st_mysqlnd_packet_chg_user_resp*(*func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
typedef struct st_mysqlnd_packet_sha256_pk_request *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
typedef struct st_mysqlnd_packet_sha256_pk_request_response *(*func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
typedef struct st_mysqlnd_packet_cached_sha2_result *(*func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet)(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent);
typedef enum_func_status (*func_mysqlnd_protocol_payload_decoder_factory__send_command)(
MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory,
@@ -1043,6 +1045,7 @@ MYSQLND_CLASS_METHODS_TYPE(mysqlnd_protocol_payload_decoder_factory)
func_mysqlnd_protocol_payload_decoder_factory__get_change_user_response_packet get_change_user_response_packet;
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_packet get_sha256_pk_request_packet;
func_mysqlnd_protocol_payload_decoder_factory__get_sha256_pk_request_response_packet get_sha256_pk_request_response_packet;
func_mysqlnd_protocol_payload_decoder_factory__get_cached_sha2_result_packet get_cached_sha2_result_packet;
func_mysqlnd_protocol_payload_decoder_factory__send_command send_command;
func_mysqlnd_protocol_payload_decoder_factory__send_command_handle_response send_command_handle_response;
@@ -1355,11 +1358,18 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
const MYSQLND_PFC_DATA * const pfc_data, zend_ulong mysql_flags
);
typedef void (*func_auth_plugin__handle_server_response)(struct st_mysqlnd_authentication_plugin * self,
MYSQLND_CONN_DATA * conn,
const zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
const char * const passwd,
const size_t passwd_len);
struct st_mysqlnd_authentication_plugin
{
struct st_mysqlnd_plugin_header plugin_header;
struct {
func_auth_plugin__get_auth_data get_auth_data;
func_auth_plugin__handle_server_response handle_server_response;
} methods;
};
+111 -2
View File
@@ -2273,7 +2273,85 @@ php_mysqlnd_sha256_pk_request_response_free_mem(void * _packet, zend_bool stack_
}
/* }}} */
static
size_t php_mysqlnd_cached_sha2_result_write(void * _packet)
{
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
MYSQLND_VIO * vio = packet->header.vio;
MYSQLND_STATS * stats = packet->header.stats;
#ifndef _MSC_VER
zend_uchar buffer[MYSQLND_HEADER_SIZE + packet->password_len + 1];
#else
ALLOCA_FLAG(use_heap)
zend_uchar *buffer = do_alloca(MYSQLND_HEADER_SIZE + packet->password_len + 1, use_heap);
#endif
size_t sent;
DBG_ENTER("php_mysqlnd_cached_sha2_result_write");
if (packet->request == 1) {
int1store(buffer + MYSQLND_HEADER_SIZE, '\2');
sent = pfc->data->m.send(pfc, vio, buffer, 1, stats, error_info);
} else {
memcpy(buffer + MYSQLND_HEADER_SIZE, packet->password, packet->password_len);
sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info);
}
#ifdef _MSC_VER
free_alloca(buffer, use_heap);
#endif
DBG_RETURN(sent);
}
static enum_func_status
php_mysqlnd_cached_sha2_result_read(void * _packet)
{
MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
MYSQLND_ERROR_INFO * error_info = packet->header.error_info;
MYSQLND_PFC * pfc = packet->header.protocol_frame_codec;
MYSQLND_VIO * vio = packet->header.vio;
MYSQLND_STATS * stats = packet->header.stats;
MYSQLND_CONNECTION_STATE * connection_state = packet->header.connection_state;
zend_uchar buf[SHA256_PK_REQUEST_RESP_BUFFER_SIZE];
zend_uchar *p = buf;
const zend_uchar * const begin = buf;
DBG_ENTER("php_mysqlnd_cached_sha2_result_read");
if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, connection_state, buf, sizeof(buf), "PROT_CACHED_SHA2_RESULT_PACKET", PROT_CACHED_SHA2_RESULT_PACKET)) {
DBG_RETURN(FAIL);
}
BAIL_IF_NO_MORE_DATA;
p++;
packet->response_code = uint1korr(p);
BAIL_IF_NO_MORE_DATA;
p++;
packet->result = uint1korr(p);
BAIL_IF_NO_MORE_DATA;
DBG_RETURN(PASS);
premature_end:
DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size);
php_error_docref(NULL, E_WARNING, "SHA256_PK_REQUEST_RESPONSE packet "MYSQLND_SZ_T_SPEC" bytes shorter than expected",
p - begin - packet->header.size);
DBG_RETURN(FAIL);
}
static void
php_mysqlnd_cached_sha2_result_free_mem(void * _packet, zend_bool stack_allocation)
{
MYSQLND_PACKET_CACHED_SHA2_RESULT * p = (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet;
if (!stack_allocation) {
mnd_pefree(p, p->header.persistent);
}
}
/* }}} */
/* {{{ packet_methods */
static
mysqlnd_packet_methods packet_methods[PROT_LAST] =
@@ -2367,9 +2445,15 @@ mysqlnd_packet_methods packet_methods[PROT_LAST] =
php_mysqlnd_sha256_pk_request_response_read,
NULL, /* write */
php_mysqlnd_sha256_pk_request_response_free_mem,
} /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
}, /* PROT_SHA256_PK_REQUEST_RESPONSE_PACKET */
{
sizeof(MYSQLND_PACKET_CACHED_SHA2_RESULT),
php_mysqlnd_cached_sha2_result_read,
php_mysqlnd_cached_sha2_result_write,
php_mysqlnd_cached_sha2_result_free_mem
} /* PROT_CACHED_SHA2_RESULT_PACKET */
};
/* }}} */
/* }}} */
/* {{{ mysqlnd_protocol::get_greet_packet */
@@ -2718,6 +2802,30 @@ MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet)(MYSQLND_
}
/* }}} */
/* {{{ mysqlnd_protocol::init_cached_sha2_result_packet */
static struct st_mysqlnd_packet_cached_sha2_result *
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet)
(MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * const factory, const zend_bool persistent)
{
struct st_mysqlnd_packet_cached_sha2_result * packet = mnd_pecalloc(1, packet_methods[PROT_CACHED_SHA2_RESULT_PACKET].struct_size, persistent);
DBG_ENTER("mysqlnd_protocol::init_cached_sha2_result_packet");
if (packet) {
memset(packet, 0, sizeof(*packet));
packet->header.m = &packet_methods[PROT_CACHED_SHA2_RESULT_PACKET];
packet->header.factory = factory;
packet->header.protocol_frame_codec = factory->conn->protocol_frame_codec;
packet->header.vio = factory->conn->vio;
packet->header.stats = factory->conn->stats;
packet->header.error_info = factory->conn->error_info;
packet->header.connection_state = &factory->conn->state;
packet->header.persistent = persistent;
}
DBG_RETURN(packet);
}
/* }}} */
/* {{{ mysqlnd_protocol::send_command */
static enum_func_status
@@ -2948,6 +3056,7 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_protocol_payload_decoder_factory)
MYSQLND_METHOD(mysqlnd_protocol, get_change_user_response_packet),
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_packet),
MYSQLND_METHOD(mysqlnd_protocol, get_sha256_pk_request_response_packet),
MYSQLND_METHOD(mysqlnd_protocol, get_cached_sha2_result_packet),
MYSQLND_METHOD(mysqlnd_protocol, send_command),
MYSQLND_METHOD(mysqlnd_protocol, send_command_handle_response),
+10
View File
@@ -292,6 +292,16 @@ typedef struct st_mysqlnd_packet_sha256_pk_request_response {
size_t public_key_len;
} MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE;
typedef struct st_mysqlnd_packet_cached_sha2_result {
MYSQLND_PACKET_HEADER header;
uint8_t response_code;
uint8_t result;
uint8_t request;
zend_uchar * password;
size_t password_len;
} MYSQLND_PACKET_CACHED_SHA2_RESULT;
zend_ulong php_mysqlnd_net_field_length(const zend_uchar **packet);
zend_uchar * php_mysqlnd_net_store_length(zend_uchar *packet, const uint64_t length);
+4 -1
View File
@@ -155,6 +155,7 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
case ZEND_SEND_REF:
case ZEND_SEND_VAR_NO_REF:
case ZEND_SEND_VAR_NO_REF_EX:
case ZEND_SEND_USER:
if (call_info) {
uint32_t num = opline->op2.num;
@@ -165,9 +166,11 @@ int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_f
}
break;
case ZEND_SEND_ARRAY:
case ZEND_SEND_USER:
case ZEND_SEND_UNPACK:
/* TODO: set info about var_arg call ??? */
if (call_info) {
call_info->num_args = -1;
}
break;
}
opline++;
+6 -4
View File
@@ -16,8 +16,6 @@
+----------------------------------------------------------------------+
*/
/* $Id:$ */
#include "php.h"
#include "zend_compile.h"
#include "zend_extensions.h"
@@ -79,9 +77,11 @@ static uint32_t zend_strlen_info(const zend_call_info *call_info, const zend_ssa
tmp |= MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
}
return tmp;
} else {
} else if (call_info->num_args != -1) {
/* warning, and returns NULL */
return FUNC_MAY_WARN | MAY_BE_NULL;
} else {
return MAY_BE_LONG | FUNC_MAY_WARN | MAY_BE_NULL;
}
}
@@ -90,9 +90,11 @@ static uint32_t zend_dechex_info(const zend_call_info *call_info, const zend_ssa
if (call_info->caller_init_opline->extended_value == (uint32_t)call_info->num_args &&
call_info->num_args == 1) {
return MAY_BE_RC1 | MAY_BE_STRING;
} else {
} else if (call_info->num_args != -1) {
/* warning, and returns NULL */
return FUNC_MAY_WARN | MAY_BE_NULL;
} else {
return FUNC_MAY_WARN | MAY_BE_RC1 | MAY_BE_STRING | MAY_BE_NULL;
}
}
+1 -1
View File
@@ -2480,7 +2480,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
if (opline->extended_value == ZEND_ASSIGN_DIM) {
if (opline->op1_type == IS_CV) {
orig = assign_dim_result_type(orig, OP2_INFO(), tmp, opline->op1_type);
orig = assign_dim_result_type(orig, OP2_INFO(), tmp, opline->op2_type);
UPDATE_SSA_TYPE(orig, ssa_ops[i].op1_def);
COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
}
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #76477 (Opcache causes empty return value)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
testString();
function testString()
{
$token = "ABC";
$lengthBytes = strlenb($token);
var_dump($lengthBytes == 0);
}
function strlenb() { return call_user_func_array("strlen", func_get_args()); }
?>
--EXPECT--
bool(false)
+25 -16
View File
@@ -9,28 +9,33 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
<?php
echo "Creating private key\n";
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
$privkey = openssl_pkey_new($conf);
if ($privkey === false)
die("failed to create private key");
if ($privkey === false) {
die("failed to create private key");
}
$passphrase = "banana";
$key_file_name = tempnam(sys_get_temp_dir(), "ssl");
if ($key_file_name === false)
die("failed to get a temporary filename!");
$key_file_name = __DIR__ . '/001-tmp.key';
if ($key_file_name === false) {
die("failed to get a temporary filename!");
}
echo "Export key to file\n";
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
if (!openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf)) {
die("failed to export to file $key_file_name");
}
var_dump(is_resource($privkey));
echo "Load key from file - array syntax\n";
$loaded_key = openssl_pkey_get_private(array("file://$key_file_name", $passphrase));
if ($loaded_key === false)
die("failed to load key using array syntax");
if ($loaded_key === false) {
die("failed to load key using array syntax");
}
openssl_pkey_free($loaded_key);
@@ -38,8 +43,9 @@ echo "Load key using direct syntax\n";
$loaded_key = openssl_pkey_get_private("file://$key_file_name", $passphrase);
if ($loaded_key === false)
die("failed to load key using direct syntax");
if ($loaded_key === false) {
die("failed to load key using direct syntax");
}
openssl_pkey_free($loaded_key);
@@ -48,15 +54,13 @@ echo "Load key manually and use string syntax\n";
$key_content = file_get_contents($key_file_name);
$loaded_key = openssl_pkey_get_private($key_content, $passphrase);
if ($loaded_key === false)
die("failed to load key using string syntax");
if ($loaded_key === false) {
die("failed to load key using string syntax");
}
openssl_pkey_free($loaded_key);
echo "OK!\n";
@unlink($key_file_name);
?>
--EXPECT--
Creating private key
@@ -66,3 +70,8 @@ Load key from file - array syntax
Load key using direct syntax
Load key manually and use string syntax
OK!
--CLEAN--
<?php
$key_file_name = __DIR__ . DIRECTORY_SEPARATOR . '001-tmp.key';
@unlink($key_file_name);
?>
+1 -2
View File
@@ -2,8 +2,7 @@
Bug #28382 (openssl_x509_parse extensions support)
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (OPENSSL_VERSION_NUMBER<0x009070af) die("skip");
if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
+10 -11
View File
@@ -3,22 +3,21 @@ Bug #36732 (add support for req_extensions in openss_csr_new and sign)
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
?>
--FILE--
<?php
$configargs = array(
"req_extensions" => "v3_req",
"x509_extensions" => "usr_cert",
"config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
"req_extensions" => "v3_req",
"x509_extensions" => "usr_cert",
"config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
);
$dn = array(
"countryName" => "GB",
"stateOrProvinceName" => "Berkshire",
"localityName" => "Newbury",
"organizationName" => "My Company Ltd",
"commonName" => "Demo Cert"
"countryName" => "GB",
"stateOrProvinceName" => "Berkshire",
"localityName" => "Newbury",
"organizationName" => "My Company Ltd",
"commonName" => "Demo Cert"
);
$key = openssl_pkey_new();
@@ -29,11 +28,11 @@ $str = '';
openssl_csr_export($csr, $str, false);
if (strpos($str, 'Requested Extensions:')) {
echo "Ok\n";
echo "Ok\n";
}
openssl_x509_export($crt, $str, false);
if (strpos($str, 'X509v3 extensions:')) {
echo "Ok\n";
echo "Ok\n";
}
?>
--EXPECTF--
+3 -5
View File
@@ -3,7 +3,6 @@ openssl_sign/verify: accept different algos
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
?>
--FILE--
<?php
@@ -15,19 +14,18 @@ $priv_key = file_get_contents($file_key);
$priv_key_id = openssl_get_privatekey($priv_key);
$pub_key = file_get_contents($file_pub);
$pub_key_id = openssl_get_publickey($pub_key);
$data = "some custom data";
if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) {
echo "openssl_sign failed.";
echo "openssl_sign failed.";
}
$ok = openssl_verify($data, $signature, $pub_key_id, OPENSSL_ALGO_MD5);
if ($ok == 1) {
echo "Ok";
echo "Ok";
} elseif ($ok == 0) {
echo "openssl_verify failed.";
echo "openssl_verify failed.";
}
+3 -3
View File
@@ -11,9 +11,9 @@ $signature = '';
$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
class test {
function __toString() {
return "test object";
}
function __toString() {
return "test object";
}
}
$t = new test;
+3 -3
View File
@@ -8,9 +8,9 @@ if (!extension_loaded("openssl")) die("skip");
<?php
$cert = false;
class test {
function __toString() {
return "test object";
}
function __toString() {
return "test object";
}
}
$t = new test;
+3 -3
View File
@@ -9,9 +9,9 @@ if (!extension_loaded("openssl")) die("skip");
$dir = dirname(__FILE__);
$certs = array('bug39217cert2.txt', 'bug39217cert1.txt');
foreach($certs as $cert) {
$res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
print_r($res['serialNumber']);
echo "\n";
$res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
print_r($res['serialNumber']);
echo "\n";
}
?>
--EXPECTF--
-1
View File
@@ -3,7 +3,6 @@
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip, openssl required");
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
?>
--FILE--
<?php
+2 -1
View File
@@ -4,7 +4,7 @@
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip openssl version too low");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -38,5 +38,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
Sending bug 46127
+2 -1
View File
@@ -4,7 +4,7 @@ Bug #48182: ssl handshake fails during asynchronous socket connection
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip openssl version too low");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -44,6 +44,7 @@ echo "Running bug48182\n";
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
Running bug48182
Sending bug48182
+2
View File
@@ -4,6 +4,7 @@ Bug #54992: Stream not closed and error not returned when SSL CN_match fails
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -36,6 +37,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
Warning: stream_socket_client(): Peer certificate CN=`bug54992.local' did not match expected CN=`buga_buga' in %s on line %d
+6 -6
View File
@@ -6,13 +6,13 @@ Bug #55259 (openssl extension does not get the DH parameters from DH key resourc
<?php
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
'7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array( 'p' => $phex, 'g' => '2' );
$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => $phex, 'g' => '2' )));
'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
'7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array('p' => $phex, 'g' => '2');
$dh = openssl_pkey_new(array('dh'=> array('p' => $phex, 'g' => '2')));
var_dump($dh);
$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => hex2bin($phex), 'g' => '2' )));
$dh = openssl_pkey_new(array('dh'=> array( 'p' => hex2bin($phex), 'g' => '2')));
$details = openssl_pkey_get_details($dh);
var_dump(bin2hex($details['dh']['p']));
var_dump($details['dh']['g']);
+31 -15
View File
@@ -1,28 +1,43 @@
--TEST--
Bug #55646: textual input in openssl_csr_new() is not expected in UTF-8
--SKIPIF--
<?php
if (!function_exists('openssl_csr_new'))
die('skip no openssl extension');
<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
function stringAsHex($string){$unpacked = unpack("H*", $string);return implode(" ", str_split($unpacked[1],2));}
$config = array("digest_alg" => "sha1","x509_extensions" => "v3_ca","req_extensions" => "v3_req","private_key_bits" => 2048,"private_key_type" => OPENSSL_KEYTYPE_RSA,"encrypt_key" => false,);
function stringAsHex($string) {
$unpacked = unpack("H*", $string);
return implode(" ", str_split($unpacked[1],2));
}
$config = array(
"digest_alg" => "sha1",
"x509_extensions" => "v3_ca",
"req_extensions" => "v3_req",
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
"encrypt_key" => false,
);
$csr_info = array(
"countryName" => "US",
"stateOrProvinceName" => "Utah",
"localityName" => "Lindon",
"organizationName" => "Chinese",
"organizationalUnitName" => "IT \xe4\xba\x92",
"commonName" => "www.example.com",);
"countryName" => "US",
"stateOrProvinceName" => "Utah",
"localityName" => "Lindon",
"organizationName" => "Chinese",
"organizationalUnitName" => "IT \xe4\xba\x92",
"commonName" => "www.example.com",
);
$private = openssl_pkey_new($config);
while (openssl_error_string()) {}
$csr_res = openssl_csr_new($csr_info, $private,
['config' => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf"]);
$csr_res = openssl_csr_new(
$csr_info,
$private,
['config' => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf"]
);
if (!$csr_res) {
while ($e = openssl_error_string()) { $err = $e; }
die("Failed; last error: $err");
while ($e = openssl_error_string()) {
$err = $e;
}
die("Failed; last error: $err");
}
openssl_csr_export($csr_res, $csr);
$output = openssl_csr_get_subject($csr);
@@ -31,6 +46,7 @@ echo "A: ".$csr_info["organizationalUnitName"]."\n";
echo "B: ".stringAsHex($csr_info["organizationalUnitName"])."\n";
echo "C: ".$output['OU']."\n";
echo "D: ".stringAsHex($output['OU'])."\n";
?>
--EXPECT--
A: IT 互
B: 49 54 20 e4 ba 92
+3 -1
View File
@@ -12,7 +12,9 @@ $data = <<<DATA
Please verify me
DATA;
$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptlAODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptl' .
'AODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2' .
'LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
$key = openssl_get_publickey($cert);
var_dump(openssl_get_publickey($key));
+2
View File
@@ -4,6 +4,7 @@ Bug #65538: SSL context "cafile" supports stream wrappers
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -48,5 +49,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECT--
string(12) "Hello World!"
+6 -6
View File
@@ -8,12 +8,12 @@ if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
--FILE--
<?php
$clientCtx = stream_context_create(['ssl' => [
// We don't get any ca list from php.net but it does not matter as we
// care about the fact that the external stream is not allowed.
// We can't use http://curl.haxx.se/ca/cacert.pem for this test
// as it is redirected to https which means the test would depend
// on system cafile when opening stream.
'cafile' => 'http://www.php.net',
// We don't get any ca list from php.net but it does not matter as we
// care about the fact that the external stream is not allowed.
// We can't use http://curl.haxx.se/ca/cacert.pem for this test
// as it is redirected to https which means the test would depend
// on system cafile when opening stream.
'cafile' => 'http://www.php.net',
]]);
file_get_contents('https://github.com', false, $clientCtx);
?>
+2
View File
@@ -5,6 +5,7 @@ Bug #65538: SSL context "cafile" supports phar wrapper
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!extension_loaded("phar")) die("skip phar not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -49,5 +50,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
string(12) "Hello World!"
+1 -3
View File
@@ -1,9 +1,7 @@
--TEST--
Bug #65689 (GeneralizedTime format parsing)
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
$crt = substr(__FILE__, 0, -4).'.crt';
+2
View File
@@ -4,6 +4,7 @@ Bug #65729: CN_match gives false positive when wildcard is used
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -42,6 +43,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match expected CN=`foo.test.com.sg' in %s on line %d
+2
View File
@@ -4,6 +4,7 @@ Bug #66501: EC private key support in openssl_sign
<?php
if (!extension_loaded("openssl")) die("skip");
if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
?>
--FILE--
<?php
$pkey = 'ASN1 OID: prime256v1
@@ -18,5 +19,6 @@ sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
$key = openssl_pkey_get_private($pkey);
$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
var_dump($res);
?>
--EXPECTF--
bool(true)
+2 -2
View File
@@ -1,8 +1,7 @@
--TEST--
Bug #67403: Add signatureType to openssl_x509_parse
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
$r = openssl_x509_parse(file_get_contents(__DIR__.'/bug64802.pem'));
@@ -14,6 +13,7 @@ $r = openssl_x509_parse(file_get_contents(__DIR__.'/bug37820cert.pem'));
var_dump($r['signatureTypeSN']);
var_dump($r['signatureTypeLN']);
var_dump($r['signatureTypeNID']);
?>
--EXPECTF--
string(8) "RSA-SHA1"
string(21) "sha1WithRSAEncryption"
+2
View File
@@ -4,6 +4,7 @@ Bug #68265: SAN match fails with trailing DNS dot
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -36,6 +37,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
resource(%d) of type (stream)
+2
View File
@@ -4,6 +4,7 @@ Bug #68879: Match IP address fields in subjectAltName checks
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -36,6 +37,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
resource(%d) of type (stream)
+2
View File
@@ -4,6 +4,7 @@ Bug #68920: peer_fingerprint input checks should be strict
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -47,6 +48,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
Warning: stream_socket_client(): Expected peer fingerprint must be a string or an array in %s on line %d
+2
View File
@@ -4,6 +4,7 @@ Bug #69215: Crypto servers should send client CA list
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -43,6 +44,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--EXPECTF--
resource(%d) of type (stream)
+2 -4
View File
@@ -2,11 +2,9 @@
Request #70438: Add IV parameter for openssl_seal and openssl_open
--SKIPIF--
<?php
if (!extension_loaded("openssl")) {
print "skip";
}
if (!extension_loaded("openssl")) print "skip";
if (!in_array('AES-128-CBC', openssl_get_cipher_methods(true))) {
print "skip";
print "skip";
}
?>
--FILE--
+10 -6
View File
@@ -7,12 +7,16 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
--FILE--
<?php
function test($envkey) {
$publicKey = "file://" . dirname(__FILE__) . "/public.key";
$privateKey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
openssl_public_encrypt($envkey, $envelope, $publicKey);
$sealed = openssl_encrypt('plaintext', 'rc4', $envkey, OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY);
openssl_open($sealed, $output, $envelope, $privateKey, 'rc4');
var_dump($output === 'plaintext');
$publicKey = "file://" . dirname(__FILE__) . "/public.key";
$privateKey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
openssl_public_encrypt($envkey, $envelope, $publicKey);
$sealed = openssl_encrypt(
'plaintext',
'rc4', $envkey,
OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
);
openssl_open($sealed, $output, $envelope, $privateKey, 'rc4');
var_dump($output === 'plaintext');
}
// works - key of 16 bytes
+46 -46
View File
@@ -8,56 +8,56 @@ if (!function_exists("proc_open")) die("skip no proc_open");
--FILE--
<?php
$serverCode = <<<'CODE'
$context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
$context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
$fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
phpt_notify();
$conn = stream_socket_accept($fp);
$total = 100000;
$result = fread($conn, $total);
stream_set_blocking($conn, false);
usleep(50000);
$read = [$conn];
while (stream_select($read, $write, $except, 1)) {
$result = fread($conn, 100000);
if (!$result) {
break;
}
$total += strlen($result);
if ($total >= 4000000) {
break;
}
}
phpt_wait();
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
$fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
phpt_notify();
$conn = stream_socket_accept($fp);
$total = 100000;
$result = fread($conn, $total);
stream_set_blocking($conn, false);
usleep(50000);
$read = [$conn];
while (stream_select($read, $write, $except, 1)) {
$result = fread($conn, 100000);
if (!$result) {
break;
}
$total += strlen($result);
if ($total >= 4000000) {
break;
}
}
phpt_wait();
CODE;
$clientCode = <<<'CODE'
$context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
phpt_wait();
$fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
stream_set_blocking($fp, false);
function blocking_fwrite($fp, $buf) {
$write = [$fp];
$total = 0;
while (stream_select($read, $write, $except, 1)) {
$result = fwrite($fp, $buf);
if (!$result) {
break;
}
$total += $result;
if ($total >= strlen($buf)) {
return $total;
}
$buf = substr($buf, $total);
}
}
$str1 = str_repeat("a", 4000000);
blocking_fwrite($fp, $str1);
phpt_notify();
echo "done";
$context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
phpt_wait();
$fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
stream_set_blocking($fp, false);
function blocking_fwrite($fp, $buf) {
$write = [$fp];
$total = 0;
while (stream_select($read, $write, $except, 1)) {
$result = fwrite($fp, $buf);
if (!$result) {
break;
}
$total += $result;
if ($total >= strlen($buf)) {
return $total;
}
$buf = substr($buf, $total);
}
}
$str1 = str_repeat("a", 4000000);
blocking_fwrite($fp, $str1);
phpt_notify();
echo "done";
CODE;
include 'ServerClientTestCase.inc';
+8 -8
View File
@@ -5,18 +5,18 @@ Bug #72336 (openssl_pkey_new does not fail for invalid DSA params)
--FILE--
<?php
$p = '00f8000ae45b2dacb47dd977d58b719d097bdf07cb2c17660ad898518c08' .
'1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
'24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
'1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
'996def90090303b7ad';
'1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
'24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
'1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
'996def90090303b7ad';
$q = '009b3734fc9f7a4a9d6437ec314e0a78c2889af64b';
$g = '00b320300a0bc55b8f0ec6edc218e2185250f38fbb8291db8a89227f6e41' .
'00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
'4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
'b81747c4c447a941f3';
'00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
'4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
'b81747c4c447a941f3';
var_dump(openssl_pkey_new(array('dsa' => array('p' => $p, 'q' => $q, 'g' => $g))));
?>
+20 -2
View File
@@ -6,8 +6,26 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
?>
--FILE--
<?php
var_dump(bin2hex(openssl_encrypt("this is a test string","bf-ecb","12345678", OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY)));
var_dump(bin2hex(openssl_encrypt("this is a test string","bf-ecb","1234567812345678" , OPENSSL_RAW_DATA)));
var_dump(
bin2hex(
openssl_encrypt(
"this is a test string",
"bf-ecb",
"12345678",
OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
)
)
);
var_dump(
bin2hex(
openssl_encrypt(
"this is a test string",
"bf-ecb",
"1234567812345678",
OPENSSL_RAW_DATA
)
)
);
?>
--EXPECT--
string(48) "e3214d1b16e574828c8a3e222202dde81afd1ad2cb165ab3"
+19 -18
View File
@@ -3,39 +3,40 @@ Bug #73072: Invalid path SNI_server_certs causes segfault
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
$ctx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/domain1.pem',
'SNI_server_certs' => [
"domain1.com" => __DIR__ . "/sni_server_domain1.pem",
"domain2.com" => __DIR__ . "/not_existing.pem",
]
]]);
$ctx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/domain1.pem',
'SNI_server_certs' => [
"domain1.com" => __DIR__ . "/sni_server_domain1.pem",
"domain2.com" => __DIR__ . "/not_existing.pem",
]
]]);
$server = stream_socket_server('tls://127.0.0.1:64322', $errno, $errstr, $flags, $ctx);
phpt_notify();
@stream_socket_accept($server, 3);
// if there is a segfault, this won't be called
fwrite(STDERR, "done\n");
@stream_socket_accept($server, 3);
// if there is a segfault, this won't be called
fwrite(STDERR, "done\n");
CODE;
$clientCode = <<<'CODE'
$flags = STREAM_CLIENT_CONNECT;
$ctxArr = [
'cafile' => __DIR__ . '/sni_server_ca.pem',
'capture_peer_cert' => true
];
$ctxArr = [
'cafile' => __DIR__ . '/sni_server_ca.pem',
'capture_peer_cert' => true
];
phpt_wait();
$ctxArr['peer_name'] = 'domain1.com';
$ctx = stream_context_create(['ssl' => $ctxArr]);
@stream_socket_client("tls://127.0.0.1:64322", $errno, $errstr, 1, $flags, $ctx);
$ctx = stream_context_create(['ssl' => $ctxArr]);
@stream_socket_client("tls://127.0.0.1:64322", $errno, $errstr, 1, $flags, $ctx);
CODE;
include 'ServerClientTestCase.inc';
+4 -6
View File
@@ -1,15 +1,13 @@
--TEST--
Bug #73478: openssl_pkey_new() generates wrong pub/priv keys with Diffie Hellman
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
?>
<?php if (!extension_loaded("openssl")) die("skip openssl not loaded"); ?>
--FILE--
<?php
$details = [
'p' => base64_decode('3Pk6C4g5cuwOGZiaxaLOMQ4dN3F+jZVxu3Yjcxhm5h73Wi4niYsFf5iRwuJ6Y5w/KbYIFFgc07LKOYbSaDcFV31FwuflLcgcehcYduXOp0sUSL/frxiCjv0lGfFOReOCZjSvGUnltTXMgppIO4p2Ij5dSQolfwW9/xby+yLFg6s='),
'g' => base64_decode('Ag=='),
'priv_key' => base64_decode('jUdcV++P/m7oUodWiqKqKXZVenHRuj92Ig6Fmzs7QlqVdUc5mNBxmEWjug+ObffanPpOeab/LyXwjNMzevtBz3tW4oROau++9EIMJVVQr8fW9zdYBJcYieC5l4t8nRj5/Uu/Z0G2rWVLBleSi28mqqNEvnUs7uxYxrar69lwQYs=')
'p' => base64_decode('3Pk6C4g5cuwOGZiaxaLOMQ4dN3F+jZVxu3Yjcxhm5h73Wi4niYsFf5iRwuJ6Y5w/KbYIFFgc07LKOYbSaDcFV31FwuflLcgcehcYduXOp0sUSL/frxiCjv0lGfFOReOCZjSvGUnltTXMgppIO4p2Ij5dSQolfwW9/xby+yLFg6s='),
'g' => base64_decode('Ag=='),
'priv_key' => base64_decode('jUdcV++P/m7oUodWiqKqKXZVenHRuj92Ig6Fmzs7QlqVdUc5mNBxmEWjug+ObffanPpOeab/LyXwjNMzevtBz3tW4oROau++9EIMJVVQr8fW9zdYBJcYieC5l4t8nRj5/Uu/Z0G2rWVLBleSi28mqqNEvnUs7uxYxrar69lwQYs=')
];
$opensslKeyResource = openssl_pkey_new(['dh' => $details]);
+11 -11
View File
@@ -10,18 +10,18 @@ $passwords = ["abc\x00defghijkl", "abcdefghikjl"];
$conf = ['config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'];
foreach($passwords as $password) {
$key = openssl_pkey_new($conf);
$key = openssl_pkey_new($conf);
if (openssl_pkey_export($key, $privatePEM, $password, $conf) === false) {
echo "Failed to encrypt.\n";
} else {
echo "Encrypted!\n";
}
if (openssl_pkey_get_private($privatePEM, $password) === false) {
echo "Failed to decrypt.\n";
} else {
echo "Decrypted!\n";
}
if (openssl_pkey_export($key, $privatePEM, $password, $conf) === false) {
echo "Failed to encrypt.\n";
} else {
echo "Encrypted!\n";
}
if (openssl_pkey_get_private($privatePEM, $password) === false) {
echo "Failed to decrypt.\n";
} else {
echo "Decrypted!\n";
}
}
?>
--EXPECT--
+3 -3
View File
@@ -7,9 +7,9 @@ if (!extension_loaded("openssl")) die("skip");
--FILE--
<?php
function test($p12_contents, $password) {
openssl_pkcs12_read($p12_contents, $cert_data, $password);
openssl_error_string();
var_dump(count($cert_data['extracerts']));
openssl_pkcs12_read($p12_contents, $cert_data, $password);
openssl_error_string();
var_dump(count($cert_data['extracerts']));
}
$p12_base64 = 'MIIW+QIBAzCCFr8GCSqGSIb3DQEHAaCCFrAEghasMIIWqDCCEV8GCSqGSIb3DQEHBqCCEVAwghFMAgEAMIIRRQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIQOfCxIAgGIICAggAgIIRGFTkvHpJjCtFjukXYVlhyOIqKiS8Zvg84dX244hhI0S51Uyn/tlXM2GD/3hDNVxcVKwP/fKN21lEkoXoK4h2/5BY3qCdZa3Ef3vk44b/+FGCUAqvsOo1ZjD2P/sBGhLu3aFnQ6ktUXlKV4cnqhlF62AqY4e5efQzmJXn+gI8cSNI5c+qQ0RQgGoRY4nJfvMSZG0/DAkirjGikU/2TZd8LwLkxVUBYbF5/T0fNtA3o99+4tF+8ZRv6ArYjplRdwcBbMbzGhn3ytCq6cmVid9iLjwHJFmvAPXKbmu0Lh5eRRznX9gBWlzGd08Q/ch0MW2ehZTu1A2VrNWl+FKWSk8l0MlSoTPJFutFiejRvMr6VzbQItyJ/mtrNa9b1Hicgoj9HaBB6arx4wKORlbSOxFNOWdTCUhFdqthK5o7b9i/owyVgyY0s7BFEZChc0zGpRq7BLrynY79b+pHKzpil9isuisp1++piHZx9Y/bpC7OP5FlYF9+3TJL0EpEFQD8FqEoqcMFRxIDWGpCQiLGcmL14OH1JKSgOJEAgogsIF/KQhvWeKcUSJlai+0sskl8mOrCt2EJwuRvzmemuzebYN3JMOiBXKONYR0yU8AeAyNTgSBimWhACtikUyfpgZXlIeXyFMvj9fmd0I/zqjaW4upqrCudCOj/CWx7+e+8udfJxI7agWwrZMf1BEkOhRFOHOIuV+IEbaoMP6vVrGlhK71oN+gnoes5ivohpFDJWSZ3+1fMh56vfNynuM2wLJO7FTROPla+4ug33V/2ubGpoIyXn2lTSbuXaYDfsXMa1inakOMW9Q+PHGdIjZrwQU/u9Q2H0IlwFd4uQojZo15SRf4xh5FOuUrrfGRAnp1mWHALTBqd2VnkgqtBl8rXZXqA+CiEhEDhTAQmvf+wCKd3FklrhV+p65YcfRK9OJv5aFQM1/+WbJozF4/Wi5j4rtIDPrgMMEflOyoZIxGxDOaklyAvaasRU2TT8E2LIEvGKOzlrhIZqWyRESjgXdh6l0UBMaVAidIZ0JLf+8fqSZ0Zia5iAaJpm82MQr/PVXC4lqqxDlHhefwM3OKfZVkfAw0a2eePM5YkIxAgMpAstBt32UIixlj/5l4MwqzP8Reb4MsV6Fph2e14vsV1diLBaJI3hrU5UBVEDWV0GSbwdhZLtdubSaBHcv5v9aZ1cdFKL6d2rHksW9ooNnh/ljPxmVlfHbb8sPYDXmLmBNJdNV1gQouhKKrt0ov1J9+sqE53D9+9dfRwf/myYlnyNgqU4vNMrZI2flyugkYoUxIC8stVF46zfL5QkSg3GqdLQC4gpeJ0WdTSyOBaOgUvqGdSARb5bXm1VXF5IxVg1B4v+puNIHS9yuphXUJvw6xWWPjbQAllDrPjMqAbxmF465vFyQP0qEvMjRD+SaFIgW4KjMqfteKo4MgqKTRF4UP9r0HkwRErOznxWDfSxzXYztY6U72NdifN9IIFiBikKQqZvfvaN+1jukehSRpGQHQB5OxeeKThJZJGiUC5Fgvl7lPb6Djx8Rfba/FJvVsR2KFS64sArtUKmC6LcJxEY9WcsiJTHek817zvYej7FD1NxuttNp+ue9ArOoIhOEf08HIOu3d2yjeRlN5CJ/jIdKYlZW6m6Ap1M+OUHhJTF73K6lKKD9Diwa3s6FoqOwtZF4uYwHnCG218BMY8GgEVD73x5KjDOP02Y6EakZNp/9QIqQT4WkMWXMaqAPADtoh8X1FJLlnvs2Ko+hLlPxuPaIA4KvSuuocnWx/6HJbdqHUS/Se+JJo0Igt4Svax1R2kvoIPuQmPmHJ6l7CeZZiNbe+baFSx+V6g/6AgHUsUOSqGvUIEns1uIE9CQ8w0G3yLVonjERJLrdj+em3Pt7fxrxoOI4nwjplX0wJk0rkQREiS8ULQDHueptUcxJxMKpugAc4CL+BsHohkhm4kpOEmviKDwzxytQhDp2Fj2PRO9kqyNrNfzNGCN5709blEIVYTtonELI2vR5Ap+O2pH+AlqrnHWgeOYAKAyWT13xCNRsGNdv2sCDDiHqxq01IBzYhPvoWzECOmGbJRRSGOVzYCJJpVjl0NNKv9ucmftSQRjm6xgLIqv1xrehDYuJ/IMsYQ5QwXBGxy7nkeRg+onWzA0ZnEWgzLs3T/Pj7z/TPQWiN03MH24RvQXTWBqp9iBwXpsCZVgUIM/VLCQJn0/V5gfRy9Ne0rk2/tHMnzGHvll5Spoy6WkxSfQ8c8CjTilaoPWV6fOcNB2Z6ZuTqX0fbnxcEAu2fOK7e6ryGipEgaxrdiopDTlgPEFMdGUETbUh0ACrv/gNsS+m5MtNisWnhxFEiXrsWoWIgW/6TgRJGo+l52bh/xxC0bwHbYuHK62sxDVeXpBOnA4VE+WckWsC0CKYJvv4vfTbLI46fyd3lnlcSuHYM4SdbND7THNeK+KB5GyuUFLgAhhtZv8ceEo63IOlBUUy1NlWnr0cbidxvVnOugFLExCV5QGr+xbrssIibQxs8AfOBK8Cxh83IlzJVe7dX1mZVG1c6AM6SKSC6F0LBOeNEvcLlz4PBMIciubCE6ecdXCzJYFbj9ERDlnrZMKrnATRMsgCPaWdyYgQwkDuCj5uqf4aiKLzA61918hLY3MB7mSyJcCkXDYKr11Br0YSAdu8uG6IjpiUQS2PFz8E8XHBmO/uobhEuCPR2LnUv+xFN8zoPQlA5ueRz1yBF8L+CsvDGp/N3KF26ETWlvmnEdt7foE+o/J7aG6xO/CNB+/+yGbVPZRVAntZec9nbqlQ55qECnWtQNnShW7+3RSGamWeTtE2DyRSfd/62JkPNEY25jbBUIkMNtKolA5dbYa+u50S3lvakMmvQvzcSC3PONajKHgk4mBn3qf9X2uM5RDL83M7489r6JPcxTnNK27rQoxplkxLiN8HuB+AB5hp82WoyvLydR4hoBnJPIYKMcmEfIR+SgLoCyNIQLjzk5Iyk1ZwdwsjyNPXi1/HHZq8+NhoTCupjGfWgXghoz89MTYAjpMvOlES2rgFuCdphSc8Nd1uQtZx4CLMOU0gut0PI81ePBBI0iG74PWMEcp5HlHHY/hPTaRkBFLYkq9CWmJc1PfjiCWf3pwRmT7dUnmcptynexIMOZt2Nd76jc+g7k5MmEK+Qdz7/c1un4sVLquxdY6nUY/znLz+2zC/OTSsF39+rak3p8TXR0kBNsHl8UTioi4CGhCMsWsQy9me25TDHzbtIvBPVp9xXufsOe2wqPLjq3iNEGXTsagx3sLvl7BJ6WW/YMC7sUpjx1Ai3zkqViW0jQB+BzMZjfYM/8Yj31EEE+WssxY+NfitBgZzeMGGjNOAKp7XN0glwhuo1G2/APyU/Zopx3gMYj5OExgkZ7kvK++7+NlPmE+8AEuZ/uf30TtKwvRXOSvAMqqm26kb/WQPCj1xFQ0AEDl0Sbyfgk1E51Cd/ujL0t32FNkSoE8pe3IaTnwAnW7NHTZ/RByh2nsr0ThfFg4pFFuSD4dzU8r2J/4YJG3B06eyyTRLoyLBQwzwIgzGBAU8USdD8CXlA8SkfBbF39500ZRNcMIt6wdQa1CHAUHDLPw9JF9Q0FwCspgkjc9+lTRZMtumN5ChgypSkUB1dzLV2hqeQzDngVjcco/CoxM0Svm8gGrM9qobCTGzGF8/wZljv1yRiqu6HGFYWDAQ/p+wWx6ScstxEAB+5R5GrOedgd4zPXi2NMvyeN+ACFRBSPkhXIXpLZADvBi/WQMYbHia1wL8WUrSGQuB4P46cWGyseaxl//6GQ9IoGbK3XuLIPeE+BpPLB0H9LSLY+5f3qOEkKzCCW0z+68ZMlanlsThLKhqk8yrmJhV4788Tr7BC3eGbAie1urrrfUR613Jsp5peLSJuWQHdWCE/fdKgoSsRJ+DYkPoyS1YNz4BF4yz1Oem9Mti7gvgTQNX6g6PCu0rN8B6HIgY9TvWy5OCoZjJKasb+OgTMld7TJDnyK5/JcvDKHNVwcpK74lxcVX7IRorP/eh4IQ1+P/Gh06A62RHp2dEh/fNuKeCiRM2vGH0gdIN/Ca6MX8MqazgJq2EONyWiqRoGPqqZpAVTa8l5kgGvxQE/CQ4x0uAxwresRRTUZ+fJEanAhTWYgI5mRoEkG88UZjyCWmCnpNMQRYHoq7iY0So5qUdkHvpUA48cNMyztPEEHsUyWC36ZCyNsQN26FoJrG9TqXedBrhcki0sPOWugvKtGsdTT354wJTDe5OCo0AH3eFo/auuuAk/DF7yu614UCmKtXHYJ61GpIkjBu9WrPAIJhndMqfGMD/yU4UMEPHyojqHvU0BSgv1k76vI3K2lqERkaNYFfzRNj+e7k+NNos8w7XCzilWBL2ePB3pG5xfivcH4tYFm0FbnIkSz52VIy+PTiK7QQuBPDRTcn1k41+9vxQxRWpsqM/NP+4gqGozNyANXLQ64Y+QXSnWrD+xMjL/kVFwUBJ2HaAIJHjZ7ZqLRzXVOUbQ9pivJiBkXvLptSo72Iw4zsbRd1x8WNEaihx1MBAj+s+4MNdC5MBkQMlSB0PTJzs9xlz0gN+Oz0lohH6JO7ngPJUYbo2AIWEYZN+9kn/RyHblQTElrJeLf1jGNi4anBfzbsIXQuVm/nsrE5MH23X66+rJzUk8Fc5JAIDGBslkDPg3UNnElcE3cYbcB/ZzjFtgz8ducWKQmI+Yqv4p7BVXji/rHPim8vL6P5xZc95tbIonp5bQH+PPSmcfDk3rrf5mS58dJvWh/UpwcfdVvUAsWLJEV1lUBg1qecVbCsa6Oy7tJ2ZK7e3KdtZrmXiYpSAnSzRNJotr4g4H99brG6IwUx3qk5BE4Line truncated
+53 -54
View File
@@ -4,7 +4,6 @@ Bug #74159: Writing a large buffer to non-blocking encrypted streams fails
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
?>
--FILE--
<?php
@@ -13,93 +12,93 @@ if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
// scenarios which might be useful. More reliable test is bug72333.phpt
$serverCode = <<<'CODE'
$serverUri = "ssl://127.0.0.1:10012";
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/bug54992.pem',
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
]]);
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => __DIR__ . '/bug54992.pem',
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
]]);
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
phpt_notify();
phpt_notify();
$client = stream_socket_accept($server, 1);
if (!$client) {
exit();
}
exit();
}
$data = '';
while (strlen($data) < 0xfffff) {
$buffer = fread($client, 8192);
if (empty($buffer)) {
exit();
}
$data .= $buffer;
usleep(100);
}
while (strlen($data) < 0xfffff) {
$buffer = fread($client, 8192);
if (empty($buffer)) {
exit();
}
$data .= $buffer;
usleep(100);
}
fclose($client);
CODE;
$clientCode = <<<'CODE'
function streamRead($stream) : int {
return strlen(fread($stream, 8192));
}
return strlen(fread($stream, 8192));
}
function streamWrite($stream, $data) : int {
return fwrite($stream, $data);
}
return fwrite($stream, $data);
}
function waitForWrite(...$streams) : bool {
$read = null;
$except = null;
while($streams && !($n = stream_select($read, $streams, $except, 1)));
return $n > 0;
}
$read = null;
$except = null;
while($streams && !($n = stream_select($read, $streams, $except, 1)));
return $n > 0;
}
function waitForRead(...$streams) : bool {
$write = null;
$except = null;
while ($streams && !($n = stream_select($streams, $write, $except, 1)));
return $n > 0;
}
$write = null;
$except = null;
while ($streams && !($n = stream_select($streams, $write, $except, 1)));
return $n > 0;
}
set_error_handler(function ($errno, $errstr) {
exit("$errstr\n");
});
exit("$errstr\n");
});
$serverUri = "tcp://127.0.0.1:10012";
$clientFlags = STREAM_CLIENT_CONNECT;
$clientCtx = stream_context_create(['ssl' => [
'verify_peer' => true,
'cafile' => __DIR__ . '/bug54992-ca.pem',
'peer_name' => 'bug54992.local',
]]);
$clientFlags = STREAM_CLIENT_CONNECT;
$clientCtx = stream_context_create(['ssl' => [
'verify_peer' => true,
'cafile' => __DIR__ . '/bug54992-ca.pem',
'peer_name' => 'bug54992.local',
]]);
phpt_wait();
$fp = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
stream_set_blocking($fp, false);
while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)));
while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)));
$data = str_repeat("a", 0xfffff);
$written = 0;
$total = $written;
while(!empty($data)) {
$written = streamWrite($fp, $data);
$total += $written;
$data = substr($data, $written);
waitForWrite($fp);
}
printf("Written %d bytes\n", $total);
$written = 0;
$total = $written;
while(!empty($data)) {
$written = streamWrite($fp, $data);
$total += $written;
$data = substr($data, $written);
waitForWrite($fp);
}
printf("Written %d bytes\n", $total);
while(waitForRead($fp)) {
streamRead($fp);
if (feof($fp)) {
break;
}
}
streamRead($fp);
if (feof($fp)) {
break;
}
}
exit("DONE\n");
CODE;
+2 -6
View File
@@ -2,12 +2,8 @@
Bug #74402 (segfault on random_bytes, bin3hex, openssl_seal)
--SKIPIF--
<?php
if (!extension_loaded("openssl")) {
print "skip";
}
if (!in_array('AES256', openssl_get_cipher_methods(true))) {
print "skip";
}
if (!extension_loaded("openssl")) print "skip";
if (!in_array('AES256', openssl_get_cipher_methods(true))) print "skip";
?>
--FILE--
<?php
+1 -3
View File
@@ -1,9 +1,7 @@
--TEST--
Bug #74720 pkcs7_en/decrypt does not work if \x1a is used in content, variant 1
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
+1 -3
View File
@@ -1,9 +1,7 @@
--TEST--
Bug #74798 pkcs7_en/decrypt does not work if \x0a is used in content
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
Loaded 100 of 261 files, more files were not shown because too many files have changed in this diff. Show more