1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

803 Commits

Author SHA1 Message Date
Weilin Du
2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
Peter Kokot
f17c5ad83b Windows build: Add new function CHECK_HEADER() (#21191)
The current function `CHECK_HEADER_ADD_INCLUDE()` automatically defines
`HAVE_<HEADER_NAME_H>` preprocessor macros, which makes it difficult to
sync with other build systems. Specially, if some `HAVE_` macro is used
in the code and this function defines this macro but Autotools doesn't.

The new `CHECK_HEADER()` function behaves similar except it doesn't
define the `HAVE_<HEADER_NAME_H>` preprocessor macro.

This removes the following unused compile definitions:

HAVE_ARGON2_H
HAVE_AVIF_H
HAVE_BZLIB_H
HAVE_CAPSTONE_CAPSTONE_H
HAVE_CURL_EASY_H
HAVE_DB_H
HAVE_DECODE_H
HAVE_DEPOT_H
HAVE_EDITLINE_READLINE_H
HAVE_ENCHANT_H
HAVE_ENCODE_H
HAVE_FFI_H
HAVE_FIREBIRD_INTERFACE_H
HAVE_FT2BUILD_H
HAVE_GD_H
HAVE_GLIB_H
HAVE_GMP_H
HAVE_HTTPD_H
HAVE_IBASE_H
HAVE_IR_IR_H
HAVE_KECCAKHASH_H
HAVE_LBER_H
HAVE_LDAP_H
HAVE_LIBEXSLT_EXSLT_H
HAVE_LIBINTL_H
HAVE_LIBPQ_FE_H
HAVE_LIBTIDY_TIDY_H
HAVE_LIBXML_PARSER_H
HAVE_LIBXML_TREE_H
HAVE_LIBXML_XMLWRITER_H
HAVE_LIBXSLT_XSLT_H
HAVE_LMDB_H
HAVE_MBSTRING_H
HAVE_MYSQL_H
HAVE_ONIGURUMA_H
HAVE_OPENSSL_SSL_H
HAVE_PNG_H
HAVE_SNMP_H
HAVE_SODIUM_H
HAVE_SQLITE3_H
HAVE_SQLITE3EXT_H
HAVE_SYBFRONT_H
HAVE_TIDY_H
HAVE_TIDY_TIDY_H
HAVE_TIDYBUFFIO_H
HAVE_TIMELIB_CONFIG_H
HAVE_UNICODE_USPOOF_H
HAVE_UNICODE_UTF_H
HAVE_XPM_H
HAVE_ZIP_H
HAVE_ZIPCONF_H
HAVE_ZLIB_H

The following compile definitions are defined explicitly:

- HAVE_ICONV_H
- HAVE_MSCOREE_H
- HAVE_SQL_H
- HAVE_SQLEXT_H

Additionally, the `SETUP_OPENSSL()` function doesn't accept the 6th
argument anymore.
2026-03-03 20:06:40 +01:00
Ilija Tovilo
073dcf66bb Merge branch 'PHP-8.5'
* PHP-8.5:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:28 +01:00
Ilija Tovilo
07e29acbd4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:21 +01:00
Ilija Tovilo
6f91209260 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:14 +01:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Niels Dossche
ca7f556002 xml: Use strlen() (#20544) 2025-11-20 21:54:38 +01:00
Niels Dossche
4a12745705 xml: Optimize attribute array construction (#20515)
Attributes can't be numeric strings by the definition of the grammar, so
don't bother with the symbol table stuff.
2025-11-18 18:49:13 +01:00
Niels Dossche
3e7672c227 Merge branch 'PHP-8.5'
* PHP-8.5:
  xml: Use safe_emalloc() correctly
2025-11-15 12:45:58 +01:00
Niels Dossche
0909f1305d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  xml: Use safe_emalloc() correctly
2025-11-15 12:45:53 +01:00
Niels Dossche
835c6c7c7f Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  xml: Use safe_emalloc() correctly
2025-11-15 12:45:46 +01:00
Niels Dossche
48b19a8ede xml: Use safe_emalloc() correctly
Fortunately, libxml won't allow _at this point in time_ to have more
than INT_MAX/5 attributes, so this doesn't cause issues right now.
However, if this limit is ever raised then it can cause an integer
overflow which will cause a heap overflow.
So future-proof this code by properly using safe_emalloc().

Closes GH-20472.
2025-11-15 12:45:28 +01:00
Niels Dossche
0375060d16 xml: Don't make copies of the object, remove self-reference (#20471) 2025-11-15 01:02:11 +01:00
Niels Dossche
11070509ae xml: Drop unused XML_GetCurrentByteCount() compatibility wrapper (#20476) 2025-11-14 18:23:13 +01:00
Niels Dossche
94831808af xml: Drop unused version function (#20467) 2025-11-13 08:31:02 +01:00
Niels Dossche
7a96a680cc Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  xml: Fix unused variable warning
2025-11-11 23:03:19 +01:00
Niels Dossche
c145c2018e xml: Fix unused variable warning 2025-11-11 23:03:12 +01:00
Niels Dossche
af46c3f3c1 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20439: xml_set_default_handler() does not properly handle special characters in attributes when passing data to callback (#20453)
2025-11-11 22:49:04 +01:00
Niels Dossche
f7c7948d00 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20439: xml_set_default_handler() does not properly handle special characters in attributes when passing data to callback (#20453)
2025-11-11 22:48:10 +01:00
Niels Dossche
0ad340fdcf Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20439: xml_set_default_handler() does not properly handle special characters in attributes when passing data to callback (#20453)
2025-11-11 22:47:54 +01:00
Niels Dossche
3cc36b0b5e Fix GH-20439: xml_set_default_handler() does not properly handle special characters in attributes when passing data to callback (#20453)
We would need to escape the attributes, but there's no builtin method
that we can call in libxml2 to do so in a way consistent with the
attribute escape rules and expat.
In fact, expat just repeats the input, while we reconstruct it.
To fix the issue, and fix consistency with expat, we repeat the input as
well. This works by seeking to the start and end of the tag and passing
it to the default handler. This is fine for the parser because the
parser used in ext/xml is always in non-progressive mode, so we have
access to the entire input buffer.
2025-11-11 22:47:15 +01:00
Niels Dossche
677c7fe31b xml: Migrate start_element_handler_ns to ZendMM 2025-10-11 23:49:30 +02:00
Niels Dossche
e0561f0c8e xml: Migrate qualify_namespace to ZendMM 2025-10-11 23:49:30 +02:00
Niels Dossche
20cc3a35e5 xml: Migrate start_element_handler to ZendMM 2025-10-11 23:49:30 +02:00
Niels Dossche
c9c904f816 xml: Migrate _ns_separator to ZendMM 2025-10-11 23:49:30 +02:00
Niels Dossche
f63b011eee xml: Migrate build_entity to ZendMM 2025-10-11 23:49:30 +02:00
Niels Dossche
8e405ca22a xml: Migrate build_comment to ZendMM 2025-10-11 23:49:30 +02:00
Niels Dossche
a572b1015b xml: Switch to safe option setting API (#20128) 2025-10-11 10:46:44 +02:00
Tim Düsterhus
e455fc9c92 xml: Use true / false instead of 1 / 0 when assigning to bool
Changes done with Coccinelle:

    @@
    bool b;
    @@

    - b = 0
    + b = false

    @@
    bool b;
    @@

    - b = 1
    + b = true
2025-09-24 18:51:40 +02:00
Daniel Scherzer
4de2ec3895 [RFC] Deprecate xml_parser_free() (#19449)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:44:32 -07:00
DanielEScherzer
1eadf553f1 Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00
Niels Dossche
826fa36ba3 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/xml: Suppress libxml deprecation for `_xmlParserCtxt.inState` (#19131)
2025-07-16 18:27:02 +02:00
Niels Dossche
034c3f2270 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/xml: Suppress libxml deprecation for `_xmlParserCtxt.inState` (#19131)
2025-07-16 18:26:54 +02:00
Niels Dossche
9eee4dd92b Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/xml: Suppress libxml deprecation for `_xmlParserCtxt.inState` (#19131)
2025-07-16 18:24:55 +02:00
Tim Düsterhus
a5df26691d ext/xml: Suppress libxml deprecation for _xmlParserCtxt.inState (#19131)
The FreeBSD build fails due to the deprecation and -Werror:

    2025-07-15T00:37:20.8390774Z /home/runner/work/php-src/php-src/ext/xml/compat.c:358:38: error: 'instate' is deprecated [-Werror,-Wdeprecated-declarations]
    2025-07-15T00:37:20.8392577Z   358 |                 if (ret == NULL || parser->parser->instate == XML_PARSER_CONTENT) {
    2025-07-15T00:37:20.8393184Z       |                                                    ^
    2025-07-15T00:37:20.8394006Z /usr/local/include/libxml2/libxml/parser.h:309:33: note: 'instate' has been explicitly marked deprecated here
    2025-07-15T00:37:20.8394903Z   309 |     xmlParserInputState instate XML_DEPRECATED_MEMBER;
    2025-07-15T00:37:20.8395413Z       |                                 ^
    2025-07-15T00:37:20.8396166Z /usr/local/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
    2025-07-15T00:37:20.8397058Z    74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
    2025-07-15T00:37:20.8397581Z       |                                                  ^
    2025-07-15T00:37:20.8425542Z 1 error generated.
2025-07-16 18:23:54 +02:00
Tim Düsterhus
2039664e47 ext/xml: Suppress libxml deprecation for _xmlParserCtxt.inState (#19131)
The FreeBSD build fails due to the deprecation and -Werror:

    2025-07-15T00:37:20.8390774Z /home/runner/work/php-src/php-src/ext/xml/compat.c:358:38: error: 'instate' is deprecated [-Werror,-Wdeprecated-declarations]
    2025-07-15T00:37:20.8392577Z   358 |                 if (ret == NULL || parser->parser->instate == XML_PARSER_CONTENT) {
    2025-07-15T00:37:20.8393184Z       |                                                    ^
    2025-07-15T00:37:20.8394006Z /usr/local/include/libxml2/libxml/parser.h:309:33: note: 'instate' has been explicitly marked deprecated here
    2025-07-15T00:37:20.8394903Z   309 |     xmlParserInputState instate XML_DEPRECATED_MEMBER;
    2025-07-15T00:37:20.8395413Z       |                                 ^
    2025-07-15T00:37:20.8396166Z /usr/local/include/libxml2/libxml/xmlexports.h:74:50: note: expanded from macro 'XML_DEPRECATED_MEMBER'
    2025-07-15T00:37:20.8397058Z    74 |     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
    2025-07-15T00:37:20.8397581Z       |                                                  ^
    2025-07-15T00:37:20.8425542Z 1 error generated.
2025-07-15 13:36:56 +02:00
Daniel Scherzer
142e378618 Arginfo: add and use known strings for attribute values 2025-07-14 17:31:22 -07:00
Tim Düsterhus
4c5a6b0e8d tree-wide: Remove stacktraces from tests testing throwing clones (#18748)
This is in preparation for the possible future transformation of `clone` into a
function call, but also meaningful on its own, since the purpose of the tests
is not to test the stack trace generation, but rather that an exception was
thrown. It also cleans up some unreachable code in the tests.
2025-06-03 20:08:47 +02:00
Niels Dossche
4f3244351d Merge branch 'PHP-8.4'
* PHP-8.4:
  Revert "Port XML_GetCurrentByteIndex to public APIs"
2025-04-23 22:10:13 +02:00
Niels Dossche
40894bcc49 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Revert "Port XML_GetCurrentByteIndex to public APIs"
2025-04-23 22:08:10 +02:00
Niels Dossche
54e662c6f5 Revert "Port XML_GetCurrentByteIndex to public APIs"
This reverts commit 8dc799aac7.

Originally, this was going to be deprecated in libxml2 2.14, but this
didn't end up happening in the end, and the replacement function that we
used got deprecated instead. So fix the deprecation warning by reverting
to the original code.

Closes GH-18407.
2025-04-23 22:07:26 +02:00
Niels Dossche
c5f6a8b0a2 Minor improvements to ext/xml memory management (#18071) 2025-03-15 14:40:39 +01:00
Jakub Zelenka
6976fb6ba7 Merge branch 'PHP-8.3' into PHP-8.4 2025-03-11 22:23:09 +01:00
Jakub Zelenka
acf2f4988a Merge branch 'PHP-8.2' into PHP-8.3 2025-03-11 22:09:00 +01:00
Jakub Zelenka
4af1830356 Merge branch 'PHP-8.1' into PHP-8.2 2025-03-11 21:57:33 +01:00
Niels Dossche
0e715e71d9 Fix GHSA-wg4p-4hqh-c3g9 2025-03-11 21:50:17 +01:00
Niels Dossche
575ee23bd9 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17187: unreachable program point in zend_hash
2024-12-27 15:54:37 +01:00
Niels Dossche
b621b3a00f Fix GH-17187: unreachable program point in zend_hash
A bunch of different issues:
1) The referenced value is copied without incrementing the refcount.
   The reason the refcount isn't incremented is because otherwise
   the array modifications would violate the RC1 constraints.
   Solve this by copying the reference itself instead and always
   read the referenced value.
2) No type checks on the array data, so malicious scripts could
   cause type confusion bugs.
3) Potential overflow when the arrays resize and we access ctag.

Closes GH-17205.
2024-12-27 15:51:17 +01:00
Niels Dossche
14c107371c Backport 061058a9: Test fixes for libxml2 2.12.0 2024-10-12 15:12:40 +02:00
Niels Dossche
bb46b4b799 Backport 4fe82131: Backport libxml2 2.13.2 fixes (#14816)
Backproted from https://github.com/php/php-src/pull/14789
2024-10-12 15:12:40 +02:00