1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 08:58:28 +02:00
Commit Graph

644 Commits

Author SHA1 Message Date
Christoph M. Becker fa70b91a4f Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix #75273: php_zlib_inflate_filter() may not update bytes_consumed
2018-09-08 19:09:56 +02:00
Christoph M. Becker 90d863898c Fix #75273: php_zlib_inflate_filter() may not update bytes_consumed
Whenever we return with `PSFS_PASS_ON`, we need to update
`bytes_consumed` to not mislead the caller.  Instead of fixing the
respective `if` clauses, we eschew the early bail-outs to simplify the
code a bit.
2018-09-08 19:01:36 +02:00
Peter Kokot fab7d9f577 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #76709: Minimal required zlib library is 1.2.0.4
2018-08-06 09:39:33 +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 eceecb6900 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #65988: Zlib version check fails
2018-08-06 06:15:51 +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
Xinchen Hui 7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Christoph M. Becker 1f150fcde1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix Bug #75299 Wrong reflection on inflate_init and inflate_add
2017-10-11 17:30:45 +02:00
Christoph M. Becker d3d23e0cb8 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix Bug #75299 Wrong reflection on inflate_init and inflate_add
2017-10-11 17:29:36 +02:00
Fabien Villepinte 9d9873b3b5 Fix Bug #75299 Wrong reflection on inflate_init and inflate_add 2017-10-01 11:27:16 +02:00
Anatol Belski 07c7445dd0 fix datatype 2017-07-10 17:34:58 +02:00
Anatol Belski 7360e6a36f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Revert "Add more constants, improve comments, and add tests"
2017-07-10 17:01:25 +02:00
Anatol Belski a797421e98 Revert "Add more constants, improve comments, and add tests"
This reverts commit 0c4f11ecaa.
2017-07-10 16:53:56 +02:00
Tom Van Looy 04fb3f28ff Remove superfluous semicolons 2017-06-26 00:23:25 +02:00
Bob Weinand a1755671e2 Merge branch 'PHP-7.1' 2017-06-25 20:15:31 +02:00
Bob Weinand 44d734254a Merge branch 'PHP-7.0' into PHP-7.1 2017-06-25 20:13:48 +02:00
Matthew Trescott 0c4f11ecaa Add more constants, improve comments, and add tests 2017-06-25 20:12:45 +02:00
Nikita Popov 191f154d40 Merge branch 'PHP-7.1' 2017-06-25 15:32:38 +02:00
Nikita Popov bda0f4e8dc Merge branch 'PHP-7.0' into PHP-7.1 2017-06-25 15:30:29 +02:00
wapmorgan cd1869bcf2 Remove invalid check of dictionary content and add initialization of dictionary if raw compression used 2017-06-25 10:53:28 +02:00
Anatol Belski f3c4e2f5bf extend zlib export required for the recent libpng 2017-04-23 21:33:14 +02:00
Anatol Belski 103ebbcb7a yet one more export required from newer zlib 2017-04-23 21:29:40 +02:00
Anatol Belski bbd37771f6 Merge branch 'PHP-7.1'
* PHP-7.1:
  extend zlib export required for the recent libpng
2017-04-23 21:29:04 +02:00
Anatol Belski 144ddd3b42 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  extend zlib export required for the recent libpng
2017-04-23 21:28:26 +02:00
Anatol Belski 2909742326 extend zlib export required for the recent libpng 2017-04-23 21:27:34 +02:00
Anatol Belski ba64ec0b13 improve zlib version check for tests 2017-03-22 11:08:38 +01:00
Anatol Belski f258e9b803 make test more flexible to match different compressed strings
particurarly needed with zlib 1.2.11
2017-03-22 11:08:37 +01:00
Bob Weinand 8a7a1411b9 Merge branch 'PHP-7.1' 2017-03-15 00:09:59 +01:00
Bob Weinand f3ab4c1a08 Merge branch 'PHP-7.0' into PHP-7.1 2017-03-15 00:09:42 +01:00
Matt Bonneau 7fba8bda4c Fixed bug #74240 (deflate_add can allocate too much memory) 2017-03-15 00:08:32 +01:00
Nikita Popov f25f469088 Merge branch 'PHP-7.1' 2017-01-08 13:48:54 +01:00
Nikita Popov b38e6a54cf Merge branch 'PHP-7.0' into PHP-7.1 2017-01-08 13:48:48 +01:00
Nikita Popov b36f4ac708 deflate_add(): Don't add unnecessary +1 to size
zend_string_realloc will do this by itself.
2017-01-08 13:47:20 +01:00
Sammy Kaye Powers dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers 478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Sammy Kaye Powers 9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Bob Weinand 712c532ab9 Merge branch 'PHP-7.1' 2016-12-22 15:31:58 +01:00
Bob Weinand 898e439333 Merge branch 'PHP-7.0' into PHP-7.1 2016-12-22 15:31:39 +01:00
Bob Weinand 8823b68c41 Fixed bug #73373 (deflate_add does not verify that output was not truncated) 2016-12-22 15:29:36 +01:00
Pedro Magalhães 9c5af4e4cb Remove the b prefix from literals on unrelated tests 2016-11-20 21:11:53 +01:00
Anatol Belski 42b7912f03 catch up with stream datatypes 2016-10-05 22:53:21 +02:00
Christoph M. Becker c2b29a58bc Merge branch 'PHP-7.0' 2016-07-04 03:20:01 +02:00
Christoph M. Becker 60fc27f912 Merge branch 'PHP-5.6' into PHP-7.0 2016-07-04 03:18:50 +02:00
Christoph M. Becker 717a043a32 Fix typo in comment 2016-07-04 03:17:17 +02:00
Dmitry Stogov 323b2733f6 Fixed compilation warnings 2016-06-22 00:40:50 +03:00
Dmitry Stogov 1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Anatol Belski 3d3f11ede4 Fixed the UTF-8 and long path support in the streams on Windows.
Since long the default PHP charset is UTF-8, however the Windows part is
out of step with this important point. The current implementation in PHP
doesn't technically permit to handle UTF-8 filepath and several other
things. Till now, only the ANSI compatible APIs are being used. Here is more
about it

https://msdn.microsoft.com/en-us/library/windows/desktop/dd317752%28v=vs.85%29.aspx

The patch fixes not only issues with multibyte filenames under
incompatible codepages, but indirectly also issues with some other multibyte
encodings like BIG5, Shift-JIS, etc. by providing a clean way to access
filenames in UTF-8. Below is a small list of issues from the bug tracker,
that are getting fixed:

https://bugs.php.net/63401
https://bugs.php.net/41199
https://bugs.php.net/50203
https://bugs.php.net/71509
https://bugs.php.net/64699
https://bugs.php.net/64506
https://bugs.php.net/30195
https://bugs.php.net/65358
https://bugs.php.net/61315
https://bugs.php.net/70943
https://bugs.php.net/70903
https://bugs.php.net/63593
https://bugs.php.net/54977
https://bugs.php.net/54028
https://bugs.php.net/43148
https://bugs.php.net/30730
https://bugs.php.net/33350
https://bugs.php.net/35300
https://bugs.php.net/46990
https://bugs.php.net/61309
https://bugs.php.net/69333
https://bugs.php.net/45517
https://bugs.php.net/70551
https://bugs.php.net/50197
https://bugs.php.net/72200
https://bugs.php.net/37672

Yet more related tickets can for sure be found - on bugs.php.net, Stackoverflow
and Github. Some of the bugs are pretty recent, some descend to early
2000th, but  the user comments in there last even till today. Just for example,
bug #30195 was opened in 2004, the latest comment in there was made in 2014. It
is certain, that these bugs descend not only to pure PHP use cases, but get also
redirected from the popular PHP based projects. Given the modern systems (and
those supported by PHP) are always based on NTFS, there is no excuse to keep
these issues unresolved.

The internalization approach on Windows is in many ways different from
UNIX and Linux, while it supports and is based on Unicode. It depends on the
current system code page, APIs used and exact kind how the binary was compiled
The locale doesn't affect the way Unicode or ANSI API work. PHP in particular
is being compiled without _UNICODE defined and this is conditioned by the
way we handle strings. Here is more about it

https://msdn.microsoft.com/en-us/library/tsbaswba.aspx

However, with any system code page ANSI functions automatically convert
paths to UTF-16. Paths in some encodings incompatible with the
current system code page, won't work correctly with ANSI APIs. PHP
till now only uses the ANSI Windows APIs.

For example, on a system with the current code page 1252, the paths
in cp1252 are supported and transparently converted to UTF-16 by the
ANSI functions. Once one wants to handle a filepath encoded with cp932 on
that particular system, an ANSI or a POSIX compatible function used in
PHP will produce an erroneous result. When trying to convert that cp932 path
to UTF-8 and passing to the ANSI functions, an ANSI function would
likely interpret the UTF-8 string as some string in the current code page and
create a filepath that represents every single byte of the UTF-8 string.
These behaviors are not only broken but also disregard the documented
INI settings.

This patch solves the issies with the multibyte paths on Windows by
intelligently enforcing the usage of the Unicode aware APIs. For
functions expect Unicode (fe CreateFileW, FindFirstFileW, etc.), arguments
will be converted to UTF-16 wide chars. For functions returning Unicode
aware data (fe GetCurrentDirectoryW, etc.), resulting wide string is
converted back to char's depending on the current PHP charset settings,
either to the current ANSI codepage (this is the behavior prior to this patch)
or to UTF-8 (the default behavior).

In a particular case, users might have to explicitly set
internal_encoding or default_charset, if filenames in ANSI codepage are
necessary. Current tests show no regressions and witness that this will be an
exotic case, the current default UTF-8 encoding is compatible with any
supported system. The dependency libraries are long switching to Unicode APIs,
so some tests were also added for extensions not directly related to streams.
At large, the patch brings over 150 related tests into the core. Those target
and was run on various environments with European, Asian, etc. codepages.
General PHP frameworks was tested and showed no regressions.

The impact on the current C code base is low, the most places affected
are the Windows only places in the three files tsrm_win32.c, zend_virtual_cwd.c
and plain_wrapper.c. The actual implementation of the most of the wide
char supporting functionality is in win32/ioutil.* and win32/codepage.*,
several  low level functionsare extended in place to avoid reimplementation for
now. No performance impact was sighted. As previously mentioned, the ANSI APIs
used prior the patch perform Unicode conversions internally. Using the
Unicode  APIs directly while doing custom conversions just retains the status
quo. The ways to optimize it are open (fe. by implementing caching for the
strings converted to wide variants).

The long path implementation is user transparent. If a path exceeds the
length of _MAX_PATH, it'll be automatically prefixed with \\?\. The MAXPATHLEN
is set to 2048 bytes.

Appreciation to Pierre Joye, Matt Ficken, @algo13 and others for tips, ideas
and testing.

Thanks.
2016-06-20 12:45:39 +02:00
Anatol Belski 1cca3eb7c8 fix test portability 2016-06-13 15:47:08 +02:00
Nikita Popov 1ac152938c Move semicolon into TSRMLS_CACHE_EXTERN/DEFINE
Also re bug #71575.
2016-03-03 16:50:01 +01:00