diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 930d733307f4..971902cabd2b 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -22,8 +22,14 @@ #include "zend_gc.h" #include "zend_alloc.h" +#include "zend_errors.h" + BEGIN_EXTERN_C() +ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3); + +#include "zend_multiply.h" + typedef void (*zend_string_copy_storage_func_t)(void); typedef zend_string *(ZEND_FASTCALL *zend_new_interned_string_func_t)(zend_string *str); typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, bool permanent); @@ -331,6 +337,48 @@ static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, return ret; } +static zend_always_inline char *zend_cstr_append_char(const char *str, size_t len, char c) { + char *res = (char *)safe_emalloc(len, 1, 2); + if (len > 0) { + memcpy(res, str, len); + } + res[len] = c; + res[len + 1] = '\0'; + return res; +} + +static zend_always_inline char *zend_cstr_concat(const char *s1, size_t len1, const char *s2, size_t len2) { + size_t size = zend_safe_address_guarded(1, len1, len2); + size = zend_safe_address_guarded(1, size, 1); + char *res = (char *)emalloc(size); + if (len1 > 0) { + memcpy(res, s1, len1); + } + if (len2 > 0) { + memcpy(res + len1, s2, len2); + } + res[len1 + len2] = '\0'; + return res; +} + +static zend_always_inline char *zend_cstr_concat3(const char *s1, size_t len1, const char *s2, size_t len2, const char *s3, size_t len3) { + size_t size = zend_safe_address_guarded(1, len1, len2); + size = zend_safe_address_guarded(1, size, len3); + size = zend_safe_address_guarded(1, size, 1); + char *res = (char *)emalloc(size); + if (len1 > 0) { + memcpy(res, s1, len1); + } + if (len2 > 0) { + memcpy(res + len1, s2, len2); + } + if (len3 > 0) { + memcpy(res + len1 + len2, s3, len3); + } + res[len1 + len2 + len3] = '\0'; + return res; +} + static zend_always_inline void zend_string_free(zend_string *s) { if (!ZSTR_IS_INTERNED(s)) { diff --git a/ext/bcmath/libbcmath/src/convert.c b/ext/bcmath/libbcmath/src/convert.c index b6003e58682b..772223220ef2 100644 --- a/ext/bcmath/libbcmath/src/convert.c +++ b/ext/bcmath/libbcmath/src/convert.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/bcmath/libbcmath/src/convert.h b/ext/bcmath/libbcmath/src/convert.h index 69ff63b48e03..15af4216f853 100644 --- a/ext/bcmath/libbcmath/src/convert.h +++ b/ext/bcmath/libbcmath/src/convert.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/html5_parser.c b/ext/dom/html5_parser.c index 583de89ecc4f..667db5acb074 100644 --- a/ext/dom/html5_parser.c +++ b/ext/dom/html5_parser.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/html5_parser.h b/ext/dom/html5_parser.h index 43f7cf4f84cc..6824052957aa 100644 --- a/ext/dom/html5_parser.h +++ b/ext/dom/html5_parser.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/html5_serializer.c b/ext/dom/html5_serializer.c index ad3e24e00821..2276a53f14fd 100644 --- a/ext/dom/html5_serializer.c +++ b/ext/dom/html5_serializer.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/html5_serializer.h b/ext/dom/html5_serializer.h index e4ae67861eee..aeffa67af02a 100644 --- a/ext/dom/html5_serializer.h +++ b/ext/dom/html5_serializer.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/html_collection.c b/ext/dom/html_collection.c index 0a24d4909cf4..2aed253ab8d3 100644 --- a/ext/dom/html_collection.c +++ b/ext/dom/html_collection.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/html_collection.h b/ext/dom/html_collection.h index f7e8effc16e1..5f9f5948873f 100644 --- a/ext/dom/html_collection.h +++ b/ext/dom/html_collection.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/html_document.c b/ext/dom/html_document.c index 58f07e079dd3..ddf8f3f66f80 100644 --- a/ext/dom/html_document.c +++ b/ext/dom/html_document.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/infra.c b/ext/dom/infra.c index 33026d8a7526..fe7dd97de40d 100644 --- a/ext/dom/infra.c +++ b/ext/dom/infra.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/infra.h b/ext/dom/infra.h index 4cf8ad26c789..890654bcd1c3 100644 --- a/ext/dom/infra.h +++ b/ext/dom/infra.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/inner_outer_html_mixin.c b/ext/dom/inner_outer_html_mixin.c index e1bf226d8602..0e40f8b07a3b 100644 --- a/ext/dom/inner_outer_html_mixin.c +++ b/ext/dom/inner_outer_html_mixin.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/internal_helpers.h b/ext/dom/internal_helpers.h index 725c8222f429..f64ac57fc097 100644 --- a/ext/dom/internal_helpers.h +++ b/ext/dom/internal_helpers.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/lexbor/selectors-adapted/selectors.c b/ext/dom/lexbor/selectors-adapted/selectors.c index 0f7874d2cf53..242433fb444f 100644 --- a/ext/dom/lexbor/selectors-adapted/selectors.c +++ b/ext/dom/lexbor/selectors-adapted/selectors.c @@ -2,7 +2,7 @@ * Copyright (C) 2021-2026 Alexander Borisov * * Author: Alexander Borisov - * Adapted for PHP + libxml2 by: Niels Dossche + * Adapted for PHP + libxml2 by: Nora Dossche * Based on Lexbor (upstream commit 5291cde0d40f77e7c4ea364b7cd726269e0bf1f9) */ diff --git a/ext/dom/lexbor/selectors-adapted/selectors.h b/ext/dom/lexbor/selectors-adapted/selectors.h index b64a9e49ee26..b349b24a80b0 100644 --- a/ext/dom/lexbor/selectors-adapted/selectors.h +++ b/ext/dom/lexbor/selectors-adapted/selectors.h @@ -2,7 +2,7 @@ * Copyright (C) 2021-2025 Alexander Borisov * * Author: Alexander Borisov - * Adapted for PHP libxml2 by: Niels Dossche + * Adapted for PHP libxml2 by: Nora Dossche */ diff --git a/ext/dom/namespace_compat.c b/ext/dom/namespace_compat.c index 420759b369ef..1815b2dd4413 100644 --- a/ext/dom/namespace_compat.c +++ b/ext/dom/namespace_compat.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/namespace_compat.h b/ext/dom/namespace_compat.h index dc66021e5ec4..dac7de88353a 100644 --- a/ext/dom/namespace_compat.h +++ b/ext/dom/namespace_compat.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/nodelist.h b/ext/dom/nodelist.h index 084ce33b5494..3e60c4daa023 100644 --- a/ext/dom/nodelist.h +++ b/ext/dom/nodelist.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/obj_map.c b/ext/dom/obj_map.c index eeef8345fc63..aa852c800473 100644 --- a/ext/dom/obj_map.c +++ b/ext/dom/obj_map.c @@ -10,7 +10,7 @@ +----------------------------------------------------------------------+ | Authors: Christian Stocker | | Rob Richards | - | Niels Dossche | + | Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/obj_map.h b/ext/dom/obj_map.h index 1853cce354e6..f6306fc4ab91 100644 --- a/ext/dom/obj_map.h +++ b/ext/dom/obj_map.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/parentnode/css_selectors.c b/ext/dom/parentnode/css_selectors.c index 7254bd909a0a..0fc0cc1ef0f6 100644 --- a/ext/dom/parentnode/css_selectors.c +++ b/ext/dom/parentnode/css_selectors.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/parentnode/tree.c b/ext/dom/parentnode/tree.c index 696c42ba64ff..13a99023781f 100644 --- a/ext/dom/parentnode/tree.c +++ b/ext/dom/parentnode/tree.c @@ -9,7 +9,7 @@ | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ | Authors: Benjamin Eberlei | - | Niels Dossche | + | Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/private_data.c b/ext/dom/private_data.c index 373a79cbe712..dd624a2c2e9c 100644 --- a/ext/dom/private_data.c +++ b/ext/dom/private_data.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/private_data.h b/ext/dom/private_data.h index c64e96eb1a6d..086cd7bfc59c 100644 --- a/ext/dom/private_data.h +++ b/ext/dom/private_data.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/serialize_common.h b/ext/dom/serialize_common.h index 88088558e90e..c6566e2f37cd 100644 --- a/ext/dom/serialize_common.h +++ b/ext/dom/serialize_common.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/token_list.c b/ext/dom/token_list.c index 2f1fa3c9e733..0e7797616554 100644 --- a/ext/dom/token_list.c +++ b/ext/dom/token_list.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/token_list.h b/ext/dom/token_list.h index 7bddd6c9b462..80cc094ddd83 100644 --- a/ext/dom/token_list.h +++ b/ext/dom/token_list.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/xml_document.c b/ext/dom/xml_document.c index e5966352dc72..707356227afe 100644 --- a/ext/dom/xml_document.c +++ b/ext/dom/xml_document.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/xml_serializer.c b/ext/dom/xml_serializer.c index da43f24aab01..9c761f6d442c 100644 --- a/ext/dom/xml_serializer.c +++ b/ext/dom/xml_serializer.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/xml_serializer.h b/ext/dom/xml_serializer.h index e686083a27aa..4ada97f0e796 100644 --- a/ext/dom/xml_serializer.h +++ b/ext/dom/xml_serializer.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/xpath_callbacks.c b/ext/dom/xpath_callbacks.c index 90395dc15f2e..56d94a664092 100644 --- a/ext/dom/xpath_callbacks.c +++ b/ext/dom/xpath_callbacks.c @@ -10,7 +10,7 @@ +----------------------------------------------------------------------+ | Authors: Christian Stocker | | Rob Richards | - | Niels Dossche | + | Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/dom/xpath_callbacks.h b/ext/dom/xpath_callbacks.h index 072f52196331..4bf79b5df84f 100644 --- a/ext/dom/xpath_callbacks.h +++ b/ext/dom/xpath_callbacks.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/lexbor/lexbor/core/swar.h b/ext/lexbor/lexbor/core/swar.h index ec0a13b8e23f..78579ad4bee7 100644 --- a/ext/lexbor/lexbor/core/swar.h +++ b/ext/lexbor/lexbor/core/swar.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2024 Alexander Borisov * - * Author: Niels Dossche + * Author: Nora Dossche */ #ifndef LEXBOR_SWAR_H diff --git a/ext/lexbor/php_lexbor.c b/ext/lexbor/php_lexbor.c index 85f840624402..570190eee238 100644 --- a/ext/lexbor/php_lexbor.c +++ b/ext/lexbor/php_lexbor.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | | Mate Kocsis | +----------------------------------------------------------------------+ */ diff --git a/ext/lexbor/php_lexbor.h b/ext/lexbor/php_lexbor.h index 155998388549..dccedb28b29b 100644 --- a/ext/lexbor/php_lexbor.h +++ b/ext/lexbor/php_lexbor.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | | Mate Kocsis | +----------------------------------------------------------------------+ */ diff --git a/ext/libxml/image_svg.c b/ext/libxml/image_svg.c index 69343fe298b0..88dfdfd81fd8 100644 --- a/ext/libxml/image_svg.c +++ b/ext/libxml/image_svg.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/libxml/image_svg.h b/ext/libxml/image_svg.h index b665c2c8d912..9e13ef2a421d 100644 --- a/ext/libxml/image_svg.h +++ b/ext/libxml/image_svg.h @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/libxml/mime_sniff.c b/ext/libxml/mime_sniff.c index b78a7a2d31bb..2e54d579814c 100644 --- a/ext/libxml/mime_sniff.c +++ b/ext/libxml/mime_sniff.c @@ -8,7 +8,7 @@ | | | SPDX-License-Identifier: BSD-3-Clause | +----------------------------------------------------------------------+ - | Authors: Niels Dossche | + | Authors: Nora Dossche | +----------------------------------------------------------------------+ */ diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 2db966c1661e..6b29471b2486 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1455,6 +1455,7 @@ PHP_FUNCTION(openssl_x509_parse) str_serial = i2s_ASN1_INTEGER(NULL, asn1_serial); /* Can return NULL on error or memory allocation failure */ if (!str_serial) { + OPENSSL_free(hex_serial); php_openssl_store_errors(); goto err; } @@ -1651,9 +1652,20 @@ PHP_FUNCTION(openssl_x509_read) RETURN_FALSE; } + X509 *obj_x509; + if (cert_obj) { + obj_x509 = X509_dup(cert); + if (!obj_x509) { + php_error_docref(NULL, E_WARNING, "X.509 Certificate could not be duplicated"); + RETURN_FALSE; + } + } else { + obj_x509 = cert; + } + object_init_ex(return_value, php_openssl_certificate_ce); x509_cert_obj = Z_OPENSSL_CERTIFICATE_P(return_value); - x509_cert_obj->x509 = cert_obj ? X509_dup(cert) : cert; + x509_cert_obj->x509 = obj_x509; } /* }}} */ @@ -1899,6 +1911,7 @@ PHP_FUNCTION(openssl_pkcs12_read) zout = zend_try_array_init(zout); if (!zout) { + sk_X509_pop_free(ca, X509_free); goto cleanup; } @@ -4685,6 +4698,7 @@ PHP_FUNCTION(openssl_seal) iv_len = EVP_CIPHER_iv_length(cipher); if (!iv && iv_len > 0) { + php_openssl_release_evp_cipher(cipher); zend_argument_value_error(6, "cannot be null for the chosen cipher algorithm"); RETURN_THROWS(); } @@ -4771,6 +4785,7 @@ PHP_FUNCTION(openssl_seal) efree(eks); efree(eksl); efree(pkeys); + php_openssl_release_evp_cipher(cipher); } /* }}} */ @@ -4847,6 +4862,7 @@ PHP_FUNCTION(openssl_open) EVP_CIPHER_CTX_free(ctx); out_pkey: EVP_PKEY_free(pkey); + php_openssl_release_evp_cipher(cipher); } /* }}} */ diff --git a/ext/openssl/openssl_backend_common.c b/ext/openssl/openssl_backend_common.c index 42491bf21041..ba9bccff98c0 100644 --- a/ext/openssl/openssl_backend_common.c +++ b/ext/openssl/openssl_backend_common.c @@ -593,6 +593,7 @@ zend_string* php_openssl_x509_fingerprint(X509 *peer, const char *method, bool r php_error_docref(NULL, E_WARNING, "Unknown digest algorithm"); return NULL; } else if (!X509_digest(peer, mdtype, md, &n)) { + php_openssl_release_evp_md(mdtype); php_openssl_store_errors(); php_error_docref(NULL, E_ERROR, "Could not generate signature"); return NULL; @@ -606,6 +607,7 @@ zend_string* php_openssl_x509_fingerprint(X509 *peer, const char *method, bool r ZSTR_VAL(ret)[n * 2] = '\0'; } + php_openssl_release_evp_md(mdtype); return ret; } diff --git a/ext/openssl/tests/openssl_pkcs12_read_array_init.phpt b/ext/openssl/tests/openssl_pkcs12_read_array_init.phpt new file mode 100644 index 000000000000..b57cd32b686a --- /dev/null +++ b/ext/openssl/tests/openssl_pkcs12_read_array_init.phpt @@ -0,0 +1,23 @@ +--TEST-- +Memory leak when array initialization in openssl_pkcs12_read() fails +--EXTENSIONS-- +openssl +--FILE-- +foo, "csos"); +} catch (TypeError $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECT-- +TypeError: Cannot assign array to reference held by property Typed::$foo of type string diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index a208741b1590..f5b1cb2010a0 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4762,11 +4762,7 @@ ZEND_METHOD(ReflectionClass, hasConstant) } GET_REFLECTION_OBJECT_PTR(ce); - if (zend_hash_exists(&ce->constants_table, name)) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } + RETURN_BOOL(zend_hash_exists(&ce->constants_table, name)); } /* }}} */