Apparently, the presence of `cpuid.h` is not necessarily sufficient to
guarantee the availability of `__cpuid_count()`. We therefore test for
the latter explicitly.
Dan Wallis [Mon, 5 Nov 2018 13:27:06 +0000 (14:27 +0100)]
Fix #77105: Use position:sticky for <th> in `phpinfo()`
This ensures tables remain legible when scrolling. If the user agent
does not support this feature, then it will gracefully degrade to
existing behaviour.
This patch implements: https://bugs.php.net/bug.php?id=77105
Anatol Belski [Sun, 4 Nov 2018 12:11:28 +0000 (13:11 +0100)]
Rework places in libmagic regarding previous CVE-2014-3538 fixes
CVE-2014-3538 was fixed upstream, but the old patch was still kept in
the PHP port. This patch causes performance regressions when PCRE JIT is
not enabled. This is fixed by applying the relevant original code from
the newer libmagic, which makes the old patch obsolete as the
CVE-2014-3538 tests still pass.
Anatol Belski [Sat, 3 Nov 2018 19:29:51 +0000 (20:29 +0100)]
Change the way JIT availability is checked
The pcre2_jit_compile_8 sysmbol is always available, even JIT might be
not. If JIT is not enabled explicitly and is enabled in the PHP runtime,
this will lead to a malfunction. This approach ensures JIT is indeed
available on the given platform. For cross compilation this might get
complicated, as it would require an explicit processor architecture and
PCRE2 version check.
Another solution for this case is to run pcre2_config at runtime. That
however would require more condition checks that would impact
architectures where JIT is available.
Fix #71592: External entity processing never fails
If the callback set via `xml_set_external_entity_ref_handler()` returns
a falsy value, parsing is supposed to stop and the error number set to
`XML_ERROR_EXTERNAL_ENTITY_HANDLING`. This is already correctly done
by the libexpat binding, but the libxml2 binding ignores the return
value. We fix this by calling `xmlStopParser()` which is available as
of libxml 2.1.0[1] (PHP-7.1 requires at least libxml 2.6.11 anyway),
and setting the desired `errNo` ourselves.
Dmitry Stogov [Thu, 25 Oct 2018 17:30:51 +0000 (20:30 +0300)]
Improved shared interned strings handling. The previous implementation worked incorrectly in ZTS build. It changed strings only in function/class tables of one thread. Now all threads gets the same shared interned strings. Also, on shutdown, we don't try to replace SHM interned strings back to process strings, but delay dettachment of SHM instead.
Peter Kokot [Wed, 24 Oct 2018 15:06:21 +0000 (17:06 +0200)]
Remove ext/json parser files generated by bison
The parser files for ext/json are generated by bison from the *.y file.
Parser files in Zend and sapi/phpdbg already follow such approach of
these files being ignored from tracking in the Git repository and they
are shipped via the release packages later on. This way the end users
still don't need to have bison dependency installed to install PHP.
The genfiles script was refactored to generate the ext/json parser and
lexer files.
Peter Kokot [Fri, 19 Oct 2018 23:05:00 +0000 (01:05 +0200)]
Fix run-tests.php for running phpdbg and certain test sections
Certain sections, such as --EXTENSIONS--, --SKIPIF--, and --CLEAN--
require to be executed using only PHP CLI or PHP CGI SAPIs and cannot be
processed with the phpdbg.
Peter Kokot [Thu, 18 Oct 2018 06:56:38 +0000 (08:56 +0200)]
Normalize .gitignore
Changes:
- Added introductory paragraph to explain the file for newcomers and
where to ignore local editor configurations as a common practice
when using Git.
- Patterns organized into several main context sections for a better
overview of the php-src directory structure and which files get
generated where.
- Added comments describing reasons for ignoring particular file(s).
- Patterns normalized according to Git ignore blob patterns. Absolute
paths are different than relative paths and similar fixes.
- Folders patterns have appended ending slash for readability to
distinguish them from files.
Removed ignore patterns:
- Removed `sapi/phpdbg/build` pattern since it doesn't seem to be
relevant anymore in the php-src repository.
- The `acconfig.h` pattern removed in favor of the more recent Autoconf
versions.
- Removed patterns for `.FBCIndex` `.FBCLockFolder` folders. These were
generated on old Mac OS systems [1] using the Sherlock [2] software
and can be today ignored using a global gitignore file if needed.
Newer macOS systems don't generate these anymore.
- Removed `php_version.h` pattern since the `main/php_version.h` file is
tracked by Git.
- Removed `*.mk` pattern since few *.mk files are tracked by Git and new
ones aren't generated during build process.
- Removed `**/tests/**/*.txt` pattern. This has been refactored via 595a395cb911a4ef54cbaf11cd0056d38316c87c and current tests also clean
the generated `*.txt` files as soon as they are executed. Since there
are several `*.txt` files in the repository tracked by Git already and
renaming them would be counter productive so the pattern is now removed.
In case there will be a need to adjust it, we can rename the generated
`*.txt` into something else instead (ideally into `*.tmp`) to not
conflict with already tracked `*.txt` files in tests.
- Removed `ext/*/scan_makefile_in.awk` and `scan_makefile_in.awk` patterns
since these are already included in the `/ext/*/build/` pattern.
- Removed the `/ext/*/libs.mk` pattern since these auxilary Makefiles
have been used in previous build system and made obsolete via the commit 9d9d39a0de3bec962c343051011f5a2ed7d7b242.
- Removed pattern for configuration header `ext/pdo_sqlite/sqlite3.h` since
it is not generated anymore in the current code.
- Removed `main/streams/build-defs.h` pattern since this file is not
generated.
- Removed `test.php3` pattern. These don't seem to be present in the current
PHP source code nor used since PHP 3.
- Removed `/ext/oci8/tests/*.vglog` pattern since the tests don't seem to
produce these files.
- Removed pattern for Visual Studio's `*.ncb` files. Since the Visual
Studio 2010 they are no longer used.
- Removed `ext/sqlite3/tests/phpsql*` pattern. It was part of the `ext/sqlite/tests`.
- Removed `shlibtool` pattern since the shlibtool file is not generated
anymore. It was once part of the libtool usage and customized naming
used in the previous build system in Makefiles. Such naming was later
removed and only libtool was used.
- Removed `meta_ccld` pattern since it is no longer relevant via a5b55416f4bf48e475b30bb86b120c83efccca53
- Pattern `meta_cc` has been removed via e5176fe60a9ffbe211ee016acdcddb18118e4487.
- Pattern `dynlib.m4` removed since the file is no longer generated via 9d9d39a0de3bec962c343051011f5a2ed7d7b242
- Pattern `debug.log` removed since the Autoconf Macro PHP_DEBUG_MACRO
is not called anymore and this file not generated anymore.
- Pattern `results.txt` removed. It was once part of the logging results
of test files by Netware and previous Windows builds.
- Removed `_libs` pattern in favor of only `.libs`. These directories
were once generated by Automake and Libtool on systems that didn't
support the dot folder `.libs` (MS-DOS).
- Removed `*.opt` pattern since it was used by Visual Studio 6. Later
versions of Visual Studio don't use these anymore.
- Removed `*.plg` pattern. It was build log generated by Visual Studio 6.
- Removed `core` pattern since it was probably related to commit fd7153b0f3047e6a96344dc3b4ca2632d5acc898 and is today not used.
- Removed ˙*.˙, ˙diff`, and ˙*.tgz` patterns since they don't seem to be
generated in the current code on the first glance. In case these will be
one day required to ignore again, they can be simply added back again.
- Removed Emacs specific interlock files pattern `.#*`. The number of
editors and IDEs specific files is very big. Emacs editors also produce
some other files such as `#*#` for autosave feature, which were previously
not ignored. To fully and properly support all additional patterns these
could be added to .gitignore files. A much more sustainable and better
practice is to use a global gitignore file on the local system or the
`.git/info/exclude` per repository basis for these in particular.
Added patterns:
- Added new pattern for `*.obj` standard object files in the Windows
section. These are generated by Visual Studio.
- Added `/ext/*/run-tests.php` patterns for extensions.
- Reversed patterns for particular tracked `/win32/build/Makefile`, `config.h`
files and `.patch` files.
- Added patterns for generated dtrace files `/ext/oci8/oci8_dtrace_gen.h`
Other changes:
- All `conftest*` patterns merged into a single one.
- Pattern `*.mem` made more specific where the memory check files get
generated by `run-tests.php -m`, i.e. `**/tests/**/*.mem`.
- Fixed `/Zend/zend_dtrace_gen.h.bak` `hbak` typo.
Peter Kokot [Sat, 20 Oct 2018 20:06:04 +0000 (22:06 +0200)]
Remove phpdbg parser files generated by bison
The parser files for phpdbg are generated by bison from the *.y file.
Parser files in Zend already follows such approach of these files being
ignored from tracking in the Git repository and they are shipped via
the release packages. This way the end user still don't need to have
bison dependency installed to install PHP.
The genfiles script was refactored to generate the phpdbg parser and lexer
files.
Empty comment in phpdbg parser y template file has been changed to the
YACC compliant /* empty */ instead of custom one.