1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 18:53:33 +02:00
Commit Graph

571 Commits

Author SHA1 Message Date
Gina Peter Banyard c7da728574 ext/filter: Check callback validity once (#19921)
The call_user_function() API redoes the zend_is_callable() check, which has been just done.

We can check validity and retrieve the FCC to call it directly rather than having a useless double check
2025-09-30 15:17:56 +01:00
Tim Düsterhus 2727de725d filter: Use return true / return false for functions returning bool
Changes done with Coccinelle:

    @r1@
    identifier fn;
    typedef bool;
    symbol false;
    symbol true;
    @@

    bool fn ( ... )
    {
    <...
    return
    (
    - 0
    + false
    |
    - 1
    + true
    )
    ;
    ...>
    }

Coccinelle patch sourced from
torvalds/linux@46b5c9b856.
2025-09-24 18:51:40 +02:00
Tim Düsterhus 26eac7de17 uri: Clean up naming of public symbols (#19794)
* uri: Rename `uri_recomposition_mode_t` to `php_uri_recomposition_mode`

* uri: Align the names of the `php_uri_recomposition_mode` values

* uri: Rename `uri_component_read_mode_t` to `php_uri_component_read_mode`

* uri: Align the names of the `php_uri_component_read_mode` values

* uri: Rename `uri_property_name_t` to `php_uri_property_name`

* uri: Align the names of the `php_uri_property_name` values

* uri: Rename `uri_property_handler_t` to `php_uri_property_handler`

* uri: Rename `uri_(read|write)_t` to `php_uri_property_handler_(read|write)`

* uri: Rename `php_uri_property_handler`’s `(read|write)_func` to `read|write`

The `_func` is implied by the data type and the name of the struct.

* uri: Rename `uri_parser_t` to `php_uri_parser`

* uri: Shorten the names of `php_uri_parser` fields

The `_uri` suffix is implied, because this is an URI parser.
2025-09-11 12:10:41 +02:00
Alexandre Daubois 5ae8125993 Fix GH-16993: Fix filter_var_array to warn when validation filters are incorrectly combined with FILTER_NULL_ON_FAILURE flag (#19660) 2025-09-08 14:50:09 +02:00
Tim Düsterhus 49faa4df75 uri: Always use const pointers when referring to uri_parser_t (#19623)
The actual parser definitions are all `const` and must never be modified. Make
sure to always use `const` pointers.
2025-08-30 21:04:50 +02:00
Tim Düsterhus ae1438b5e5 uri/standard: Move the parse_url() URI parser into ext/uri/ (#19587)
* uri/standard: Move the `parse_url()` URI parser into ext/uri/

Making ext/standard depend on ext/uri/ is a bit iffy (given that it is called
*standard*) and having the parser implementation in ext/uri/ makes it easier to
find and keep in sync.

* uri: Mark local pointers as `const` in uri_parser_php_parse_url.c

* uri: Remove useless explicit cast from void in uri_parser_php_parse_url.c

* uri: Properly prefix symbols in uri_parser_php_parse_url.[ch]

* uri: Remove useless `throw_invalid_uri_exception()` helper in uri_parser_php_parse_url.c
2025-08-26 14:49:42 +02:00
Daniel Scherzer 0b326dcbab [RFC] FILTER_THROW_ON_FAILURE (#18896)
https://wiki.php.net/rfc/filter_throw_on_failure
2025-08-26 03:16:39 -07:00
Máté Kocsis e9c92a9739 ext/uri: Use the term "URI parser" instead of "URI handler" (#19530) 2025-08-21 07:23:47 +02:00
Máté Kocsis 1cff1815d0 Add internal URI handling API (#19073)
Part of https://github.com/php/php-src/pull/14461. Related to https://wiki.php.net/rfc/url_parsing_api.
2025-08-19 18:35:09 +02:00
Daniel Scherzer ff810d5e36 Arginfo: reuse zend_string objects for initializing attribute values (#19241)
Avoid initializing the same string content multiple times and make use of the
fact that the strings created to initialize attribute values are not freed by
simply making use of an existing zend_string with the same content if one is
available.
2025-07-27 17:27:22 -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
Daniel Scherzer 142e378618 Arginfo: add and use known strings for attribute values 2025-07-14 17:31:22 -07:00
DanielEScherzer 9225cb45ac Make zend_register_*_constant() functions return pointers, use them (#19029)
Have each of the specialized methods for registering a constant return a
pointer to the registered constant the same way that the generic
`zend_register_constant()` function does, and use those in the generated
arginfo files to avoid needing to search for a constant that was just
registered in order to add attributes to it.
2025-07-07 12:23:52 -07:00
DanielEScherzer 171501b93f Replace @deprecated with #[\Deprecated] for internal constants (#18780)
Only covers constants declared via stub files, others will be handled
separately in a later commit.

Does not include the intl extension, since that had some errors relating to the
cpp code; that extension will be updated separately.
2025-06-26 11:27:15 -07:00
Gina Peter Banyard 67bbf9c961 ext/filter: Remove ZPP test 2025-06-23 13:58:10 +02:00
Niels Dossche c02f6fb3fe Output blocks of safe chars in php_filter_encode_html()
Fixes a long-standing TODO, and is faster.
2025-06-09 11:12:17 +02:00
Niels Dossche 31b4f39d3e Use ZVAL_NEW_STR() for new string in php_filter_encode_html() 2025-06-09 11:12:17 +02:00
Niels Dossche cb04226b4a Avoid making a redundant copy in php_filter_callback() (#18794)
`call_user_function` already makes a copy to the call frame for its
arguments, there's no need to do this ourselves.
2025-06-08 11:23:31 +02:00
Niels Dossche 3ba725a556 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:42 +02:00
Niels Dossche a019fbd970 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18309: ipv6 filter integer overflow
  Fix GH-18304: Changing the properties of a DateInterval through dynamic properties triggers a SegFault
2025-04-11 23:36:12 +02:00
Niels Dossche 8849a5336e Fix GH-18309: ipv6 filter integer overflow
The intermediate computation can cause a signed integer overflow, but
the input is correctly rejected later on by the check on variable `n`.
Solve this by using an unsigned number.

Closes GH-18312.
2025-04-11 23:35:00 +02:00
Gina Peter Banyard f11c22ae30 ext/filter: Use bool instead of int where applicable
This makes it easier to reason about the code
2025-04-02 02:20:16 +01:00
Gina Peter Banyard fa511dff45 ext/filter: Mark literal as static const 2025-04-02 02:20:16 +01:00
Gina Peter Banyard 7cc47082d6 ext/filter: Use zend_string* instead of a char* + size_t pair 2025-04-02 02:20:16 +01:00
Gina Peter Banyard 0e682ad692 ext/filter: Add const qualifiers 2025-04-02 02:20:16 +01:00
Gina Peter Banyard 53bced39fb ext/filter: Reduce scope of variables 2025-04-02 02:20:16 +01:00
Gina Peter Banyard 5cbfb6966a ext/filter: Remove unused parameters 2025-04-02 02:20:16 +01:00
Gina Peter Banyard 38ecfc54c6 ext/filter: Remove dead code about session globals 2025-04-02 02:20:16 +01:00
Derick Rethans 2e1d6785d5 Merge branch 'PHP-8.4' 2024-12-18 11:39:06 +00:00
Derick Rethans c5469fa361 Merge branch 'PHP-8.3' into PHP-8.4 2024-12-18 11:39:01 +00:00
Derick Rethans 3b154eb88c Consistent naming for test titles 2024-12-18 11:38:44 +00:00
Derick Rethans e54c9e6cd3 Per RFC 6890, these are explicitly not reserved ranges 2024-12-18 11:38:44 +00:00
Derick Rethans 9d1deb97ff Include changes from RFC 6890 errata 2024-12-18 11:38:44 +00:00
Derick Rethans d25aac29ce Fixed GH-16944: Refactor IP ranges by using the tables from RFC 6890 2024-12-18 11:38:43 +00:00
Derick Rethans f2fdcfc8c3 These were 6bone experimental network allocations, which have been returned to IANA (RFC 3701) 2024-12-18 11:27:04 +00:00
Derick Rethans a16ee2f1c3 Merge branch 'PHP-8.4' 2024-11-26 15:41:10 +00:00
Derick Rethans 118ed09ab2 Merge branch 'PHP-8.3' into PHP-8.4 2024-11-26 15:41:04 +00:00
Derick Rethans e43a398149 Merge branch 'PHP-8.2' into PHP-8.3 2024-11-26 15:40:56 +00:00
Derick Rethans d1b9d7ee83 Fixed CS 2024-11-26 15:40:46 +00:00
DanielEScherzer aeb2d5cfa6 ext/[ef]*: fix a bunch of typos (GH-16621) 2024-10-28 11:28:32 +01:00
Christoph M. Becker 6715860286 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
2024-10-21 21:22:26 +02:00
Christoph M. Becker 7930867e28 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
2024-10-21 21:21:02 +02:00
Christoph M. Becker f9ce5e79da Fix GH-16523: FILTER_FLAG_HOSTNAME accepts ending hyphen
Domain name labels must not end with a hyphen, and that is also true
for the last label.  Apparently, this has been overlooked so far.

Closes GH-16540.
2024-10-21 21:19:54 +02:00
Gina Peter Bnayard 5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01: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 82e63a06e2 Add pcre dependency as required to ext/filter (#15099)
This is configure phase dependency synced with already present Autotools
pcre dependency check.
2024-07-24 23:30:57 +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
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
Ben Ramsey bda372fc6c Merge branch 'PHP-8.3' 2024-06-05 01:11:59 -05:00
Ben Ramsey e4453dcbd2 Merge branch 'PHP-8.2' into PHP-8.3 2024-06-05 01:11:30 -05:00