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
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ PHP NEWS
. Add HEIF/HEIC support to getimagesize. (Benstone Zhang)
. Implement #71517 (Implement SVG support for getimagesize() and friends).
(nielsdos)
. Optimized PHP html_entity_decode function. (Artem Ukrainskiy)
. Minor optimization to array_chunk(). (nielsdos)

- URI:
. Empty host handling is fixed. (Máté Kocsis)
Expand Down
1 change: 1 addition & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ PHP 8.5 UPGRADE NOTES
. Improved unpack() performance with nameless repetitions by avoiding
creating temporary strings and reparsing them.
. Improved pack() performance.
. Minor improvements in array_chunk() performance.

- XMLReader:
. Improved property access performance.
Expand Down
28 changes: 7 additions & 21 deletions Zend/zend_attributes_arginfo.h

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

4 changes: 1 addition & 3 deletions Zend/zend_constants_arginfo.h

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

11 changes: 10 additions & 1 deletion Zend/zend_multiply.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si

static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, size_t offset, bool *overflow)
{
size_t res = nmemb;
size_t res;
zend_ulong m_overflow = 0;

#ifdef __ILP32__ /* x32 */
Expand All @@ -186,12 +186,21 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si
#endif

if (ZEND_CONST_COND(offset == 0, 0)) {
res = nmemb;
__asm__ ("mul" LP_SUFF " %3\n\t"
"adc $0,%1"
: "=&a"(res), "=&d" (m_overflow)
: "%0"(res),
"rm"(size));
} else if (ZEND_CONST_COND(nmemb == 1, 0)) {
res = size;
__asm__ ("add %2, %0\n\t"
"adc $0,%1"
: "+r"(res), "+r" (m_overflow)
: "rm"(offset)
: "cc");
} else {
res = nmemb;
__asm__ ("mul" LP_SUFF " %3\n\t"
"add %4,%0\n\t"
"adc $0,%1"
Expand Down
25 changes: 17 additions & 8 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2358,11 +2358,14 @@ private function __construct($value, SimpleType $type, Expr $expr, array $origin
$this->isUnknownConstValue = $isUnknownConstValue;
}

public function initializeZval(string $zvalName): string
public function initializeZval(string $zvalName, bool $alreadyExists = false, string $forStringDef = ''): string
{
$cExpr = $this->getCExpr();

$code = "\tzval $zvalName;\n";
$code = '';
if (!$alreadyExists) {
$code = "\tzval $zvalName;\n";
}

if ($this->type->isNull()) {
$code .= "\tZVAL_NULL(&$zvalName);\n";
Expand All @@ -2382,8 +2385,11 @@ public function initializeZval(string $zvalName): string
if ($cExpr === '""') {
$code .= "\tZVAL_EMPTY_STRING(&$zvalName);\n";
} else {
$code .= "\tzend_string *{$zvalName}_str = zend_string_init($cExpr, strlen($cExpr), 1);\n";
$code .= "\tZVAL_STR(&$zvalName, {$zvalName}_str);\n";
if ($forStringDef === '') {
$forStringDef = "{$zvalName}_str";
}
$code .= "\tzend_string *$forStringDef = zend_string_init($cExpr, strlen($cExpr), 1);\n";
$code .= "\tZVAL_STR(&$zvalName, $forStringDef);\n";
}
} elseif ($this->type->isArray()) {
if ($cExpr == '[]') {
Expand Down Expand Up @@ -2821,7 +2827,8 @@ private function getClassConstDeclaration(EvaluatedValue $value, array $allConst
{
$constName = $this->name->getDeclarationName();

$zvalCode = $value->initializeZval("const_{$constName}_value", $allConstInfos);
// TODO $allConstInfos is unused
$zvalCode = $value->initializeZval("const_{$constName}_value");

$code = "\n" . $zvalCode;

Expand Down Expand Up @@ -3378,9 +3385,11 @@ public function generateCode(string $invocation, string $nameSuffix, array $allC
}
if ($initValue === '') {
$value = EvaluatedValue::createFromExpression($arg->value, null, null, $allConstInfos);
$zvalName = "attribute_{$escapedAttributeName}_{$nameSuffix}_arg$i";
$code .= $value->initializeZval($zvalName);
$code .= "\tZVAL_COPY_VALUE(&attribute_{$escapedAttributeName}_{$nameSuffix}->args[$i].value, &$zvalName);\n";
$code .= $value->initializeZval(
"attribute_{$escapedAttributeName}_{$nameSuffix}->args[$i].value",
true,
"attribute_{$escapedAttributeName}_{$nameSuffix}_arg{$i}_str"
);
} else {
$code .= $initValue;
}
Expand Down
4 changes: 1 addition & 3 deletions ext/curl/curl_arginfo.h

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

Loading