Commit Graph

102 Commits

Author SHA1 Message Date
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Xinchen Hui
19befb1ca2 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #74663 (Segfault with opcache.memory_protect and validate_timestamp)
2017-05-27 22:43:23 +08:00
Xinchen Hui
60912e66c8 Fixed bug #74663 (Segfault with opcache.memory_protect and validate_timestamp) 2017-05-27 22:42:27 +08: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
Dmitry Stogov
09ac2bf752 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  "opcache.validate_root" is useless on Windows
2016-11-16 23:20:22 +03:00
Dmitry Stogov
71ee641327 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  "opcache.validate_root" is useless on Windows
2016-11-16 23:19:56 +03:00
Dmitry Stogov
935d922114 "opcache.validate_root" is useless on Windows 2016-11-16 23:15:14 +03:00
Dmitry Stogov
86460af56c Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #69090 (check cached files permissions)
2016-11-16 12:56:15 +03:00
Dmitry Stogov
a1a5b52f3b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #69090 (check cached files permissions)
2016-11-16 12:49:50 +03:00
Dmitry Stogov
ecba563f2f Fixed bug #69090 (check cached files permissions) 2016-11-16 12:43:10 +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
Dmitry Stogov
0d77222473 Merge branch 'PHP-7.0'
* PHP-7.0:
  Use PHP_VERSION as OPcahce version
2016-05-17 17:17:09 +03:00
Dmitry Stogov
d41920c57d Use PHP_VERSION as OPcahce version 2016-05-17 17:16:10 +03:00
Xinchen Hui
4fafd7309c Merge branch 'PHP-7.0'
* PHP-7.0:
  This only make sense on *nix
2016-04-12 15:31:35 +08:00
Xinchen Hui
9458f54969 This only make sense on *nix 2016-04-12 15:31:21 +08:00
Anatol Belski
2ead9be91b Merge branch 'PHP-7.0'
* PHP-7.0:
  make opcache lockfile path configurable
2016-04-06 13:50:24 +02:00
Fatih ACAR
d54eafb349 make opcache lockfile path configurable
Signed-off-by: William Dauchy <william@gandi.net>
Signed-off-by: Baptiste Daroussin <baptiste.daroussin@gandi.net>
Signed-off-by: Fatih Acar <fatih.acar@gandi.net>
2016-04-06 13:29:52 +02:00
Nikita Popov
f57c0b3249 Merge branch 'PHP-7.0' 2016-03-03 16:50:47 +01:00
Nikita Popov
1ac152938c Move semicolon into TSRMLS_CACHE_EXTERN/DEFINE
Also re bug #71575.
2016-03-03 16:50:01 +01:00
Dmitry Stogov
bbea2ae048 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed process synchronisation problem, that may cause crashes after opcache restart
2016-02-17 13:59:20 +03:00
Dmitry Stogov
d228752939 Fixed process synchronisation problem, that may cause crashes after opcache restart 2016-02-17 13:58:05 +03:00
Lior Kaplan
3d5438bf7b Merge branch 'PHP-7.0'
* PHP-7.0:
  Update header to PHP Version 7
  Happy new year (Update copyright to 2016)
  Happy new year (Update copyright to 2016)
2016-01-01 20:04:31 +02:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Dmitry Stogov
d2597ad20b Improved optimizer dubugging facility 2015-12-09 14:52:00 +03:00
Anatol Belski
4aec8bcfa9 Merge branch 'PHP-7.0'
* PHP-7.0:
  update NEWS
  Fixed bug #71024 Unable to use PHP 7.0 x64 side-by-side with PHP 5.6 x32 on the same server
2015-12-07 22:55:24 +01:00
Anatol Belski
7c981192eb Fixed bug #71024 Unable to use PHP 7.0 x64 side-by-side with PHP 5.6 x32 on the same server 2015-12-07 22:53:35 +01:00
Dmitry Stogov
09aa68b294 Break dependency between opcache and optimizer. Remove copatibility macros. 2015-11-12 02:02:24 +03:00
Anatol Belski
ffb5d0aca3 Implemented file_cache_fallback mechanism
which is essential as an attempt to fix the "failed to reattach"
error on Windows. If file_cache is enabled, Opcache will
automaticaly switch to file_cache_only mode in the case a process
failed to map the shared segment at the required address. The
important small part of the SHM will still be mapped, which
allows information exchange between normal processes using SHM
and those using the fallback mechanism.

This is based on Dmitry's, Matt's and mine ideas. So many thanks for
support!
2015-10-09 23:47:59 +02:00
Dmitry Stogov
c104d329e1 Use shorter php.ini directive name "opcache.huge_code_pages" and disable it by default. 2015-09-15 01:54:04 +03:00
Dmitry Stogov
669f0b39b1 Added an experemental ability to move PHP code pages (PHP TEXT segment) into HUGE pages.
PHP should be configured and built with --enable-huge-code-pages, OS should be configured to provide huge pages.
It's possible to enable/disable this future in php.ini through opcache.enable_huge_code_pages=0/1.
The feature was tested on Linux and provided 2% improvement on real-life apps, because of 2-3 times reduction in number of iTLB misses.
2015-09-14 13:34:17 +03:00
Dmitry Stogov
0a21a0c752 Removed opcache.load_comments configuration directive. Now doc comments loading costs nothing and always enabled. 2015-06-15 13:18:52 +03:00
Dmitry Stogov
3abde43231 Added experimental (disabled by default) file based opcode cache. 2015-05-06 23:46:49 +03:00
Xinchen Hui
24992a1422 Merge branch 'PHP-5.5' into PHP-5.6 2015-05-05 11:06:14 +08:00
Xinchen Hui
cf3e976c3b Update version 2015-05-05 11:06:04 +08:00
Dmitry Stogov
770cb1da71 Keep realpath and PCRE caches in consistency with opcache SHM. 2015-04-22 02:29:06 +03:00
Xinchen Hui
5255ea42b5 What should we version the bundled opcache? 2015-04-14 16:20:01 +08:00
Dmitry Stogov
53d8e5fc63 Improved hash key manangement code 2015-03-06 16:26:40 +03:00
Dmitry Stogov
28e42b1ded Improved hash key manangement code 2015-03-06 02:13:47 +03:00
Anatol Belski
af3ca74501 made ZEND_TSRMLS_CACHE_* macros look like function calls
which also comply with the current semantics for such macros
2015-02-16 17:19:32 +01:00
Dmitry Stogov
9d5d736869 Avoid repeatable calls to strstr() 2015-02-09 22:42:37 +03:00
Xinchen Hui
fc33f52d8c bump year 2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Xinchen Hui
73c1be2653 Bump year 2015-01-15 23:26:03 +08:00
Anatol Belski
bdeb220f48 first shot remove TSRMLS_* things 2014-12-13 23:06:14 +01:00
Anatol Belski
c6bad96f30 Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (398 commits)
  NEWS
  add test for bug #68381
  Fixed bug #68381 Set FPM log level earlier during init
  proper dllexport
  move to size_t where zend_string is used internally
  fix some datatype mismatches
  return after the warning, to fix uninitialized salt usage
  fix datatype mismatches
  add missing type specifier
  fix datatype mismatches
  fix unsigned check
  "extern" shouldn't be used for definitions
  joined identical conditional blocks
  simplify fpm tests
  SEND_VAR_NO_REF optimization
  Add test for bug #68442
  Add various tests for FPM - covering recent bugs (68420, 68421, 68423, 68428) - for UDS - for ping and status URI - for multi pool and multi mode
  Include small MIT FastCGI client library from https://github.com/adoy/PHP-FastCGI-Client
  Get rid of zend_free_op structure (use zval* instead). Get rid of useless TSRMLS arguments.
  Add new FPM test for IPv4/IPv6
  ...

Conflicts:
	win32/build/config.w32
2014-11-18 21:18:52 +01:00
Dmitry Stogov
2afb5df4da Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix opcache.revalidate_freq per-request behavior

Conflicts:
	ext/opcache/ZendAccelerator.h
2014-11-07 10:24:25 +03:00
Dmitry Stogov
e6581d52cc Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix opcache.revalidate_freq per-request behavior
2014-11-07 10:17:48 +03:00
Dmitry Stogov
033abd6d77 Fix opcache.revalidate_freq per-request behavior 2014-11-07 10:16:25 +03:00