Skip to content

Commit 55a88f3

Browse files
committed
add SensitiveParameter as known string and use it in arginfo
1 parent 332ac8e commit 55a88f3

File tree

14 files changed

+160
-447
lines changed

14 files changed

+160
-447
lines changed

Zend/zend_string.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ EMPTY_SWITCH_DEFAULT_CASE()
592592
_(ZEND_STR_AUTOGLOBAL_ENV, "_ENV") \
593593
_(ZEND_STR_AUTOGLOBAL_REQUEST, "_REQUEST") \
594594
_(ZEND_STR_COUNT, "count") \
595+
_(ZEND_STR_SENSITIVEPARAMETER, "SensitiveParameter") \
595596

596597

597598
typedef enum _zend_known_string_id {

build/gen_stub.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,11 +2373,19 @@ public function __construct(string $class, array $args) {
23732373

23742374
/** @param iterable<ConstInfo> $allConstInfos */
23752375
public function generateCode(string $invocation, string $nameSuffix, iterable $allConstInfos): string {
2376+
/* see ZEND_KNOWN_STRINGS in Zend/strings.h */
2377+
static $knowns = [
2378+
"SensitiveParameter" => "ZEND_STR_SENSITIVEPARAMETER",
2379+
];
23762380
$code = "\n";
23772381
$escapedAttributeName = strtr($this->class, '\\', '_');
2378-
$code .= "\tzend_string *attribute_name_{$escapedAttributeName}_$nameSuffix = zend_string_init(\"" . addcslashes($this->class, "\\") . "\", sizeof(\"" . addcslashes($this->class, "\\") . "\") - 1, 1);\n";
2379-
$code .= "\t" . ($this->args ? "zend_attribute *attribute_{$escapedAttributeName}_$nameSuffix = " : "") . "$invocation, attribute_name_{$escapedAttributeName}_$nameSuffix, " . count($this->args) . ");\n";
2380-
$code .= "\tzend_string_release(attribute_name_{$escapedAttributeName}_$nameSuffix);\n";
2382+
if (isset($knowns[$escapedAttributeName])) {
2383+
$code .= "\t" . ($this->args ? "zend_attribute *attribute_{$escapedAttributeName}_$nameSuffix = " : "") . "$invocation, ZSTR_KNOWN({$knowns[$escapedAttributeName]}), " . count($this->args) . ");\n";
2384+
} else {
2385+
$code .= "\tzend_string *attribute_name_{$escapedAttributeName}_$nameSuffix = zend_string_init(\"" . addcslashes($this->class, "\\") . "\", sizeof(\"" . addcslashes($this->class, "\\") . "\") - 1, 1);\n";
2386+
$code .= "\t" . ($this->args ? "zend_attribute *attribute_{$escapedAttributeName}_$nameSuffix = " : "") . "$invocation, attribute_name_{$escapedAttributeName}_$nameSuffix, " . count($this->args) . ");\n";
2387+
$code .= "\tzend_string_release(attribute_name_{$escapedAttributeName}_$nameSuffix);\n";
2388+
}
23812389
foreach ($this->args as $i => $arg) {
23822390
$value = EvaluatedValue::createFromExpression($arg->value, null, null, $allConstInfos);
23832391
$zvalName = "attribute_{$escapedAttributeName}_{$nameSuffix}_arg$i";

ext/ftp/ftp_arginfo.h

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/hash/hash_arginfo.h

Lines changed: 7 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/imap/php_imap_arginfo.h

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/ldap/ldap_arginfo.h

Lines changed: 6 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/mysqli/mysqli_arginfo.h

Lines changed: 7 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/oci8/oci8_arginfo.h

Lines changed: 6 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)