1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 07:28:09 +02:00
Commit Graph

299 Commits

Author SHA1 Message Date
Peter Kokot bee84c0468 Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02:00
Niels Dossche 4cab7f90a1 [RFC] Implement XMLReader::fromUri() and XMLReader::fromString() 2024-06-29 09:04:35 -07:00
Niels Dossche acf2762857 [RFC] Add stream open functions to XML{Reader,Writer}
RFC: https://wiki.php.net/rfc/xmlreader_writer_streams
2024-06-29 09:04:35 -07:00
Arnaud Le Blanc 11accb5cdf Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Peter Kokot dd4e2ef5b0 Update ext/xmlreader dependencies (#14572)
- ext/dom is optional (using HAVE_DOM for cases when dom is build as
  a shared extension to make it required in that case)
- ext/libxml is required
2024-06-15 16:25:26 +02:00
Niels Dossche d934840f44 Fix deprecation warning 2024-05-10 16:26:44 +02:00
Niels Dossche 94479fefe5 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14183: XMLReader::open() can't be overridden
2024-05-10 15:58:48 +02:00
Niels Dossche d2970cc81f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14183: XMLReader::open() can't be overridden
2024-05-10 15:58:14 +02:00
Niels Dossche 15813d69a5 Fix GH-14183: XMLReader::open() can't be overridden
We should only return the override if the internal static method is matched.

Closes GH-14194.
2024-05-10 15:57:09 +02:00
Niels Dossche b3700e29cc Simplify prop handler of XMLReader (#14023)
As XMLReader only exposes a single class, and the property handlers are
statically set, we don't need to store the pointer to the property
handler table inside the object.
This simplifies the code and reduces the memory required for XMLReader.
2024-04-20 23:22:38 +02:00
Máté Kocsis b06c95b631 Declare the missing true return types (#13709) 2024-03-16 07:26:37 +01:00
Niels Dossche 63bb04e5bf Simplify DOM_RET_OBJ macro 2024-03-10 11:08:46 +01:00
Ayesh Karunaratne 353d4ce075 ext/xmlreader: Add class constant types to stub (#13596)
Declares class constant types for the `XMLReader` class.
2024-03-05 20:50:54 +01:00
Niels Dossche 6d721b21a1 Use string literal equality helper function in xmlreader_get_method 2024-02-25 16:25:52 +01:00
Niels Dossche da1a9402f8 Set xmlreader property handler hash size to a precalculated value 2024-02-25 16:25:52 +01:00
Niels Dossche 7f080d3584 Don't put xmlreader prop handler data on the heap 2024-02-25 16:25:52 +01:00
Niels Dossche 06a89a9159 Make readonly error message consistent 2024-02-25 16:25:52 +01:00
Niels Dossche b68b55be8f Remove unused write_func in php_xmlreader.c 2024-02-25 16:25:52 +01:00
Niels Dossche 586adf964f Remove unimplemented, unreferenced function from php_xmlreader.c 2024-02-25 16:25:52 +01:00
Máté Kocsis 10957e498c Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Peter Kokot 8d5fc8d23f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use EXTENSIONS instead of SKIPIF sections in *.phpt
2024-01-31 11:20:44 +01:00
Peter Kokot 218a93b898 Use EXTENSIONS instead of SKIPIF sections in *.phpt
This also fixes skipped tests due to different naming "zend-test"
instead of "zend_test" and "PDO" instead of "pdo":

- ext/dom/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/simplexml/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/xmlreader/tests/libxml_global_state_entity_loader_bypass.phpt
- ext/zend_test/tests/observer_sqlite_create_function.phpt

EXTENSIONS section is used for the Windows build to load the non-static
extensions.

Closes GH-13276
2024-01-31 11:18:21 +01:00
Niels Dossche a64b48ba92 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix null pointer dereferences in case of allocation failure
2023-10-24 19:42:43 +02:00
Niels Dossche dd8a945eb7 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  Fix null pointer dereferences in case of allocation failure
2023-10-24 19:36:57 +02:00
icy17 900f0cab9f Fix null pointer dereferences in case of allocation failure
Closes GH-12506.
2023-10-24 19:34:47 +02:00
Ben Ramsey 3d5f239474 Merge branch 'PHP-8.2' 2023-07-31 20:15:51 -05:00
Ben Ramsey 7ecb284926 Merge branch 'PHP-8.1' into PHP-8.2 2023-07-31 20:06:37 -05:00
Ben Ramsey ebbccb3dc6 Merge branch 'PHP-8.0' into PHP-8.1 2023-07-31 20:01:03 -05:00
Niels Dossche 62228a2568 Disable global state test on Windows
It looks like the config.w32 uses CHECK_HEADER_ADD_INCLUDE to add the include
path to libxml into the search path.
That doesn't happen in zend-test.
To add to the Windows trouble, libxml is statically linked in, ext/libxml can
only be built statically but ext/zend-test can be built both statically and
dynamically.
So the regression tests won't work in all possible configurations anyway on Windows.
All of this is no problem on Linux because it just uses dynamic linking
and pkg-config, without any magic.

Signed-off-by: Ben Ramsey <ramsey@php.net>
2023-07-31 19:55:10 -05: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
Ilija Tovilo 7b355e8d34 Revert "Merge branch 'PHP-8.2'"
This reverts commit 45a3f178dc, reversing
changes made to b2a54bc6af.
2023-07-04 09:18:49 +02:00
Máté Kocsis 45a3f178dc Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9967 Add support for generating custom function, class const, and property attributes in stubs

Closes GH-10170
2023-07-03 11:17:08 +02:00
Bob Weinand 9fe33c8458 Merge branch 'PHP-8.2' 2023-06-30 15:20:55 +02:00
Bob Weinand cad47be8b6 Fix GH-11548 (Argument corruption when calling XMLReader::open or XMLReader::XML non-statically with observer active) 2023-06-30 15:18:37 +02:00
kocsismate 09dd3e3daf Narrow some more return types to true 2023-05-10 19:08:15 +02:00
Stanislav Malyshev 0ebef331ac Merge branch 'PHP-8.2' 2023-02-12 21:34:14 -07:00
Stanislav Malyshev e8c64b62da Merge branch 'PHP-8.1' into PHP-8.2 2023-02-12 21:34:10 -07:00
Stanislav Malyshev 85d9278db2 Merge branch 'PHP-8.0' into PHP-8.1 2023-02-12 21:33:39 -07:00
Niels Dossche ec10b28d64 Fix array overrun when appending slash to paths
Fix it by extending the array sizes by one character. As the input is
limited to the maximum path length, there will always be place to append
the slash. As the php_check_specific_open_basedir() simply uses the
strings to compare against each other, no new failures related to too
long paths are introduced.
We'll let the DOM and XML case handle a potentially too long path in the
library code.
2023-02-12 20:56:19 -07:00
George Peter Banyard a123ce9dd4 Merge branch 'PHP-8.2'
* PHP-8.2:
  Add missing EXTENSION section to tests
2022-10-27 14:42:40 +01:00
George Peter Banyard a27ae67c0f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing EXTENSION section to tests
2022-10-27 14:42:17 +01:00
George Peter Banyard a4acba9e52 Add missing EXTENSION section to tests 2022-10-27 14:39:43 +01:00
Bob Weinand a01dd9feda Revert "Port all internally used classes to use default_object_handlers"
This reverts commit 94ee4f9834.

The commit was a bit too late to be included in PHP 8.2 RC1. Given it's a massive ABI break, we decide to postpone the change to PHP 8.3.
2022-09-14 11:13:23 +02:00
Bob Weinand 94ee4f9834 Port all internally used classes to use default_object_handlers
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2022-08-31 16:45:27 +02:00
Máté Kocsis 60cae26be7 Declare ext/xmlreader constants in stubs (#9133) 2022-07-26 05:57:11 +02:00
Nikita Popov 48a9c409ad Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix bug #81521
2021-10-12 16:43:40 +02:00
Nikita Popov c5e030f3aa Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix bug #81521
2021-10-12 16:43:24 +02:00