Skip to content

Commit 74919b0

Browse files
committed
mark password as a sensitive param for 8.2
1 parent fc388e6 commit 74919b0

File tree

4 files changed

+68
-15
lines changed

4 files changed

+68
-15
lines changed

php_memcached.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3895,9 +3895,14 @@ PHP_METHOD(MemcachedServer, on)
38953895

38963896
#endif
38973897

3898+
#if PHP_VERSION_ID < 80200
3899+
#define zend_mark_function_parameter_as_sensitive(a,b,c)
3900+
#endif
3901+
38983902
#if PHP_VERSION_ID < 80000
38993903
#include "php_memcached_legacy_arginfo.h"
39003904
#else
3905+
#include "zend_attributes.h"
39013906
#include "php_memcached_arginfo.h"
39023907
#endif
39033908

@@ -4254,8 +4259,7 @@ PHP_MINIT_FUNCTION(memcached)
42544259

42554260
le_memc = zend_register_list_destructors_ex(NULL, php_memc_dtor, "Memcached persistent connection", module_number);
42564261

4257-
INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
4258-
memcached_ce = zend_register_internal_class(&ce);
4262+
memcached_ce = register_class_Memcached();
42594263
memcached_ce->create_object = php_memc_object_new;
42604264

42614265
#ifdef HAVE_MEMCACHED_PROTOCOL
@@ -4264,8 +4268,7 @@ PHP_MINIT_FUNCTION(memcached)
42644268
memcached_server_object_handlers.clone_obj = NULL;
42654269
memcached_server_object_handlers.free_obj = php_memc_server_free_storage;
42664270

4267-
INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
4268-
memcached_server_ce = zend_register_internal_class(&ce);
4271+
memcached_server_ce = register_class_MemcachedServer();
42694272
memcached_server_ce->create_object = php_memc_server_new;
42704273
#endif
42714274

php_memcached.stub.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/**
44
* @generate-function-entries
55
* @generate-legacy-arginfo
6+
* @generate-class-entries
67
*/
78

89

@@ -75,6 +76,7 @@ public function setOption(int $option, mixed $value): bool {}
7576
public function setOptions(array $options): bool {}
7677
public function setBucket(array $host_map, ?array $forward_map, int $replicas): bool {}
7778
#ifdef HAVE_MEMCACHED_SASL
79+
/** @sensitive-param $password **/
7880
public function setSaslAuthData(string $username, string $password): bool {}
7981
#endif
8082

@@ -86,7 +88,7 @@ public function isPristine(): bool {}
8688
public function checkKey(string $key): bool {}
8789
}
8890

89-
#ifdef HAVE_MEMCACHED_PROTOCOL
91+
#if defined(HAVE_MEMCACHED_PROTOCOL)
9092
class MemcachedServer {
9193

9294
public function run(string $address): bool {}

php_memcached_arginfo.h

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 3f4694d4e1f3d1647a832acd8539b056b2ab5e7a */
2+
* Stub hash: cad7892c60b5b898fa5e20b4b0b0ca62149c1334 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 1, "null")
@@ -406,12 +406,36 @@ static const zend_function_entry class_Memcached_methods[] = {
406406
};
407407

408408

409-
static const zend_function_entry class_MemcachedServer_methods[] = {
410409
#if defined(HAVE_MEMCACHED_PROTOCOL)
410+
static const zend_function_entry class_MemcachedServer_methods[] = {
411411
ZEND_ME(MemcachedServer, run, arginfo_class_MemcachedServer_run, ZEND_ACC_PUBLIC)
412-
#endif
413-
#if defined(HAVE_MEMCACHED_PROTOCOL)
414412
ZEND_ME(MemcachedServer, on, arginfo_class_MemcachedServer_on, ZEND_ACC_PUBLIC)
415-
#endif
416413
ZEND_FE_END
417414
};
415+
#endif
416+
417+
static zend_class_entry *register_class_Memcached(void)
418+
{
419+
zend_class_entry ce, *class_entry;
420+
421+
INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
422+
class_entry = zend_register_internal_class_ex(&ce, NULL);
423+
424+
#if defined(HAVE_MEMCACHED_SASL)
425+
zend_mark_function_parameter_as_sensitive(&class_entry->function_table, "setsaslauthdata", 1);
426+
#endif
427+
428+
return class_entry;
429+
}
430+
431+
#if defined(HAVE_MEMCACHED_PROTOCOL)
432+
static zend_class_entry *register_class_MemcachedServer(void)
433+
{
434+
zend_class_entry ce, *class_entry;
435+
436+
INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
437+
class_entry = zend_register_internal_class_ex(&ce, NULL);
438+
439+
return class_entry;
440+
}
441+
#endif

php_memcached_legacy_arginfo.h

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 3f4694d4e1f3d1647a832acd8539b056b2ab5e7a */
2+
* Stub hash: cad7892c60b5b898fa5e20b4b0b0ca62149c1334 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
55
ZEND_ARG_INFO(0, persistent_id)
@@ -402,12 +402,36 @@ static const zend_function_entry class_Memcached_methods[] = {
402402
};
403403

404404

405-
static const zend_function_entry class_MemcachedServer_methods[] = {
406405
#if defined(HAVE_MEMCACHED_PROTOCOL)
406+
static const zend_function_entry class_MemcachedServer_methods[] = {
407407
ZEND_ME(MemcachedServer, run, arginfo_class_MemcachedServer_run, ZEND_ACC_PUBLIC)
408-
#endif
409-
#if defined(HAVE_MEMCACHED_PROTOCOL)
410408
ZEND_ME(MemcachedServer, on, arginfo_class_MemcachedServer_on, ZEND_ACC_PUBLIC)
411-
#endif
412409
ZEND_FE_END
413410
};
411+
#endif
412+
413+
static zend_class_entry *register_class_Memcached(void)
414+
{
415+
zend_class_entry ce, *class_entry;
416+
417+
INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
418+
class_entry = zend_register_internal_class_ex(&ce, NULL);
419+
420+
#if defined(HAVE_MEMCACHED_SASL)
421+
zend_mark_function_parameter_as_sensitive(&class_entry->function_table, "setsaslauthdata", 1);
422+
#endif
423+
424+
return class_entry;
425+
}
426+
427+
#if defined(HAVE_MEMCACHED_PROTOCOL)
428+
static zend_class_entry *register_class_MemcachedServer(void)
429+
{
430+
zend_class_entry ce, *class_entry;
431+
432+
INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
433+
class_entry = zend_register_internal_class_ex(&ce, NULL);
434+
435+
return class_entry;
436+
}
437+
#endif

0 commit comments

Comments
 (0)