Update gen_stubs.php to generate C enums from internal enums, when the stub is annotated with @generate-c-enums. Enum values can be compared to the result of zend_enum_fetch_case_id(zend_object*).
The generated enums are added to separate files named {$extensionName}_decl.h, so that it's possible to include these from anywhere. _arginfo.h files would generate warnings if we tried to include them in a compilation unit that doesn't call the register_{$class} functions, for instance.
Introduce Z_PARAM_ENUM().
* Make ZEND_AST_CONST_ENUM_INIT a 4-children node
* Store enum case id in ZEND_AST_CONST_ENUM_INIT
* Store enum case id in instance
* Expose enum case_id internally
* Generate C enum for internal enums
* Introduce Z_PARAM_ENUM()
* Port extensions
zend_string_truncate() doesn't put a NUL byte.
Right now this doesn't matter as this code path is only hittable via the
equals() method, but if other extension (or future other code) starts
using this code path, then it can be problematic as all user-exposed
zend_strings need to end with a NUL byte.
If nothing was added to a smart_str, the interned empty string is
returned, and therefore ZVAL_NEW_STR is wrong as it'll set the
REFCOUNTED flag.
Closes GH-20773.
We're now cleanly back on a released version. No functional changes since the
last import of the library.
Version 0.9.10 never existed, the minimum version in config.m4 was already
increased in anticipation of a new release that contained necessary bugfixes to
prevent building against a uriparser without these fixes. It therefore also is
adjusted to 1.0.0 for correctness without having an impact.
This is in preparation of importing a fix for the uriparser/uriparser#282
security issue, which will likely depend on this refactoring to cleanly apply.
- Incoming data should never have an INDIRECT element, that would be a
violation of the rules wrt the INDIRECT types. Therefore there was
never a need to use the _ind variant of the hash table find.
- It doesn't matter now because there are no properties; but the
get_properties handler cannot be used in the output of a __serialize
call as that would expose INDIRECT elements.
To prevent issues in the future, make it an empty array as a
placeholder. If in the future properties are added, then this will
hard fail instead of silently fail with INDIRECTs.
* uri: Use the “includes credentials” rule for WhatWg user/password getters
The URL serializing algorithm from the WHATWG URL Standard uses an “includes
credentials” rule to decide whether or not to include the `@` in the output,
indicating the presence of a userinfo component in RFC 3986 terminology. Use
this rule to determine whether or not an empty username or password should be
returned as the empty string (present but empty) or NULL (not present).
* uri: Use ZVAL_STRINGL_FAST in `whatwg_(username|password)_read()`
This nicely sidesteps the undefined behavior with passing a `(NULL, 0)` pair
without needing manual logic.
* NEWS
This allows extensions that already know which parser to use and don't need the
generic lookup facility to directly refer to the desired parser without needing
to go through `php_uri_get_parser()` (which also requires allocating a
`zend_string*`).
Following php/php-src#20173
Related to php/php-src#19868
* PHP-8.5:
PHP 8.5 | UPGRADING: fix entry about new grapheme $locale parameter (#20239)
uri: Make uri_parser_rfc3986.h usable for external extensions (#20173)
Fix missing deprecation message for default case statement followed by semicolon (#20172)
This header could not previously be used due to the `uriparser/Uri.h` include,
which is required for the struct definition. Since this struct is considered an
implementation detail, we can just make it opaque, preserving type safety, but
without allowing external users to touch its contents.
Fixesphp/php-src#19868.
* Reduce code bloat in arginfo by using specialised string releases
Comparing this patch to master (c7da728574),
with a plain configure command without any options:
```
text data bss dec hex filename
20683738 1592400 137712 22413850 156021a sapi/cli/php
20688522 1592400 137712 22418634 15614ca sapi/cli/php_old
```
We see a minor reduction of 0.023% in code size.
* Also use true for the other initialization line
* Also use specialized code for consts
* uri: Rename `uri_object_t` to `php_uri_object`
* uri: Rename `uri_(read|write)_component_*` to `php_uri_property_(read|write)_*_helper`
* uri: Rename `URI_SERIALIZED_PROPERTY_NAME` to `PHP_URI_SERIALIZE_URI_FIELD_NAME`
* uri: Rename `uri_internal_t` to `php_uri_internal`
* uri: Use proper `php_uri_ce_` prefix for all CEs
* uri: Make the object handlers `static` and remove them from the header