Commit graph

14 commits

Author SHA1 Message Date
DanielEScherzer
21196ca9f6
zend_enum.c: make a bunch of pointers const (#15932)
* zend_enum.c: make a bunch of pointers `const`

* interface_gets_implemented needs non-constant

* zend_enum.h: update zend_verify_enum() signature
2024-09-17 12:57:01 +02:00
Christoph M. Becker
2190353b08
Merge branch 'PHP-8.3'
* PHP-8.3:
  zend_enum: Rename try parameter to avoid conflict with C++
2024-08-07 14:56:19 +02:00
Christoph M. Becker
aa709dc05b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  zend_enum: Rename try parameter to avoid conflict with C++
2024-08-07 14:55:14 +02:00
Christoph M. Becker
423fc811bd
zend_enum: Rename try parameter to avoid conflict with C++
`try` is a keyword in C++, and as such C++ code including <zend_enum.h>
fails to compile unless a workaround is in place.  To resolve this, we
simply rename the parameter.

We choose `try_from` to make it clear that this parameter is true when
the function is called from `BackedEnum::tryFrom()`.  For consistency,
we also rename the `try` parameter of `zend_enum_from_base()`, although
that function is not exported.

This issue had been reported by @oplanre, who also provided an initial
PR.

Closes GH-15259.
2024-08-07 14:54:35 +02:00
Ilija Tovilo
6335264c07
Fix header errors when parsed standalone (#14272)
This is annoying for multiple reasons:

1. LSPs can show many errors for these files.
2. LSP can stop parsing these files completely if there are too many errors,
   resulting in spotty LSP features.
2024-05-20 22:30:38 +02:00
Max Kellermann
d5c649b36b
zend_compiler, ...: use uint8_t instead of zend_uchar (#10621)
`zend_uchar` suggests that the value is an ASCII character, but here,
it's about very small integers.  This is misleading, so let's use a
C99 integer instead.

On all architectures currently supported by PHP, `zend_uchar` and
`uint8_t` are identical.  This change is only about code readability.
2023-02-23 14:56:54 +00:00
Christoph M. Becker
bf1cfc0753
Revert GH-10300
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit 68ada76f9a.
his reverts commit 45384c6e20.
This reverts commit ef7fbfd710.
This reverts commit 9b9ea0d7c6.
This reverts commit f15747c26b.
This reverts commit e883ba93c4.
This reverts commit 7e87551c37.
This reverts commit 921274d2b8.
This reverts commit fc1f528e5e.
This reverts commit 0961715cda.
This reverts commit a93f264526.
This reverts commit 72dd94e1c6.
This reverts commit 29b2dc8964.
This reverts commit 05c7653bba.
This reverts commit 5190e5c260.
This reverts commit 6b55bf228c.
This reverts commit 184b4a12d3.
This reverts commit 4c31b7888a.
This reverts commit d44e9680f0.
This reverts commit 4069a5c43f.
2023-01-16 12:22:54 +01:00
Max Kellermann
0961715cda Zend/zend_enum: include cleanup 2023-01-15 15:07:58 +00:00
Ilija Tovilo
3daa8a93ee
Fix default_object_handlers pointing to invalid memory with file_cache
Closes GH-9596
2022-10-27 10:48:31 +02:00
Ilija Tovilo
ddc0b490f7
Allow arbitrary const expressions in backed enums
Closes GH-7821
Closes GH-8190
Closes GH-8418
2022-06-12 22:56:05 +02:00
Ilija Tovilo
d62d50b88e
Add C API for getting backed enum case by value
Closes GH-8518
2022-05-28 12:08:10 +02:00
Nikita Popov
c03f97cd1c Add missing const qualitier in zend_register_internal_enum() 2021-08-31 13:12:31 +02:00
Nikita Popov
a374230c15 Add support for internal enums
This adds support for internal enums with the same basic approach
as userland enums. Enum values are stored as CONSTANT_AST and
objects created during constant updating at runtime. This means
that we need to use mutable_data for internal enums.

This just adds basic support and APIs, it does not include the
stubs integration from #7212.

Closes GH-7302.
2021-07-27 09:19:14 +02:00
Ilija Tovilo
269c8dac1d
Implement enums
RFC: https://wiki.php.net/rfc/enumerations

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-6489.
2021-03-17 19:08:03 +01:00