Commit graph

472 commits

Author SHA1 Message Date
Gina Peter Banyard
105c1e9896
tree: use zend_str_has_nul_byte() API (#19336) 2025-07-31 23:57:27 +01:00
DanielEScherzer
ddd33fd7e4
Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
Niels Dossche
77b6a795d3
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix using Dom\Node with Dom\XPath callbacks
2025-02-22 16:00:45 +01:00
Niels Dossche
7974c62873
Fix using Dom\Node with Dom\XPath callbacks
This code was introduced when the Dom\Node and DOMNode classes were
still aliases, so the type check was never updated.
We fix this by checking if the doc pointer follows the spec and pick the
right node CE based on that.

Closes GH-17888.
2025-02-22 16:00:39 +01:00
Niels Dossche
daa94cf279
Implement request #30622: make $namespace parameter functional
This parameter never actually did anything and was forgotten about.
We solve this by detecting when we have a $namespace argument
(that won't conflict with the name argument) and creating a Clark
notation name out of it.

Closes GH-16123.
2024-09-30 20:34:51 +02:00
Máté Kocsis
8d12f666ae
Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02:00
Peter Kokot
2cbde5ae77
Autotools: Use a no-op command in PKG_CHECK_MODULES (#15562)
Instead of using a space for the "do nothing" command in the
PKG_CHECK_MODULES 2nd argument when libexslt is not found, the no-op
command ":" is perhaps a bit clearer and is in most cases used in such
scenarios and macro arguments.
2024-08-23 22:35:59 +02:00
Peter Kokot
687eb9125a
Autotools: Remove dependency related errors (#15344)
- ext/dom
- ext/xsl

These use the PHP_ADD_EXTENSION_DEP macro which throws error when one of
the dependencies is disabled or not configured properly.

For example:
    ./configure --disable-all --enable-dom

or
    ./configure --disable-all --with-xsl

Will throw default PHP dependency error info, when using
PHP_ADD_EXTENSION_DEP.

These errors were once done when PHP_ADD_EXTENSION_DEP macro wasn't yet
available.
2024-08-11 17:39:31 +02:00
Peter Kokot
16d9bd0aae
Sync AC_DEFINE help texts (#15207) 2024-08-03 09:47:39 +02:00
Peter Kokot
f66feaec0f
Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
28a7c6243c
[skip ci] Add HAVE_XSL_EXSLT help text (#15174) 2024-08-01 00:46:20 +02:00
Peter Kokot
1ceadaed52
Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
68ae477796
Autotools: Quote M4 arguments (#15033)
- PHP_ADD_INCLUDE
- PHP_EVAL_INCLINE
- PHP_EVAL_LIBLINE
2024-07-20 07:21:44 +02:00
Niels Dossche
81da53fccd
Convert forgotten efree to zend_string_release
Follow-up for 2d029efd94
2024-07-18 17:32:50 +02:00
Niels Dossche
2d029efd94
Avoid duplicating the filename string when profiling in XSL (#15010) 2024-07-18 17:27:53 +02:00
Niels Dossche
a59103feed
Fix trampoline leak in xpath callables
Closes GH-15009.
2024-07-18 16:54:46 +02:00
Niels Dossche
f4af8f3837
Fix libxml test compatibility in xsl 2024-07-07 00:22:41 +02:00
Niels Dossche
c6d0181c75 Fix narrowing warning 2024-07-06 14:58:42 -07:00
Niels Dossche
f16590637c Stop using reserved name in php_xsl.h 2024-07-06 14:58:42 -07:00
Niels Dossche
ac4ed1cca6 Remove unused argument 2024-07-06 14:58:42 -07:00
Niels Dossche
0a1f1dd191 Place macro argument in parentheses 2024-07-06 14:58:42 -07:00
Peter Kokot
bee84c0468
Autotools: Quote PHP_SUBST arguments in extensions (#14748) 2024-07-02 06:56:18 +02:00
Niels Dossche
3760c9d001
Add SKIPIFs for upstream regression in libxslt (#14674)
See https://gitlab.gnome.org/GNOME/libxslt/-/issues/113
2024-06-26 19:31:21 +02: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
11914de72c
Sync ext/dom and unistd.h include style (#14597) 2024-06-19 22:25:20 +02:00
Gina Peter Banyard
fd2d869642
Clean-up some more headers (#14416)
Remove unused headers (such as php_ini.h for extensions that don't define INI settings)
Use more specific headers when possible
2024-06-08 17:15:36 +01:00
Niels Dossche
5db05955c8
Move more common code into php_dom_next_in_tree_order() (#14363) 2024-05-29 19:50:41 +02:00
Levi Morrison
c461b60060
refactor: change zend_is_true to return bool (#14301)
Previously this returned `int`. Many functions actually take advantage
of the fact this returns exactly 0 or 1. For instance,
`main/streams/xp_socket.c` does:

    sockopts |= STREAM_SOCKOP_IPV6_V6ONLY_ENABLED * zend_is_true(tmpzval);

And `Zend/zend_compile.c` does:

    child = &ast->child[2 - zend_is_true(zend_ast_get_zval(ast->child[0]))];

I changed a few places trivially from `int` to `bool`, but there are
still many places such as the object handlers which return `int` that
should eventually be `bool`.
2024-05-24 15:16:36 -06:00
Niels Dossche
6e7adb3c48
Update ext/dom names after policy change (#14171) 2024-05-09 10:40:53 +02:00
Niels Dossche
8ce9f2e2b0
Add test for performing special operations on XSLTProcessor properties (#13959)
This covers some uncovered code paths in custom property handling in
php_xsl.c
2024-04-14 16:52:54 +02:00
Niels Dossche
30885f3b5f
Implement request #71571: XSLT processor should provide option to change maxDepth (#13731)
There are two depth limiting parameters for XSLT templates.
1) maxTemplateDepth
   This corresponds to the recursion depth of a template. For very
   complicated templates this can be hit.
2) maxTemplateVars
   This is the total number of live variables. When using recursive
   templates with lots of parameters you can hit this limit.

This patch introduces two new properties to XSLTProcessor that
corresponds to the above variables.
2024-03-31 21:21:23 +02:00
Niels Dossche
e1630381b7
Fix GH-13764: xsl cannot build on PHP 8.4 (#13770)
Move some of the DOM APIs from the non-public php_dom.h header to the
public header xml_common.h.
2024-03-20 19:03:09 +01:00
Máté Kocsis
b06c95b631
Declare the missing true return types (#13709) 2024-03-16 07:26:37 +01:00
Niels Dossche
fcdcfe924a Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing DOM dependency in config.m4 for ext/xsl
2024-03-15 22:56:49 +01:00
Niels Dossche
7d1637a48c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add missing DOM dependency in config.m4 for ext/xsl
2024-03-15 22:56:40 +01:00
Niels Dossche
afdabb1247 Add missing DOM dependency in config.m4 for ext/xsl
Closes GH-13715.
2024-03-15 22:56:25 +01:00
Niels Dossche
affd175116
Fix parameter hints in php_xsl.stub.php (#13704)
After the spec compliance PR landed, DOMDocument no longer inherits from
DOM\Document, and so the type hint needs to be updated.
2024-03-14 19:27:44 +01:00
Niels Dossche
14b6c981c3
[RFC] Add a way to opt-in ext/dom spec compliance (#13031)
RFC: https://wiki.php.net/rfc/opt_in_dom_spec_compliance
2024-03-09 16:56:00 +01:00
Niels Dossche
ad29afd4e8 Document xsl:keys handling better in ext/xsl 2024-02-24 21:31:01 +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
Niels Dossche
4bd63568fb
Fix argument type of simplexml_import_dom (#13170)
It needs to be "object".
This is because first- and third-party extension can register custom
node types using `php_libxml_register_export`. So we don't know upfront
what types can be expected.

This also changes the error to a TypeError everywhere.
2024-01-18 20:28:01 +01:00
Niels Dossche
43b62b7007 Remove dead code in php_xsl.c 2024-01-17 22:21:16 +01:00
Niels Dossche
76a3eddfd7
Field cleanups in xsl_object (#13182) 2024-01-17 21:29:48 +01:00
Niels Dossche
90785dd865
[RFC] Improve callbacks in ext/dom and ext/xsl (#12627) 2024-01-13 00:00:26 +01:00
Niels Dossche
0d90b6c9d0 Merge branch 'PHP-8.3'
* PHP-8.3:
  Backport deprecation warning ignores to unbreak CI
2023-12-06 22:22:08 +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
1492be5286
[RFC] DOM HTML5 parsing and serialization support (#12111) 2023-11-13 20:18:19 +01:00
Niels Dossche
4af359c93a Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix validation logic of php:function() callbacks in dom and xsl
2023-11-02 20:36:16 +01:00
Niels Dossche
ea299d44a1 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix validation logic of php:function() callbacks in dom and xsl
2023-11-02 20:32:36 +01:00