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
4 changes: 4 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ PHP 8.6 INTERNALS UPGRADE NOTES
1. Internal API changes
========================

. ZSTR_INIT_LITERAL(), zend_string_starts_with_literal(), and
zend_string_starts_with_literal_ci() now support strings containing NUL
bytes. Passing non-literal char* is no longer supported.

========================
2. Build system changes
========================
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ static zend_always_inline uint32_t zend_visibility_to_set_visibility(uint32_t vi
// Must not clash with ZEND_SHORT_CIRCUITING_CHAIN_MASK
#define ZEND_JMP_NULL_BP_VAR_IS 4

char *zend_visibility_string(uint32_t fn_flags);
const char *zend_visibility_string(uint32_t fn_flags);

#define ZEND_PROPERTY_HOOK_COUNT 2
#define ZEND_PROPERTY_HOOK_STRUCT_SIZE (sizeof(zend_function*) * ZEND_PROPERTY_HOOK_COUNT)
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */
}
/* }}} */

char *zend_visibility_string(uint32_t fn_flags) /* {{{ */
const char *zend_visibility_string(uint32_t fn_flags) /* {{{ */
{
if (fn_flags & ZEND_ACC_PUBLIC) {
return "public";
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ END_EXTERN_C()

#define ZSTR_ALLOCA_FREE(str, use_heap) free_alloca(str, use_heap)

#define ZSTR_INIT_LITERAL(s, persistent) (zend_string_init((s), strlen(s), (persistent)))
#define ZSTR_INIT_LITERAL(s, persistent) (zend_string_init(("" s), sizeof(s) - 1, (persistent)))

/*---*/

Expand Down Expand Up @@ -402,7 +402,7 @@ static zend_always_inline bool zend_string_starts_with(const zend_string *str, c
}

#define zend_string_starts_with_literal(str, prefix) \
zend_string_starts_with_cstr(str, prefix, strlen(prefix))
zend_string_starts_with_cstr(str, "" prefix, sizeof(prefix) - 1)

static zend_always_inline bool zend_string_starts_with_cstr_ci(const zend_string *str, const char *prefix, size_t prefix_length)
{
Expand All @@ -415,7 +415,7 @@ static zend_always_inline bool zend_string_starts_with_ci(const zend_string *str
}

#define zend_string_starts_with_literal_ci(str, prefix) \
zend_string_starts_with_cstr_ci(str, prefix, strlen(prefix))
zend_string_starts_with_cstr_ci(str, "" prefix, sizeof(prefix) - 1)

/*
* DJBX33A (Daniel J. Bernstein, Times 33 with Addition)
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/element.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ zend_result dom_element_class_name_write(dom_object *obj, zval *newval)
zval *dom_get_prop_checked_offset(dom_object *obj, uint32_t offset, const char *name)
{
#if ZEND_DEBUG
zend_string *name_zstr = ZSTR_INIT_LITERAL(name, false);
zend_string *name_zstr = zend_string_init(name, strlen(name), false);
const zend_property_info *prop_info = zend_get_property_info(obj->std.ce, name_zstr, 0);
zend_string_release_ex(name_zstr, false);
ZEND_ASSERT(OBJ_PROP_TO_NUM(prop_info->offset) == offset);
Expand Down
7 changes: 7 additions & 0 deletions ext/zend_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,13 @@ static ZEND_FUNCTION(zend_test_zend_ini_str)
RETURN_STR(ZT_G(str_test));
}

static ZEND_FUNCTION(zend_test_zstr_init_literal)
{
ZEND_PARSE_PARAMETERS_NONE();

RETURN_STR(ZSTR_INIT_LITERAL("foo\0bar", false));
}

static ZEND_FUNCTION(zend_test_is_string_marked_as_valid_utf8)
{
zend_string *str;
Expand Down
1 change: 1 addition & 0 deletions ext/zend_test/test.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ function zend_test_zend_ini_parse_quantity(string $str): int {}
function zend_test_zend_ini_parse_uquantity(string $str): int {}

function zend_test_zend_ini_str(): string {}
function zend_test_zstr_init_literal(): string {}

#ifdef ZEND_CHECK_STACK_LIMIT
function zend_test_zend_call_stack_get(): ?array {}
Expand Down
6 changes: 5 additions & 1 deletion ext/zend_test/test_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ext/zend_test/tests/zstr_init_literal.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
zstr_init_literal
--EXTENSIONS--
zend_test
--FILE--
<?php

var_dump(strlen(zend_test_zstr_init_literal()), bin2hex(zend_test_zstr_init_literal()));

?>
--EXPECT--
int(7)
string(14) "666f6f00626172"
2 changes: 1 addition & 1 deletion ext/zip/php_zip.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern zend_module_entry zip_module_entry;
/* Additionnal flags not from libzip */
#define ZIP_FL_OPEN_FILE_NOW (1u<<30)

#define PHP_ZIP_VERSION "1.22.6"
#define PHP_ZIP_VERSION "1.22.7"

#ifdef HAVE_LIBZIP_VERSION
#define LIBZIP_VERSION_STR zip_libzip_version()
Expand Down