1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Commit Graph

435 Commits

Author SHA1 Message Date
Peter Kokot
52dba99d47 Sync headers installation
This syncs the installed sapi and extension headers on *nix and Windows
systems by installing only what is intended outside of php-src.

- ext/gd: without gd_arginfo.h and gd_compat.h
- ext/hash: php_hash_joaat.h and php_hash_fnv.h added also on Windows
  installation; xxhash/xxhash.h added on both installations as it is
  included in php_hash_xxhash.h; Include path for xxhash.h changed to
  relative so the php_hash_xxhash.h can be included outside of php-src;
  Redundant include flags removed
- ext/iconv: without iconv_arginfo.h
- ext/mysqli: mysqli_mysqlnd.h was missing on Windows
- ext/phar: php_phar.h was missing on Windows
- ext/sodium: php_libsodium.h was missing on *nix
- ext/xml: without xml_arginfo.h
- sapi/cli: cli.h was missing on Windows

Closes GH-13210
Closes GH-13213
2024-01-28 19:50:55 +01:00
Niels Dossche
043daeeec1 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crashes with entity references and predefined entities
2024-01-17 19:41:32 +01:00
Niels Dossche
120bd364aa Fix crashes with entity references and predefined entities
Closes GH-13004.
2024-01-17 19:41:22 +01:00
Niels Dossche
03547f6832 Remove properties field from php_libxml_node_object (#13062)
This shrinks the struct from 80 bytes to 72 bytes.
This was unused internally, I did not find users externally via GitHub
search.
The intention for this was that it could be used for attaching extra
data as a 3rd party to a node. However, there are better mechanisms for
that like using actual objects.
2024-01-03 20:03:56 +01:00
Niels Dossche
76f24d3531 Merge branch 'PHP-8.3'
* PHP-8.3:
  Revert "Fix crashes with entity references and predefined entities"
2023-12-23 17:31:28 +01:00
Niels Dossche
5f69232b53 Revert "Fix crashes with entity references and predefined entities"
This reverts commit 3fa5af8496.
2023-12-23 17:31:18 +01:00
Niels Dossche
c293de792f Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix libxml2 build for 2.12.0-2.12.2
2023-12-23 17:21:34 +01:00
Niels Dossche
bb007438e2 Fix libxml2 build for 2.12.0-2.12.2 2023-12-23 17:20:52 +01:00
Niels Dossche
f420ea84aa Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix crashes with entity references and predefined entities
  Fix crash in adoptNode with attribute references
2023-12-23 17:01:28 +01:00
Niels Dossche
3fa5af8496 Fix crashes with entity references and predefined entities
There's two issues here:
- freeing of predefined entity declaration crashes (unique to 8.3 & master)
- using multiple entity references for a single entity declaration crashes
  (since forever)

The fix for the last issue is fairly easy to do on 8.3, but may require a
slightly different approach on 8.2. Therefore, for now this is 8.3-only.

Closes GH-13004.
2023-12-23 17:00:57 +01:00
Niels Dossche
34ec4b3568 More testing of mime_sniff and fix off-by-one causing trailing whitespace to not be always stripped (#12935) 2023-12-12 17:44:36 +01:00
Niels Dossche
90eb5679d2 Cleanup libxml_get_external_entity_loader() (#12893)
We can directly put the value into return_value instead of copying
things around.
2023-12-08 18:44:46 +01:00
Niels Dossche
f3ee902c3d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport deprecation warning ignores to unbreak CI
2023-12-06 22:18:12 +01:00
Niels Dossche
e2d97314ab Backport deprecation warning ignores to unbreak CI
In master I use ZEND_DIAGNOSTIC_IGNORED_START, but that doesn't exist on
8.2 or 8.3 (8.3 has a similar macro though).
So to unbreak CI I just made a variation of this directly in the
php_libxml.h header.

See 683e787860 (commitcomment-134301083)

Closes GH-12887.
2023-12-06 22:17:27 +01:00
Niels Dossche
58fc521713 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix libxml2 2.12 build due to API breaks
2023-12-01 18:07:58 +01:00
Niels Dossche
f61f8d439c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix libxml2 2.12 build due to API breaks
2023-12-01 18:07:13 +01:00
Niels Dossche
0a39890c96 Fix libxml2 2.12 build due to API breaks
See https://github.com/php/php-src/actions/runs/7062192818/job/19225478601
2023-12-01 18:03:37 +01:00
Niels Dossche
ae83d6ab07 Fix issues related to libxml2 2.12.0 (#12802)
* Avoid passing NULL to xmlSwitchToEncoding

This otherwise switches to UTF-8 on libxml2 2.12.0

* Split tests for different error reporting behaviour in libxml2 2.12.0

* Avoid deprecation warnings for libxml2 2.12.0

We can't fully get rid of the parser globals as there are still APIs
that implicitly use them.

* Temporarily disable part of test for libxml 2.12.0 regression

See https://gitlab.gnome.org/GNOME/libxml2/-/issues/634

* Review fixes

* [ci skip] Update test description
2023-11-29 20:46:35 +01:00
Niels Dossche
6f215e0727 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
  Fix GH-12702: libxml2 2.12.0 issue building from src
2023-11-17 19:58:57 +01:00
Niels Dossche
2b42b73c0b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
  Fix GH-12702: libxml2 2.12.0 issue building from src
2023-11-17 19:58:31 +01:00
Niels Dossche
8a95e616b9 Fix GH-12702: libxml2 2.12.0 issue building from src
Fixes GH-12702.

Co-authored-by: nono303 <github@nono303.net>
2023-11-17 19:46:30 +01:00
Niels Dossche
1492be5286 [RFC] DOM HTML5 parsing and serialization support (#12111) 2023-11-13 20:18:19 +01:00
Niels Dossche
10ef903bf4 [ci skip] Update bug link to non-obsolete bugtracker to avoid link rot 2023-10-29 17:58:02 +01:00
Ilija Tovilo
f39b5c4c25 Close PHP tags in tests
Closes GH-12422
2023-10-18 17:34:10 +02:00
Niels Dossche
7e0495481a Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix compile error when php_libxml.h is included in C++
2023-10-15 11:48:40 +02:00
Niels Dossche
0cab865275 Fix compile error when php_libxml.h is included in C++
See https://github.com/php/pecl-xml-xmldiff/issues/1
2023-10-15 11:48:14 +02:00
George Peter Banyard
52de0950f4 ext/libxml: Use new F ZPP modifier 2023-10-10 13:44:21 +01:00
Niels Dossche
07003137dc Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] Add xml and simplexml dependency to EXTENSIONS section in test
2023-10-07 21:14:32 +02:00
Niels Dossche
d3273c13cb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] Add xml and simplexml dependency to EXTENSIONS section in test
2023-10-07 21:14:24 +02:00
Niels Dossche
325b2b4a56 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] Add xml and simplexml dependency to EXTENSIONS section in test
2023-10-07 21:13:47 +02:00
Niels Dossche
6bb536e3f6 [ci skip] Add xml and simplexml dependency to EXTENSIONS section in test 2023-10-07 21:13:30 +02:00
Niels Dossche
b56141c5dd Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix broken cache invalidation with deallocated and reallocated document node
2023-10-01 17:07:11 +02:00
Niels Dossche
eebc528cbf Fix broken cache invalidation with deallocated and reallocated document node
The original caching implementation had an oversight in combination with
the new lifetime management in DOM for 8.3.
The modification counter is stored on the document object itself, but as
that can get deallocated when all references disappear, stale cache data
can be used. Normally this isn't a problem, unless getElementsByTagName is
called not on the document but on a child node. Fix it by moving caching
data into the ref object, which will outlive all nodes from a document
even if the document object disappears.

Closes GH-12338.
2023-10-01 17:06:02 +02:00
Niels Dossche
5fd89652e5 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix compile error with -Werror=incompatible-function-pointer-types and old libxml2
  Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  Fix type error on XSLTProcessor::transformToDoc return value with SimpleXML
2023-09-30 00:12:42 +02:00
Niels Dossche
df89409aba Fix compile error with -Werror=incompatible-function-pointer-types and old libxml2
libxml2 prior to 2.9.8 had a different signature for xmlHashScanner.
This signature changed in e03f0a199a
Use an #if to work around the incompatible signature.

Closes GH-12326.
2023-09-30 00:12:20 +02:00
Niels Dossche
0b7a0e9f41 Merge branch 'PHP-8.3'
* PHP-8.3:
  Restore old namespace reconciliation behaviour
2023-09-27 22:41:09 +02:00
Niels Dossche
6a2b885155 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Restore old namespace reconciliation behaviour
2023-09-27 22:40:37 +02:00
Niels Dossche
6a7b96529b Remove unnecessary libxml2 version checks
The minimum required version is 2.9.0. So these checks are useless.
2023-09-24 00:17:52 +02:00
David CARLIER
e648d39e3b libxml set error structure simplification proposal (#12054) 2023-08-26 12:11:50 +01:00
Niels Dossche
e1cb721679 Improve warning when returning null from the resolver set by libxml_set_external_entity_loader
Fixes GH-11952.
Closes GH-12022.
2023-08-24 21:23:29 +02:00
Niels Dossche
bb092ab4c6 Fix #80927: Removing documentElement after creating attribute node: possible use-after-free
Closes GH-11892.
2023-08-12 18:49:12 +02:00
Niels Dossche
5018dfecdf Remove useless hashmap check
php_libxml_unlink_entity is called from a hashmap iterator, so using
xmlHashLookup to check if it comes from that hashmap will always be
true.
2023-08-07 19:53:20 +02:00
Derick Rethans
86afbe10e2 Merge branch 'PHP-8.2' 2023-07-31 19:57:02 +01:00
Derick Rethans
deddf4692a Merge branch 'PHP-8.1' into PHP-8.2 2023-07-31 19:54:44 +01:00
Derick Rethans
0870ebb862 Merge branch 'PHP-8.0' into PHP-8.1 2023-07-31 19:53:43 +01:00
Niels Dossche
c283c3ab0b Sanitize libxml2 globals before parsing
Fixes GHSA-3qrf-m4j2-pcrr.

To parse a document with libxml2, you first need to create a parsing context.
The parsing context contains parsing options (e.g. XML_NOENT to substitute
entities) that the application (in this case PHP) can set.
Unfortunately, libxml2 also supports providing default set options.
For example, if you call xmlSubstituteEntitiesDefault(1) then the XML_NOENT
option will be added to the parsing options every time you create a parsing
context **even if the application never requested XML_NOENT**.

Third party extensions can override these globals, in particular the
substitute entity global. This causes entity substitution to be
unexpectedly active.

Fix it by setting the parsing options to a sane known value.
For API calls that depend on global state we introduce
PHP_LIBXML_SANITIZE_GLOBALS() and PHP_LIBXML_RESTORE_GLOBALS().
For other APIs that work directly with a context we introduce
php_libxml_sanitize_parse_ctxt_options().
2023-07-31 19:47:19 +01:00
George Peter Banyard
a17e84f2f7 libxml_get_external_entity_loader(): test for incompatible resource being loaded (#11728)
A stream resource is expected to be returned by the handler.
2023-07-21 11:56:15 +01:00
Remi Collet
fde4386648 cast _private to avoid [-fpermissive] error 2023-07-20 07:55:01 +02:00
Niels Dossche
75229cb127 Cleanup php_libxml_node_decrement_resource()
obj_node is already checked, so checking it again in the second if is
not necessary.
Merge declarations and assignments while we're at it.
2023-07-11 11:47:54 +02:00
Niels Dossche
003ebdd039 Fix GH-9628: Implicitly removing nodes from \DOMDocument breaks existing references
Change the way lifetime works in ext/libxml and ext/dom

Previously, a node could be freed even when holding a userland reference
to it. This resulted in exceptions when trying to access that node after
it has been implicitly or explicitly removed. After this patch, a node
will only be freed when the last userland reference disappears.

Fixes GH-9628.
Closes GH-11576.
2023-07-03 21:31:57 +02:00