Compare commits

...
145 Commits
Author SHA1 Message Date
Sara Golemon 7f6558bf5d Update versions for PHP 7.1.22 2018-09-11 13:44:05 +00:00
Sara Golemon c1372ebdf1 Update NEWS for PHP 7.1.22 2018-09-11 13:44:04 +00:00
Sara Golemon 318a5402c1 Preflight 7.1.22 2018-09-11 09:28:13 -04:00
Sara Golemon b791f429db NEWS for 76582 2018-09-10 09:13:40 -04:00
Stanislav Malyshev 7d16058be7 Fix for bug #76582
The brigade seems to end up in a messed up state if something fails
in shutdown, so we clean it up.
2018-09-10 09:10:39 -04:00
Sara Golemon b7df57c9f6 Update NEWS for PHP 7.1.22RC1 2018-08-29 16:49:05 +00:00
Sara Golemon f669490c58 Rollback tagging of 7.1.22, this is 7.1.22RC1 2018-08-29 12:48:37 -04:00
Sara Golemon ae5e1923ec Update NEWS for PHP 7.1.22 2018-08-29 15:38:32 +00:00
Christoph M. Becker efb86aef12 Fix #68180: iconv_mime_decode can return extra characters in a header
Basically, the algorithm to append a converted string to an existing
`smart_str` works by increasing the `smart_str` buffer, to let `iconv`
convert characters until there is no more space, to set the new length
of the `smart_str` and to repeat until there is no more input.

Formerly, the new length calculation has been wrong, though, since we
would have to take the old `out_len` into account (`buf_growth -
old_out_len - out_len`).  However, since there is no need to take the
old `out_len` into account when increasing the `smart_str` buffer, we
can simplify the fix, avoiding an additional variable.
2018-08-26 13:18:35 +02:00
Christoph M. Becker e29c946c29 Fix #60494: iconv_mime_decode does ignore special characters
We must not ignore erroneous characters in mime headers, but rather let
iconv_mime_decode() fail in this case, issuing the usual notice
regarding illegal characters.
2018-08-25 17:40:39 +02:00
Christoph M. Becker 8754d44167 Fix #63839: iconv_mime_decode_headers function is skipping headers
We have to cater to the possibility that `=?` is not the start of an
encoded-word, but rather a literal `=?`.  If a line break is found
while we're still looking for the charset, we can safely assume that
it's a literal `=?`, and act accordingly.
2018-08-25 14:51:13 +02:00
Christoph M. Becker 6e1980e152 Fix #55146: iconv_mime_decode_headers() skips some headers
If we're expecting the start of an encoded word (`=?`), but instead of
the question mark get a line break (CR or LF), we must not append it to
the `pretval`.
2018-08-25 14:40:07 +02:00
Dylan K. Taylor b9bf9ddce6 mkdist.php: recursively check dll dependencies
Fix duplication of recursively checked deps
2018-08-23 21:25:54 +02:00
Christoph M. Becker 6644bd005f Simplify regression test
There's no need to actually try to trigger an out-of-memory condition
to proof the leak; instead we can simply rely on the Zend MM to report
the memory leaks in debug mode (at least on Linux).  Therefore we
simplify the regression test, which also makes it run much faster.
2018-08-23 12:48:09 +02:00
Christoph M. Becker 32a728d351 Fix #68825: Exception in DirectoryIterator::getLinkTarget()
intern->file_name may not have been properly set when
DirectoryIterator::getLinkTarget() is called, so we make sure it is
before using it.
2018-08-22 15:37:02 +02:00
Christoph M. Becker 5fb01a3a42 Increase memory_limit to prevent test failures 2018-08-22 14:29:28 +02:00
Christoph M. Becker 70b2fca220 Fix #76778: array_reduce leaks memory if callback throws exception
We have to release the result variable in the error case, too.
2018-08-22 13:40:24 +02:00
Ville Hukkamaki cf2fc66b02 Fixed bug #76777 and added test
Set undefined values to null rather than undefined.
2018-08-22 12:51:06 +02:00
Jakub Zelenka 4c542e6c13 Fix bug #76705 (unusable ssl => peer_fingerprint in stream_context_create()) 2018-08-19 20:14:26 +01:00
Christoph M. Becker 4c448334bd Add regression test for bug #68175 2018-08-18 14:36:16 +02:00
Tim Siebels 3257d22fea Fix #68175: RegexIterator pregFlags are NULL instead of 0 2018-08-18 14:33:39 +02:00
Anatol Belski 837ed71c65 Update binary SDK version for AppVeyor 2018-08-17 15:44:10 +02:00
Xinchen Hui 04c4854fdf Fixed bug #76754 (parent private constant in extends class memory leak) 2018-08-17 13:35:15 +08:00
Xinchen Hui 64c88c1e16 Merge branch 'PHP-7.1' of git.php.net:/php-src into PHP-7.1
* 'PHP-7.1' of git.php.net:/php-src:
  fix man page installation
2018-08-16 14:00:30 +08:00
Xinchen Hui 8c92442b49 Fixed bug #76747 (Opcache treats path containing "test.pharma.tld" as a phar file) 2018-08-16 13:56:20 +08:00
Remi Collet 1f2f2c6b96 fix man page installation
Since 91996e7ee5
phpdbg.1 is in buildir, not in srcdir
2018-08-16 06:53:56 +02:00
Tyson Andre e20baee136 Fix arginfo for bzcompress
bzcompress() has 1 required parameter, not 2.

See http://php.net/manual/en/function.bzcompress.php or invoke
bzcompress with 1 parameter.
2018-08-13 15:59:08 +02:00
Anatol Belski 859f7fce1f Update NEWS [ci skip] 2018-08-13 09:11:57 +02:00
Anatol Belski 45a05f3841 Fixed bug #74484 MessageFormatter::formatMessage memory corruption
with 11+ named placeholder
2018-08-09 22:07:24 +02:00
Peter Kokot 935625f1b8 [ci skip] Update NEWS 2018-08-06 09:41:38 +02:00
Peter Kokot a3e3d914ed Fix bug #76709: Minimal required zlib library is 1.2.0.4
The minimal required version of zlib system library is 1.2.0.4 instead
of 1.0.9 as reported in the ./configure --help.
2018-08-06 09:37:16 +02:00
Peter Kokot 4d5edcb4ac [ci skip] Update NEWS 2018-08-06 06:17:45 +02:00
Jay Bonci c8a90606c1 Fix bug #65988: Zlib version check fails
When an 'include/zlib/' style dir is passed to --with-zlib configure
option the zlib version check fails.
2018-08-06 06:14:11 +02:00
Peter Kokot b4b14d2106 [ci skip] Update NEWS 2018-08-06 01:43:37 +02:00
Peter Kokot 45a3c0e596 Fix bug #72443: Generate enabled extension
The PHP extension generator script now generates enabled extension with
less required steps for using the newly generated files.
2018-08-06 01:22:17 +02:00
Peter Kokot 169a98319a [ci skip] Update NEWS 2018-08-05 20:35:23 +02:00
sji 0f557756dd Fixed incorrect restoring of LDFLAGS 2018-08-05 20:26:40 +02:00
Peter Kokot fd0fc20d35 [ci skip] Update NEWS
Bug fix #76595 has been done after RC release and should go to
appropriate NEWS location then.
2018-08-04 16:16:07 +02:00
Christoph M. Becker c00f5e6531 Fix #76704: mb_detect_order return value varies based on argument type
php_mb_parse_encoding_list() and php_mb_parse_encoding_array() are
supposed to return SUCCESS and FAILURE, not 1 and 0, respectively.
2018-08-04 12:51:57 +02:00
Peter Kokot b71a503844 [ci skip] Update NEWS 2018-08-04 06:39:19 +02:00
Kevin Abel 91996e7ee5 Fix bug 76595: Update phpdbg man page
Send phpdbg.1 man page through configure replacements
Update phpdbg.1 man page to include all options
Fixes formatting to be more consistent with php.1
Fix paragraph whitespace and ignore phpdbg.1
2018-08-04 06:34:40 +02:00
Anatol Belski 41c69766a4 Improve cleanup
The persistent connection locks the file which might prevent deletion.
2018-08-03 07:08:53 +02:00
Anatol Belski 19592519c2 Fix callbacks
The signatures wasn't synced in 7.0
2018-08-02 18:59:34 +02:00
Joe Watkins 74988eed99 bump version 2018-07-31 16:38:35 +02:00
Anatol Belski 2870178720 Update NEWS [ci skip] 2018-07-30 19:42:10 +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 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 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 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 2139c2c2de Fixed pefree_size (efree_size will be expaned to do {} while () form) 2018-07-23 15:48:14 +08: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 9e54d9d692 Update binary SDK version for AppVeyor 2018-07-19 18:35:54 +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 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 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
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 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 141072a838 Improve test
Ensure the filename is non existent indeed.
2018-07-13 20:13:51 +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 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 cc7b000d2c Fix macro 2018-07-12 11:35:00 +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 9026562c79 [ci skip] Update NEWS 2018-07-10 11:50:33 +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 a820aab9da Sync callback signature with libxml2 2.9.8 2018-07-09 21:21:41 +02:00
Anatol Belski 2c43fb49d6 Add missing flag 2018-07-09 15:12: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
cdoco 47fb17b108 Fixed bug #76366 (references in sub-array for filtering breaks the filter) 2018-07-07 12:07:43 +02:00
Anatol Belski ea24847620 [ci skip] Update NEWS 2018-07-06 17:43:48 +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 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
Nikita Popov c97b8bbf82 Fixed bug #75231
The behavior is now consistent with ReflectionMethod.
2018-07-02 18:56:27 +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 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 f8258325b4 Update libs_version.txt 2018-07-02 12:09:54 +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 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 9b0df97a42 Fix handling of void return type on internal functions 2018-06-30 20:10:57 +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 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 962706d16c Fix nullable type pretty-printing 2018-06-29 23:22:41 +02:00
Anatol Belski fb09f1341f [ci skip] Update NEWS 2018-06-29 20:10:54 +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
Marcus Schwarz bf5a802f5a Fixed bug #76532 (excessive memory usage in mb_strimwidth) 2018-06-28 23:02:28 +02:00
Anatol Belski f6430e3fe2 Update SDK version for AppVeyor 2018-06-28 15:56:27 +02:00
Anatol Belski 88b5df91f6 Sync versions for VC++ 15.8 2018-06-28 13:23:19 +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 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 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 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 5af0db88fa Prepare tests for ICU 62.1 2018-06-25 11:30:14 +02:00
Nikita Popov 701460ba84 Fixed bug #76502 2018-06-24 22:26:45 +02: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 6531719da5 Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys) 2018-06-21 17:26:05 +08: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 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 5dd1ef90ca ICU 59+ requires C++11 and errors out without the option 2018-06-17 16:42:41 -07:00
Dmitry Stogov 11507c0e1b Fixed invalid free introduced by d6e81f0bfd (avoid keeping "invalid" pointer) 2018-06-14 02:38:39 +03: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 ea592e6b6c Rewrite FPM tests 2018-06-12 17:59:28 +01:00
Anatol Belski 62554efffe [ci skip] Update NEWS 2018-06-12 18:06:41 +02:00
Anatol Belski 7212829435 Fixed bug #76462 Undefined property: DateInterval::$f 2018-06-12 15:30:14 +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 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 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
Stanislav Malyshev 73bf238507 Fix bug #76390 - do not allow invalid strings in range() 2018-06-04 22:44:05 -07:00
Anatol Belski 5bf8032112 Translate correct C++ version with suitable compiler 2018-05-28 17:12:06 +02:00
Bob Weinand 97a8483143 Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT) 2018-05-28 00:48:35 +02:00
Mitch Hagstrand 34fb42970a Adds print_global_vars to gdbinit 2018-05-26 22:05:06 +02:00
Peter Kokot 974c46b89b Add missing opcache.opt_debug_level ini directive 2018-05-26 22:04:20 +02:00
Joe Watkins be11b354f4 fix phpdbg disabling chroot support 2018-05-23 22:23:13 +02:00
Xinchen Hui 8f221bdec0 Fixed bug #76367 (NoRewindIterator segfault 11) 2018-05-23 14:45:38 +08:00
Jakub Zelenka 68c3d09c2c Fix bug #76174 (openssl extension fails to build with LibreSSL 2.7) 2018-05-22 13:30:58 +01:00
Tianon Gravi bc6ddb7f45 Allow pecl like usage in ext/pdo, refs #2955 2018-05-21 12:18:46 +02:00
Anatol Belski 83626ef97a Refix the tests once more
The behavior change seems to be in both runtime and system. The
displaced warning output is of secondary interest anyway.
2018-05-19 13:09:56 +02:00
Anatol Belski 589f8107e8 Fix remaining AppVeyor test failures due to the image update 2018-05-19 11:43:19 +02:00
Anatol Belski 6043a2d6f7 Fix Opcache test fails regarding to AppVeyor image update 2018-05-18 18:36:39 +02:00
Jakub Zelenka 33382dc7ee Update NEWS with info about bug #76296 2018-05-18 17:18:25 +01:00
Jakub Zelenka 798e707eb3 Add test for bug #76296 2018-05-18 17:15:36 +01:00
Erik Lax d6bc266ba0 Fix bug #76296 (openssl_pkey_get_public does not respect open_basedir) 2018-05-18 17:15:22 +01:00
Anatol Belski b2429259af Fix curl tests wrt. AppVeyor and curl updates 2018-05-18 17:39:12 +02:00
Anatol Belski ee0ca6470d Fix cli server test fails after recent AppVeyor image update 2018-05-18 13:38:53 +02:00
Anatol Belski 2d9836a579 [ci skip] Update NEWS 2018-05-14 12:08:01 +02:00
Anatol Belski 9b8d8cac04 Fixed bug #76335 "link(): Bad file descriptor" with non-ASCII path 2018-05-14 10:43:11 +02:00
Anatol Belski 4dedccd8e2 [ci skip] Update NEWS 2018-05-14 08:42:28 +02:00
Anatol Belski ad787626a4 Fixed bug #76333 PHP built-in server does not find files if root path contains special characters 2018-05-13 18:40:32 +02:00
Anatol Belski d21612401f Update SDK version for AppVeyor 2018-05-09 11:28:20 +02:00
Joe Watkins 6c3b70e9a5 bump versions 2018-05-08 18:02:30 +02:00
306 changed files with 7386 additions and 2934 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.3
PHP_BUILD_SDK_BRANCH: php-sdk-2.1.8
# ext and env setup for tests
#MYSQL_TEST_PASSWD: Password12!
#MYSQL_TEST_USER: root
+12
View File
@@ -16,9 +16,11 @@ define ____executor_globals
end
set $eg = ((zend_executor_globals*) (*((void ***) $tsrm_ls))[executor_globals_id-1])
set $cg = ((zend_compiler_globals*) (*((void ***) $tsrm_ls))[compiler_globals_id-1])
set $eg_ptr = $eg
else
set $eg = executor_globals
set $cg = compiler_globals
set $eg_ptr = (zend_executor_globals*) &executor_globals
end
end
@@ -289,6 +291,16 @@ define ____printzv
end
end
define print_global_vars
____executor_globals
set $symtable = ((HashTable *)&($eg_ptr->symbol_table))
print_ht $symtable
end
document print_global_vars
Prints the global variables
end
define print_const_table
set $ind = 1
printf "[%p] {\n", $arg0
+1
View File
@@ -274,6 +274,7 @@ sapi/fpm/fpm/php-cgi
sapi/phpdbg/phpdbg_parser.c
sapi/phpdbg/phpdbg_parser.h
sapi/phpdbg/phpdbg
sapi/phpdbg/phpdbg.1
scripts/php-config
scripts/phpize
scripts/man1/*.1
+3 -1
View File
@@ -1,6 +1,6 @@
dist: trusty
language: c
sudo: false
sudo: required
addons:
apt:
packages:
@@ -47,6 +47,8 @@ env:
- ENABLE_MAINTAINER_ZTS=1 ENABLE_DEBUG=1
before_script:
# Enable IPv6
- sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
# Compile PHP
- ./travis/compile.sh
# Setup Extensions
+1 -1
View File
@@ -121,7 +121,7 @@ distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c stamp-h buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
rm -f php7.spec main/build-defs.h scripts/phpize
rm -f ext/date/lib/timelib_config.h ext/mbstring/oniguruma/config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 ext/phar/phar.1 ext/phar/phar.phar.1
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1
rm -f sapi/fpm/php-fpm.conf sapi/fpm/init.d.php-fpm sapi/fpm/php-fpm.service sapi/fpm/php-fpm.8 sapi/fpm/status.html
rm -f ext/iconv/php_have_bsd_iconv.h ext/iconv/php_have_glibc_iconv.h ext/iconv/php_have_ibm_iconv.h ext/iconv/php_have_iconv.h ext/iconv/php_have_libiconv.h ext/iconv/php_iconv_aliased_libiconv.h ext/iconv/php_iconv_supports_errno.h ext/iconv/php_php_iconv_h_path.h ext/iconv/php_php_iconv_impl.h
rm -f ext/phar/phar.phar ext/phar/phar.php
+159 -1
View File
@@ -1,6 +1,164 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.1.18
13 Sep 2018, PHP 7.1.22
- Core:
. Fixed bug #76754 (parent private constant in extends class memory leak).
(Laruence)
. Fixed bug #72443 (Generate enabled extension). (petk)
- Apache2:
. Fixed bug #76582 (Apache bucket brigade sometimes becomes invalid). (stas)
- Bz2:
. Fixed arginfo for bzcompress. (Tyson Andre)
- gettext:
. Fixed bug #76517 (incorrect restoring of LDFLAGS). (sji)
- iconv:
. Fixed bug #68180 (iconv_mime_decode can return extra characters in a
header). (cmb)
. Fixed bug #63839 (iconv_mime_decode_headers function is skipping headers).
(cmb)
. Fixed bug #60494 (iconv_mime_decode does ignore special characters). (cmb)
. Fixed bug #55146 (iconv_mime_decode_headers() skips some headers). (cmb)
- intl:
. Fixed bug #74484 (MessageFormatter::formatMessage memory corruption with
11+ named placeholders). (Anatol)
- libxml:
. Fixed bug #76777 ("public id" parameter of libxml_set_external_entity_loader
callback undefined). (Ville Hukkamäki)
- mbstring:
. Fixed bug #76704 (mb_detect_order return value varies based on argument
type). (cmb)
- Opcache:
. Fixed bug #76747 (Opcache treats path containing "test.pharma.tld" as a phar
file). (Laruence)
- OpenSSL:
. Fixed bug #76705 (unusable ssl => peer_fingerprint in
stream_context_create()). (Jakub Zelenka)
- phpdbg:
. Fixed bug #76595 (phpdbg man page contains outdated information).
(Kevin Abel)
- SPL:
. Fixed bug #68825 (Exception in DirectoryIterator::getLinkTarget()). (cmb)
. Fixed bug #68175 (RegexIterator pregFlags are NULL instead of 0). (Tim
Siebels)
- Standard:
. Fixed bug #76778 (array_reduce leaks memory if callback throws exception).
(cmb)
- zlib:
. Fixed bug #65988 (Zlib version check fails when an include/zlib/ style dir
is passed to the --with-zlib configure option). (Jay Bonci)
. Fixed bug #76709 (Minimal required zlib library is 1.2.0.4). (petk)
16 Aug 2018, PHP 7.1.21
- 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 #68553 (array_column: null values in $index_key become incrementing
keys in result). (Laruence)
. Fixed bug #73817 (Incorrect entries in get_html_translation_table). (cmb)
. 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)
07 Jul 2018, PHP 7.1.20
- Core:
. Fixed bug #76534 (PHP hangs on 'illegal string offset on string references
with an error handler). (Laruence)
. Fixed bug #76502 (Chain of mixed exceptions and errors does not serialize
properly). (Nikita)
- Date:
. Fixed bug #76462 (Undefined property: DateInterval::$f). (Anatol)
- 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)
- 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)
22 Jun 2018, PHP 7.1.19
- CLI Server:
. Fixed bug #76333 (PHP built-in server does not find files if root path
contains special characters). (Anatol)
- OpenSSL:
. Fixed bug #76296 (openssl_pkey_get_public does not respect open_basedir).
(Erik Lax, Jakub Zelenka)
. Fixed bug #76174 (openssl extension fails to build with LibreSSL 2.7).
(Jakub Zelenka)
- SPL:
. Fixed bug #76367 (NoRewindIterator segfault 11). (Laruence)
- Standard:
. Fixed bug #76335 ("link(): Bad file descriptor" with non-ASCII path).
(Anatol)
. Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT). (Bob)
24 May 2018, PHP 7.1.18
- FPM:
. Fixed bug #76075 --with-fpm-acl wrongly tries to find libacl on FreeBSD.
+3 -3
View File
@@ -70,7 +70,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#endif
#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))
@@ -79,7 +79,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 */
@@ -90,7 +90,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';
+13
View File
@@ -0,0 +1,13 @@
--TEST--
Bug #76383: array_map on $GLOBALS returns IS_INDIRECT
--FILE--
<?php
$a = 1;
array_map(function($x) use (&$lastval) { $lastval = $x; }, $GLOBALS);
var_dump(gettype($lastval), $lastval); // will contain $a
?>
--EXPECT--
string(7) "integer"
int(1)
+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
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #76754 (parent private constant in extends class memory leak)
--INI--
opcache.enable=0
opcache.enable_cli=0
--FILE--
<?php
class FOO
{
private const FOO = 'BAR';
}
class BAR extends FOO { }
?>
okey
--EXPECT--
okey
+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
@@ -1080,6 +1080,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]) {
@@ -1614,6 +1617,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, ' ');
}
+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
@@ -1042,9 +1042,12 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
zend_internal_arg_info *ret_info = zf->internal_function.arg_info - 1;
zend_class_entry *ce = NULL;
if (UNEXPECTED(ret_info->type_hint == IS_VOID && Z_TYPE_P(ret) != IS_NULL)) {
zend_verify_void_return_error(zf, zend_zval_type_name(ret), "");
return 0;
if (ret_info->type_hint == 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_internal_type(zf, ret_info, ret, &ce, 1))) {
@@ -1700,7 +1703,9 @@ fetch_from_array:
zend_throw_error(NULL, "[] operator not supported for strings");
} else {
zend_check_string_offset(dim, type);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
ZVAL_ERROR(result);
} else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
+1 -1
View File
@@ -296,8 +296,8 @@ ZEND_API void destroy_zend_class(zval *zv)
}
}
} ZEND_HASH_FOREACH_END();
zend_hash_destroy(&ce->constants_table);
}
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) {
efree(ce->interfaces);
}
+3 -1
View File
@@ -891,7 +891,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
+24 -8
View File
@@ -17596,7 +17596,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
@@ -21014,7 +21016,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
@@ -22385,7 +22389,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
@@ -25330,7 +25336,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
@@ -37055,7 +37063,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
@@ -41665,7 +41675,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
@@ -44149,7 +44161,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
@@ -48220,7 +48234,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);
zend_wrong_string_offset();
if (EXPECTED(EG(exception) == NULL)) {
zend_wrong_string_offset();
}
}
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
+5 -5
View File
@@ -75,7 +75,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
#endif
#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))
@@ -84,7 +84,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 */
@@ -95,7 +95,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)
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=1
PHP_RELEASE_VERSION=18
PHP_EXTRA_VERSION="-dev"
PHP_RELEASE_VERSION=22
PHP_EXTRA_VERSION=""
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`
+6 -2
View File
@@ -6,6 +6,11 @@ if(!extension_loaded("bcmath")) print "skip";
if (substr(PHP_OS, 0, 3) != 'WIN') {
die('skip valid only for windows');
}
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
$req = "10.0.17134";
if (version_compare($cur, $req) >= 0) {
echo "skip Only for Windows systems < $req";
}
?>
--FILE--
<?php
@@ -14,5 +19,4 @@ var_dump(bcpowmod(1, 1.2, 1, 1));
?>
--EXPECTF--
string(1) "1"
string(3) "0.0"
bc math warning: non-zero scale in exponent
%Astring(3) "0.0"%A
+5 -1
View File
@@ -4,7 +4,11 @@ Bug 72093: bcpowmod accepts negative scale and corrupts _one_ definition
<?php
if(!extension_loaded("bcmath")) print "skip";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip Not valid for windows');
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
$req = "10.0.17134";
if (version_compare($cur, $req) < 0) {
echo "skip Compatible on Windows systems >= $req";
}
}
?>
--FILE--
+9 -6
View File
@@ -6,6 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
if (substr(PHP_OS, 0, 3) != 'WIN') {
die('skip valid only for windows');
}
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
$req = "10.0.17134";
if (version_compare($cur, $req) >= 0) {
echo "skip Only for Windows systems < $req";
}
?>
--FILE--
<?php
@@ -13,9 +18,7 @@ var_dump(bcpowmod('4.1', '4', '3', 3));
var_dump(bcpowmod('4', '4', '3.1', 3));
?>
===DONE===
--EXPECT--
string(5) "1.000"
string(5) "1.000"
===DONE===
bc math warning: non-zero scale in base
bc math warning: non-zero scale in modulus
--EXPECTF--
%Astring(5) "1.000"
%Astring(5) "1.000"
===DONE===%A
+5 -1
View File
@@ -4,7 +4,11 @@ Bug #75178 (bcpowmod() misbehaves for non-integer base or modulus)
<?php
if (!extension_loaded('bcmath')) die('skip bcmath extension is not available');
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip Not valid for windows');
$cur = PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD;
$req = "10.0.17134";
if (version_compare($cur, $req) < 0) {
echo "skip Compatible on Windows systems >= $req";
}
}
?>
--FILE--
+1 -1
View File
@@ -75,7 +75,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_bzerror, 0)
ZEND_ARG_INFO(0, bz)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 2)
ZEND_BEGIN_ARG_INFO_EX(arginfo_bzcompress, 0, 0, 1)
ZEND_ARG_INFO(0, source)
ZEND_ARG_INFO(0, blocksize)
ZEND_ARG_INFO(0, workfactor)
+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===
+4 -5
View File
@@ -82,7 +82,7 @@ static void com_iter_get_key(zend_object_iterator *iter, zval *key)
}
}
static int com_iter_move_forwards(zend_object_iterator *iter)
static void com_iter_move_forwards(zend_object_iterator *iter)
{
struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data);
unsigned long n_fetched;
@@ -103,18 +103,18 @@ static int com_iter_move_forwards(zend_object_iterator *iter)
} else {
/* indicate that there are no more items */
I->key = (ulong)-1;
return FAILURE;
return;
}
} else {
/* safe array */
if (I->key >= (ULONG) I->sa_max) {
I->key = (ulong)-1;
return FAILURE;
return;
}
I->key++;
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key) == 0) {
I->key = (ulong)-1;
return FAILURE;
return;
}
}
@@ -122,7 +122,6 @@ static int com_iter_move_forwards(zend_object_iterator *iter)
php_com_zval_from_variant(&ptr, &I->v, I->code_page);
/* php_com_wrap_variant(ptr, &I->v, I->code_page); */
ZVAL_COPY_VALUE(&I->zdata, &ptr);
return SUCCESS;
}
+1 -3
View File
@@ -514,15 +514,13 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key)
}
}
static int saproxy_iter_move_forwards(zend_object_iterator *iter)
static void saproxy_iter_move_forwards(zend_object_iterator *iter)
{
php_com_saproxy_iter *I = (php_com_saproxy_iter*)Z_PTR(iter->data);
if (++I->key >= I->imax) {
I->key = -1;
return FAILURE;
}
return SUCCESS;
}
static zend_object_iterator_funcs saproxy_iter_funcs = {
+2 -2
View File
@@ -223,9 +223,9 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
}
/* Type-library stuff */
void php_com_typelibrary_dtor(void *pDest)
void php_com_typelibrary_dtor(zval *pDest)
{
ITypeLib **Lib = (ITypeLib**)pDest;
ITypeLib **Lib = (ITypeLib**)Z_PTR_P(pDest);
ITypeLib_Release(*Lib);
}
+1 -1
View File
@@ -174,7 +174,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage);
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode,
int codepage);
void php_com_typelibrary_dtor(void *pDest);
void php_com_typelibrary_dtor(zval *pDest);
ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj, char *dispname, int sink);
int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int printdef, GUID *guid, int codepage);
+3 -2
View File
@@ -30,7 +30,8 @@ echo "Ok\n";
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?>
--EXPECTF--
Warning: curl_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
Hello World!
Hello World!Ok
%A
Hello World!
Hello World!* Closing connection 0
Ok
-1
View File
@@ -65,4 +65,3 @@ Hello World!Ok for CURLOPT_FILE
%AOk for CURLOPT_INFILE
===DONE===
%A
+12 -6
View File
@@ -13,17 +13,23 @@ function curl_cli_server_start() {
$doc_root = __DIR__;
$router = "responder/get.php";
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => STDERR,
);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => array("pipe", "w"),
);
$cmd = "{$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
$cmd .= " {$router}";
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
} else {
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => STDERR,
);
$cmd = "exec {$php_executable} -t {$doc_root} -n -S " . PHP_CURL_SERVER_ADDRESS;
$cmd .= " {$router}";
$cmd .= " 2>/dev/null";
+1
View File
@@ -4276,6 +4276,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;
+8 -2
View File
@@ -2536,7 +2536,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;
}
@@ -2715,6 +2718,7 @@ static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * valu
int NumDirEntries, old_motorola_intel, offset_diff;
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)) {
@@ -2769,6 +2773,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;
case MN_OFFSET_GUESS:
if (maker_note->offset + 10 + 4 >= value_len) {
@@ -2785,6 +2790,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;
default:
case MN_OFFSET_NORMAL:
@@ -2798,7 +2804,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;
}
}
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(count(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
int(1)
DONE
+3 -3
View File
@@ -120,9 +120,9 @@ dnl [ --with-$extname Include $extname support])
dnl Otherwise use enable:
dnl PHP_ARG_ENABLE($extname, whether to enable $extname support,
PHP_ARG_ENABLE($extname, whether to enable $extname support,
dnl Make sure that the comment is aligned:
dnl [ --enable-$extname Enable $extname support])
[ --enable-$extname Enable $extname support])
if test "\$PHP_$EXTNAME" != "no"; then
dnl Write more examples of tests here...
@@ -179,7 +179,7 @@ cat >config.w32 <<eof
// ARG_WITH("$extname", "for $extname support", "no");
// Otherwise, use ARG_ENABLE
// ARG_ENABLE("$extname", "enable $extname support", "no");
ARG_ENABLE("$extname", "enable $extname support", "no");
if (PHP_$EXTNAME != "no") {
EXTENSION("$extname", "$extname.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
+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)
}
}
+3 -4
View File
@@ -35,10 +35,6 @@ if test "$PHP_GETTEXT" != "no"; then
PHP_NEW_EXTENSION(gettext, gettext.c, $ext_shared)
PHP_SUBST(GETTEXT_SHARED_LIBADD)
if test -n "$GETTEXT_LIBS"; then
PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
fi
PHP_ADD_INCLUDE($GETTEXT_INCDIR)
AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, ngettext, [AC_DEFINE(HAVE_NGETTEXT, 1, [ ])])
@@ -47,4 +43,7 @@ if test "$PHP_GETTEXT" != "no"; then
AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, bind_textdomain_codeset, [AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1, [ ])])
LDFLAGS=$O_LDFLAGS
if test -n "$GETTEXT_LIBS"; then
PHP_ADD_LIBRARY_WITH_PATH($GETTEXT_LIBS, $GETTEXT_LIBDIR, GETTEXT_SHARED_LIBADD)
fi
fi
+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()); }
?>
+26 -3
View File
@@ -466,7 +466,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
if (in_p != NULL) {
while (in_left > 0) {
out_left = buf_growth - out_left;
out_left = buf_growth;
smart_str_alloc(d, out_left, 0);
out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
@@ -500,7 +500,7 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
}
} else {
for (;;) {
out_left = buf_growth - out_left;
out_left = buf_growth;
smart_str_alloc(d, out_left, 0);
out_p = ZSTR_VAL((d)->s) + ZSTR_LEN((d)->s);
@@ -1544,7 +1544,10 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
break;
default: /* first letter of a non-encoded word */
_php_iconv_appendc(pretval, *p1, cd_pl);
err = _php_iconv_appendc(pretval, *p1, cd_pl);
if (err != PHP_ICONV_ERR_SUCCESS) {
goto out;
}
encoded_word = NULL;
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
scan_stat = 12;
@@ -1555,6 +1558,9 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
case 1: /* expecting a delimiter */
if (*p1 != '?') {
if (*p1 == '\r' || *p1 == '\n') {
--p1;
}
err = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);
if (err != PHP_ICONV_ERR_SUCCESS) {
goto out;
@@ -1580,6 +1586,23 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
case '*': /* new style delimiter: locale id follows */
scan_stat = 10;
break;
case '\r': case '\n': /* not an encoded-word */
--p1;
_php_iconv_appendc(pretval, '=', cd_pl);
_php_iconv_appendc(pretval, '?', cd_pl);
err = _php_iconv_appendl(pretval, csname, (size_t)((p1 + 1) - csname), cd_pl);
if (err != PHP_ICONV_ERR_SUCCESS) {
goto out;
}
csname = NULL;
if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {
scan_stat = 12;
}
else {
scan_stat = 0;
}
continue;
}
if (scan_stat != 2) {
char tmpbuf[80];
+36
View File
@@ -0,0 +1,36 @@
--TEST--
Bug #55146 (iconv_mime_decode_headers() skips some headers)
--SKIPIF--
<?php
if (!extension_loaded('iconv')) die('skip iconv extension not available');
?>
--FILE--
<?php
$headers = <<< HEADERS
X-Header-One: H4sIAAAAAAAAA+NgFlsCAAA=
X-Header-Two: XtLePq6GTMn8G68F0
HEADERS;
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
$headers = <<< HEADERS
X-Header-One: =
X-Header-Two: XtLePq6GTMn8G68F0
HEADERS;
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
?>
===DONE===
--EXPECT--
array(2) {
["X-Header-One"]=>
string(24) "H4sIAAAAAAAAA+NgFlsCAAA="
["X-Header-Two"]=>
string(17) "XtLePq6GTMn8G68F0"
}
array(2) {
["X-Header-One"]=>
string(1) "="
["X-Header-Two"]=>
string(17) "XtLePq6GTMn8G68F0"
}
===DONE===
+23
View File
@@ -0,0 +1,23 @@
--TEST--
Bug #60494 (iconv_mime_decode does ignore special characters)
--SKIPIF--
<?php
if (!extension_loaded('iconv')) die('skip iconv extension not available');
?>
--FILE--
<?php
var_dump(iconv_mime_decode('ä'));
var_dump(iconv_mime_decode('ö'));
var_dump(iconv_mime_decode('ß'));
?>
===DONE===
--EXPECTF--
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
bool(false)
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
bool(false)
Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d
bool(false)
===DONE===
+71
View File
@@ -0,0 +1,71 @@
--TEST--
Bug #63839 (iconv_mime_decode_headers function is skipping headers)
--SKIPIF--
<?php
if (!extension_loaded('iconv')) die('skip iconv extension not available');
?>
--FILE--
<?php
$headers = 'From: "xyz" <xyz@xyz.com>
To: <xyz@xyz.com>
Subject: Reply Is? white side-LED =? in Help
Date: Sat, 22 Dec 2012
Message-ID: <006f01cde00e$d9f79da0$8de6d8e0>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Ac3gDtcH2huHjzYcQVmFJPPoWjJogA==
Content-Language: en-us
';
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR));
var_dump(iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_STRICT));
?>
===DONE===
--EXPECT--
array(10) {
["From"]=>
string(19) ""xyz" <xyz@xyz.com>"
["To"]=>
string(13) "<xyz@xyz.com>"
["Subject"]=>
string(35) "Reply Is? white side-LED =? in Help"
["Date"]=>
string(16) "Sat, 22 Dec 2012"
["Message-ID"]=>
string(32) "<006f01cde00e$d9f79da0$8de6d8e0>"
["MIME-Version"]=>
string(3) "1.0"
["Content-Type"]=>
string(75) "multipart/alternative; boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0""
["X-Mailer"]=>
string(29) "Microsoft Office Outlook 12.0"
["Thread-Index"]=>
string(32) "Ac3gDtcH2huHjzYcQVmFJPPoWjJogA=="
["Content-Language"]=>
string(5) "en-us"
}
array(10) {
["From"]=>
string(19) ""xyz" <xyz@xyz.com>"
["To"]=>
string(13) "<xyz@xyz.com>"
["Subject"]=>
string(35) "Reply Is? white side-LED =? in Help"
["Date"]=>
string(16) "Sat, 22 Dec 2012"
["Message-ID"]=>
string(32) "<006f01cde00e$d9f79da0$8de6d8e0>"
["MIME-Version"]=>
string(3) "1.0"
["Content-Type"]=>
string(75) "multipart/alternative; boundary="----=_NextPart_000_0070_01CDE03C.F3AFD9A0""
["X-Mailer"]=>
string(29) "Microsoft Office Outlook 12.0"
["Thread-Index"]=>
string(32) "Ac3gDtcH2huHjzYcQVmFJPPoWjJogA=="
["Content-Language"]=>
string(5) "en-us"
}
===DONE===
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #68180 (iconv_mime_decode can return extra characters in a header)
--SKIPIF--
<?php
if (!extension_loaded('iconv')) die('skip iconv extension not available');
?>
--FILE--
<?php
$original = "=?UTF-8?Q?=E3=80=8E=E3=80=90=E5=A4=96=E8=B3=87=E7=B3=BB=E6=88=A6=E7=95=A5=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E3=81=8C=E9=9B=86=E7=B5=90=E3=80=91=E3=83=88=E3=83=83=E3=83=97=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E3=82=BF=E3=83=B3=E3=83=88=E3=81=A8=E8=A9=B1=E3=81=9B=E3=82=8B=E3=82=B3=E3=83=B3=E3=82=B5=E3=83=AB=E6=A5=AD=E7=95=8C=E7=A0=94=E7=A9=B6=E3=82=BB=E3=83=9F=E3=83=8A=E3=83=BC=E3=80=8F=E3=81=B8=E3=81=AE=E3=82=A8=E3=83=B3=E3=83=88=E3=83=AA=E3=83=BC=E3=81=82=E3=82=8A=E3=81=8C=E3=81=A8=E3=81=86=E3=81=94=E3=81=96=E3=81=84=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?=";
$decoded = iconv_mime_decode($original, ICONV_MIME_DECODE_STRICT, 'utf-8');
var_dump($decoded);
?>
===DONE===
--EXPECT--
string(183) "『【外資系戦略コンサルが集結】トップコンサルタントと話せるコンサル業界研究セミナー』へのエントリーありがとうございました。"
===DONE===
@@ -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);
+19
View File
@@ -27,6 +27,7 @@
#include <unicode/timezone.h>
#include <unicode/datefmt.h>
#include <unicode/calendar.h>
#include <unicode/strenum.h>
#include <vector>
@@ -333,6 +334,24 @@ static void umsg_set_timezone(MessageFormatter_object *mfo,
return; /* already done */
}
/* There is a bug in ICU which prevents MessageFormatter::getFormats()
to handle more than 10 formats correctly. The enumerator could be
used to walk through the present formatters using getFormat(), which
however seems to provide just a readonly access. This workaround
prevents crash when there are > 10 formats but doesn't set any error.
As a result, only DateFormatters with > 10 subformats are affected.
This workaround should be ifdef'd out, when the bug has been fixed
in ICU. */
icu::StringEnumeration* fnames = mf->getFormatNames(err.code);
if (!fnames || U_FAILURE(err.code)) {
return;
}
count = fnames->count(err.code);
delete fnames;
if (count > 10) {
return;
}
formats = mf->getFormats(count);
if (formats == NULL) {
+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
@@ -0,0 +1,33 @@
--TEST--
Bug #74484 MessageFormatter::formatMessage memory corruption with 11+ named placeholder
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
?>
--FILE--
<?php
$text = "{a} {b} {c} {d} {e} {f} {g} {h} {i} {j} {k} {l}";
$vars = array(
'a' => 1,
'b' => 2,
'c' => 3,
'd' => 4,
'e' => 5,
'f' => 6,
'g' => 7,
'h' => 8,
'i' => 9,
'j' => 10,
'k' => 11,
'l' => 12
);
var_dump(MessageFormatter::formatMessage('en_US', $text, $vars));
?>
==DONE==
--EXPECT--
string(26) "1 2 3 4 5 6 7 8 9 10 11 12"
==DONE==
+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]
+2 -2
View File
@@ -591,12 +591,12 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
if (ID != NULL) {
ZVAL_STRING(&params[0], ID);
} else {
ZVAL_UNDEF(&params[0]);
ZVAL_NULL(&params[0]);
}
if (URL != NULL) {
ZVAL_STRING(&params[1], URL);
} else {
ZVAL_UNDEF(&params[1]);
ZVAL_NULL(&params[1]);
}
ctxzv = &params[2];
array_init_size(ctxzv, 4);
+43
View File
@@ -0,0 +1,43 @@
--TEST--
Bug #76777 (first parameter of libxml_set_external_entity_loader callback undefined)
--SKIPIF--
<?php
if (!extension_loaded('libxml')) die('skip');
if (getenv("SKIP_ONLINE_TESTS")) die('skip online test');
?>
--FILE--
<?php
$xml=<<<EOF
<?xml version="1.0"?>
<test/>
EOF;
$xsd=<<<EOF
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="nonexistent.xsd"/>
<xs:element name="test"/>
</xs:schema>
EOF;
libxml_set_external_entity_loader(function($p,$s,$c) {
var_dump($p,$s,$c);
die();
});
$dom=new DOMDocument($xml);
$dom->schemaValidateSource($xsd);
?>
--EXPECTF--
NULL
string(15) "nonexistent.xsd"
array(4) {
["directory"]=>
NULL
["intSubName"]=>
NULL
["extSubURI"]=>
NULL
["extSubSystem"]=>
NULL
}
+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
*/
+5 -5
View File
@@ -681,7 +681,7 @@ static sapi_post_entry mbstr_post_entries[] = {
/* }}} */
/* {{{ static int php_mb_parse_encoding_list()
* Return 0 if input contains any illegal encoding, otherwise 1.
* Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.
* Even if any illegal encoding is detected the result may contain a list
* of parsed encodings.
*/
@@ -762,7 +762,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
*entry++ = encoding;
n++;
} else {
ret = 0;
ret = FAILURE;
}
}
p1 = p2 + 1;
@@ -778,7 +778,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
if (return_list) {
*return_list = NULL;
}
ret = 0;
ret = FAILURE;
}
if (return_size) {
*return_size = n;
@@ -790,7 +790,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
if (return_size) {
*return_size = 0;
}
ret = 0;
ret = FAILURE;
}
efree(tmpstr);
}
@@ -800,7 +800,7 @@ php_mb_parse_encoding_list(const char *value, size_t value_length, const mbfl_en
/* }}} */
/* {{{ static int php_mb_parse_encoding_array()
* Return 0 if input contains any illegal encoding, otherwise 1.
* Return FAILURE if input contains any illegal encoding, otherwise SUCCESS.
* Even if any illegal encoding is detected the result may contain a list
* of parsed encodings.
*/
+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) "得很幸福。有一天,一个长得很丑的老人带着一只木马来到王"
+16
View File
@@ -0,0 +1,16 @@
--TEST--
Bug #76704 (mb_detect_order return value varies based on argument type)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
?>
--FILE--
<?php
var_dump(mb_detect_order('Foo, UTF-8'));
var_dump(mb_detect_order(['Foo', 'UTF-8']))
?>
===DONE===
--EXPECT--
bool(false)
bool(false)
===DONE===
+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
@@ -618,6 +618,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
@@ -2269,7 +2269,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] =
@@ -2363,9 +2441,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 */
@@ -2714,6 +2798,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
@@ -2944,6 +3052,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);
+1 -1
View File
@@ -2372,7 +2372,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);
}
+9 -8
View File
@@ -1216,6 +1216,13 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha
}
}
static zend_always_inline zend_bool is_phar_file(zend_string *filename)
{
return filename && ZSTR_LEN(filename) >= sizeof(".phar") &&
!memcmp(ZSTR_VAL(filename) + ZSTR_LEN(filename) - (sizeof(".phar")-1), ".phar", sizeof(".phar")-1) &&
!strstr(ZSTR_VAL(filename), "://");
}
#ifdef HAVE_OPCACHE_FILE_CACHE
static zend_persistent_script *store_script_in_file_cache(zend_persistent_script *new_persistent_script)
{
@@ -1240,10 +1247,7 @@ static zend_persistent_script *store_script_in_file_cache(zend_persistent_script
zend_shared_alloc_destroy_xlat_table();
new_persistent_script->is_phar =
new_persistent_script->script.filename &&
strstr(ZSTR_VAL(new_persistent_script->script.filename), ".phar") &&
!strstr(ZSTR_VAL(new_persistent_script->script.filename), "://");
new_persistent_script->is_phar = is_phar_file(new_persistent_script->script.filename);
/* Consistency check */
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
@@ -1359,10 +1363,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
zend_shared_alloc_destroy_xlat_table();
new_persistent_script->is_phar =
new_persistent_script->script.filename &&
strstr(ZSTR_VAL(new_persistent_script->script.filename), ".phar") &&
!strstr(ZSTR_VAL(new_persistent_script->script.filename), "://");
new_persistent_script->is_phar = is_phar_file(new_persistent_script->script.filename);
/* Consistency check */
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
+12 -6
View File
@@ -7,16 +7,22 @@ function php_cli_server_start($ini = "") {
$php_executable = getenv('TEST_PHP_EXECUTABLE');
$doc_root = __DIR__;
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => STDERR,
);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => array("pipe", "w"),
);
$cmd = "{$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS;
$handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, $doc_root, NULL, array("bypass_shell" => true, "suppress_errors" => true));
} else {
$descriptorspec = array(
0 => STDIN,
1 => STDOUT,
2 => STDERR,
);
$cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null";
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
}
+11 -11
View File
@@ -73,7 +73,7 @@
#ifdef HAVE_OPENSSL_MD2_H
#define OPENSSL_ALGO_MD2 4
#endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
#if PHP_OPENSSL_API_VERSION < 0x10100
#define OPENSSL_ALGO_DSS1 5
#endif
#define OPENSSL_ALGO_SHA224 6
@@ -560,7 +560,7 @@ ZEND_GET_MODULE(openssl)
#endif
/* {{{ OpenSSL compatibility functions and macros */
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
#if PHP_OPENSSL_API_VERSION < 0x10100
#define EVP_PKEY_get0_RSA(_pkey) _pkey->pkey.rsa
#define EVP_PKEY_get0_DH(_pkey) _pkey->pkey.dh
#define EVP_PKEY_get0_DSA(_pkey) _pkey->pkey.dsa
@@ -677,7 +677,7 @@ static const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1)
return M_ASN1_STRING_data(asn1);
}
#if OPENSSL_VERSION_NUMBER < 0x10002000L || defined (LIBRESSL_VERSION_NUMBER)
#if PHP_OPENSSL_API_VERSION < 0x10002
static int X509_get_signature_nid(const X509 *x)
{
@@ -1237,7 +1237,7 @@ static void php_openssl_dispose_config(struct php_x509_request * req) /* {{{ */
}
/* }}} */
#if defined(PHP_WIN32) || (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER))
#if defined(PHP_WIN32) || PHP_OPENSSL_API_VERSION >= 0x10100
#define PHP_OPENSSL_RAND_ADD_TIME() ((void) 0)
#else
#define PHP_OPENSSL_RAND_ADD_TIME() php_openssl_rand_add_timeval()
@@ -1324,7 +1324,7 @@ static EVP_MD * php_openssl_get_evp_md_from_algo(zend_long algo) { /* {{{ */
mdtype = (EVP_MD *) EVP_md2();
break;
#endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
#if PHP_OPENSSL_API_VERSION < 0x10100
case OPENSSL_ALGO_DSS1:
mdtype = (EVP_MD *) EVP_dss1();
break;
@@ -1450,7 +1450,7 @@ PHP_MINIT_FUNCTION(openssl)
#ifdef HAVE_OPENSSL_MD2_H
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_MD2", OPENSSL_ALGO_MD2, CONST_CS|CONST_PERSISTENT);
#endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
#if PHP_OPENSSL_API_VERSION < 0x10100
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_DSS1", OPENSSL_ALGO_DSS1, CONST_CS|CONST_PERSISTENT);
#endif
REGISTER_LONG_CONSTANT("OPENSSL_ALGO_SHA224", OPENSSL_ALGO_SHA224, CONST_CS|CONST_PERSISTENT);
@@ -3620,7 +3620,7 @@ PHP_FUNCTION(openssl_csr_get_public_key)
RETURN_FALSE;
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
#if PHP_OPENSSL_API_VERSION >= 0x10100
/* Due to changes in OpenSSL 1.1 related to locking when decoding CSR,
* the pub key is not changed after assigning. It means if we pass
* a private key, it will be returned including the private part.
@@ -3631,7 +3631,7 @@ PHP_FUNCTION(openssl_csr_get_public_key)
/* Retrieve the public key from the CSR */
tpubkey = X509_REQ_get_pubkey(csr);
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
#if PHP_OPENSSL_API_VERSION >= 0x10100
/* We need to free the CSR as it was duplicated */
X509_REQ_free(csr);
#endif
@@ -3785,6 +3785,9 @@ static EVP_PKEY * php_openssl_evp_from_zval(
if (Z_STRLEN_P(val) > 7 && memcmp(Z_STRVAL_P(val), "file://", sizeof("file://") - 1) == 0) {
filename = Z_STRVAL_P(val) + (sizeof("file://") - 1);
if (php_openssl_open_base_dir_chk(filename)) {
TMP_CLEAN;
}
}
/* it's an X509 file/cert of some kind, and we need to extract the data from that */
if (public_key) {
@@ -3811,9 +3814,6 @@ static EVP_PKEY * php_openssl_evp_from_zval(
BIO *in;
if (filename) {
if (php_openssl_open_base_dir_chk(filename)) {
TMP_CLEAN;
}
in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(PKCS7_BINARY));
} else {
in = BIO_new_mem_buf(Z_STRVAL_P(val), (int)Z_STRLEN_P(val));
+19
View File
@@ -29,6 +29,25 @@ extern zend_module_entry openssl_module_entry;
#include "php_version.h"
#define PHP_OPENSSL_VERSION PHP_VERSION
#include <openssl/opensslv.h>
#if defined(LIBRESSL_VERSION_NUMBER)
/* LibreSSL version check */
#if LIBRESSL_VERSION_NUMBER < 0x20700000L
#define PHP_OPENSSL_API_VERSION 0x10001
#else
#define PHP_OPENSSL_API_VERSION 0x10100
#endif
#else
/* OpenSSL version check */
#if OPENSSL_VERSION_NUMBER < 0x10002000L
#define PHP_OPENSSL_API_VERSION 0x10001
#elif OPENSSL_VERSION_NUMBER < 0x10100000L
#define PHP_OPENSSL_API_VERSION 0x10002
#else
#define PHP_OPENSSL_API_VERSION 0x10100
#endif
#endif
#define OPENSSL_RAW_DATA 1
#define OPENSSL_ZERO_PADDING 2
#define OPENSSL_DONT_ZERO_PAD_KEY 4
+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
Loaded 100 of 306 files, more files were not shown because too many files have changed in this diff. Show more