Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Zend/zend_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion ext/bcmath/libbcmath/src/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/bcmath/libbcmath/src/convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html5_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html5_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html5_serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html5_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html_collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/html_document.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/infra.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/infra.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/inner_outer_html_mixin.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/internal_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/lexbor/selectors-adapted/selectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) 2021-2026 Alexander Borisov
*
* Author: Alexander Borisov <borisov@lexbor.com>
* Adapted for PHP + libxml2 by: Niels Dossche <nielsdos@php.net>
* Adapted for PHP + libxml2 by: Nora Dossche <ndossche@php.net>
* Based on Lexbor (upstream commit 5291cde0d40f77e7c4ea364b7cd726269e0bf1f9)
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/lexbor/selectors-adapted/selectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (C) 2021-2025 Alexander Borisov
*
* Author: Alexander Borisov <borisov@lexbor.com>
* Adapted for PHP libxml2 by: Niels Dossche <nielsdos@php.net>
* Adapted for PHP libxml2 by: Nora Dossche <ndossche@php.net>
*/


Expand Down
2 changes: 1 addition & 1 deletion ext/dom/namespace_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/namespace_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/nodelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/obj_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
+----------------------------------------------------------------------+
| Authors: Christian Stocker <chregu@php.net> |
| Rob Richards <rrichards@php.net> |
| Niels Dossche <nielsdos@php.net> |
| Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/obj_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/parentnode/css_selectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/parentnode/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Benjamin Eberlei <beberlei@php.net> |
| Niels Dossche <nielsdos@php.net> |
| Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/private_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/private_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/serialize_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/token_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/token_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/xml_document.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/xml_serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/xml_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/xpath_callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
+----------------------------------------------------------------------+
| Authors: Christian Stocker <chregu@php.net> |
| Rob Richards <rrichards@php.net> |
| Niels Dossche <nielsdos@php.net> |
| Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/dom/xpath_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/lexbor/lexbor/core/swar.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2024 Alexander Borisov
*
* Author: Niels Dossche <nielsdos@php.net>
* Author: Nora Dossche <ndossche@php.net>
*/

#ifndef LEXBOR_SWAR_H
Expand Down
2 changes: 1 addition & 1 deletion ext/lexbor/php_lexbor.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
| Mate Kocsis <kocsismate@php.net> |
+----------------------------------------------------------------------+
*/
Expand Down
2 changes: 1 addition & 1 deletion ext/lexbor/php_lexbor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
| Mate Kocsis <kocsismate@php.net> |
+----------------------------------------------------------------------+
*/
Expand Down
2 changes: 1 addition & 1 deletion ext/libxml/image_svg.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
2 changes: 1 addition & 1 deletion ext/libxml/image_svg.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| |
| SPDX-License-Identifier: BSD-3-Clause |
+----------------------------------------------------------------------+
| Authors: Niels Dossche <nielsdos@php.net> |
| Authors: Nora Dossche <ndossche@php.net> |
+----------------------------------------------------------------------+
*/

Expand Down
Loading