1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Add assertion as optimization hint in php_url_encode_impl()

This avoids the code bloat induced by zend_string_truncate().
This commit is contained in:
Niels Dossche
2025-04-21 14:51:46 +02:00
parent 7e1c8efa02
commit 1b4bca605c

View File

@@ -536,6 +536,7 @@ static zend_always_inline zend_string *php_url_encode_impl(const char *s, size_t
}
*to = '\0';
ZEND_ASSERT(!ZSTR_IS_INTERNED(start) && GC_REFCOUNT(start) == 1);
start = zend_string_truncate(start, to - (unsigned char*)ZSTR_VAL(start), 0);
return start;