mark password as a sensitive param for 8.2 (#516)

* mark password as a sensitive param for 8.2
This commit is contained in:
Remi Collet
2022-07-28 09:28:33 +02:00
committed by GitHub
parent fc388e65e7
commit ce2dfa5e64
4 changed files with 63 additions and 17 deletions

View File

@@ -3898,6 +3898,7 @@ PHP_METHOD(MemcachedServer, on)
#if PHP_VERSION_ID < 80000
#include "php_memcached_legacy_arginfo.h"
#else
#include "zend_attributes.h"
#include "php_memcached_arginfo.h"
#endif
@@ -4254,8 +4255,7 @@ PHP_MINIT_FUNCTION(memcached)
le_memc = zend_register_list_destructors_ex(NULL, php_memc_dtor, "Memcached persistent connection", module_number);
INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
memcached_ce = zend_register_internal_class(&ce);
memcached_ce = register_class_Memcached();
memcached_ce->create_object = php_memc_object_new;
#ifdef HAVE_MEMCACHED_PROTOCOL
@@ -4264,8 +4264,7 @@ PHP_MINIT_FUNCTION(memcached)
memcached_server_object_handlers.clone_obj = NULL;
memcached_server_object_handlers.free_obj = php_memc_server_free_storage;
INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
memcached_server_ce = zend_register_internal_class(&ce);
memcached_server_ce = register_class_MemcachedServer();
memcached_server_ce->create_object = php_memc_server_new;
#endif

View File

@@ -3,9 +3,9 @@
/**
* @generate-function-entries
* @generate-legacy-arginfo
* @generate-class-entries
*/
class Memcached {
public function __construct(?string $persistent_id=null, ?callable $callback=null, ?string $connection_str=null) {}
@@ -75,7 +75,7 @@ class Memcached {
public function setOptions(array $options): bool {}
public function setBucket(array $host_map, ?array $forward_map, int $replicas): bool {}
#ifdef HAVE_MEMCACHED_SASL
public function setSaslAuthData(string $username, string $password): bool {}
public function setSaslAuthData(string $username, #[\SensitiveParameter] string $password): bool {}
#endif
#ifdef HAVE_MEMCACHED_SET_ENCODING_KEY
@@ -86,7 +86,7 @@ class Memcached {
public function checkKey(string $key): bool {}
}
#ifdef HAVE_MEMCACHED_PROTOCOL
#if defined(HAVE_MEMCACHED_PROTOCOL)
class MemcachedServer {
public function run(string $address): bool {}

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 3f4694d4e1f3d1647a832acd8539b056b2ab5e7a */
* Stub hash: 0964c9bfee903e59b63e5a16bd8b6611d827b151 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 1, "null")
@@ -406,12 +406,39 @@ static const zend_function_entry class_Memcached_methods[] = {
};
#if defined(HAVE_MEMCACHED_PROTOCOL)
static const zend_function_entry class_MemcachedServer_methods[] = {
#if defined(HAVE_MEMCACHED_PROTOCOL)
ZEND_ME(MemcachedServer, run, arginfo_class_MemcachedServer_run, ZEND_ACC_PUBLIC)
#endif
#if defined(HAVE_MEMCACHED_PROTOCOL)
ZEND_ME(MemcachedServer, on, arginfo_class_MemcachedServer_on, ZEND_ACC_PUBLIC)
#endif
ZEND_FE_END
};
#endif
static zend_class_entry *register_class_Memcached(void)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
#if (PHP_VERSION_ID >= 80200)
#if defined(HAVE_MEMCACHED_SASL)
zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setsaslauthdata", sizeof("setsaslauthdata") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
#endif
#endif
return class_entry;
}
#if defined(HAVE_MEMCACHED_PROTOCOL)
static zend_class_entry *register_class_MemcachedServer(void)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
return class_entry;
}
#endif

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 3f4694d4e1f3d1647a832acd8539b056b2ab5e7a */
* Stub hash: 0964c9bfee903e59b63e5a16bd8b6611d827b151 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
ZEND_ARG_INFO(0, persistent_id)
@@ -402,12 +402,32 @@ static const zend_function_entry class_Memcached_methods[] = {
};
#if defined(HAVE_MEMCACHED_PROTOCOL)
static const zend_function_entry class_MemcachedServer_methods[] = {
#if defined(HAVE_MEMCACHED_PROTOCOL)
ZEND_ME(MemcachedServer, run, arginfo_class_MemcachedServer_run, ZEND_ACC_PUBLIC)
#endif
#if defined(HAVE_MEMCACHED_PROTOCOL)
ZEND_ME(MemcachedServer, on, arginfo_class_MemcachedServer_on, ZEND_ACC_PUBLIC)
#endif
ZEND_FE_END
};
#endif
static zend_class_entry *register_class_Memcached(void)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
return class_entry;
}
#if defined(HAVE_MEMCACHED_PROTOCOL)
static zend_class_entry *register_class_MemcachedServer(void)
{
zend_class_entry ce, *class_entry;
INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
return class_entry;
}
#endif