Skip to content

Commit a4db4b2

Browse files
committed
refactor
1 parent e0e2963 commit a4db4b2

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

Zend/zend_object_handlers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ ZEND_API zend_result zend_check_property_access(const zend_object *zobj, zend_st
563563
if (!(property_info->flags & ZEND_ACC_PRIVATE)) {
564564
/* we we're looking for a private prop but found a non private one of the same name */
565565
return FAILURE;
566-
} else if (strcmp(ZSTR_VAL(prop_info_name)+1, ZSTR_VAL(property_info->name)+1)) {
566+
} else if (!zend_string_equals(prop_info_name, property_info->name)) {
567567
/* we we're looking for a private prop but found a private one of the same name but another class */
568568
return FAILURE;
569569
}

ext/openssl/openssl_pwhash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ PHP_FUNCTION(openssl_password_hash)
331331
Z_PARAM_ARRAY_HT(options)
332332
ZEND_PARSE_PARAMETERS_END();
333333

334-
if (strcmp(ZSTR_VAL(algo), "argon2i") && strcmp(ZSTR_VAL(algo), "argon2id")) {
334+
if (!zend_string_equals_literal(algo, "argon2i") && !zend_string_equals_literal(algo, "argon2id")) {
335335
zend_argument_value_error(1, "must be a valid password openssl hashing algorithm");
336336
RETURN_THROWS();
337337
}
@@ -357,7 +357,7 @@ PHP_FUNCTION(openssl_password_verify)
357357
Z_PARAM_STR(digest)
358358
ZEND_PARSE_PARAMETERS_END();
359359

360-
if (strcmp(ZSTR_VAL(algo), "argon2i") && strcmp(ZSTR_VAL(algo), "argon2id")) {
360+
if (!zend_string_equals_literal(algo, "argon2i") && !zend_string_equals_literal(algo, "argon2id")) {
361361
zend_argument_value_error(1, "must be a valid password openssl hashing algorithm");
362362
RETURN_THROWS();
363363
}

ext/soap/php_encoding.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,15 @@ void whiteSpace_collapse(xmlChar* str)
252252

253253
static encodePtr find_encoder_by_type_name(sdlPtr sdl, const char *type)
254254
{
255+
size_t type_len = strlen(type);
256+
255257
if (sdl && sdl->encoders) {
256258
encodePtr enc;
257259

258260
ZEND_HASH_FOREACH_PTR(sdl->encoders, enc) {
259261
if (type[0] == '{') {
260262
if (enc->details.clark_notation
261-
&& strcmp(ZSTR_VAL(enc->details.clark_notation), type) == 0) {
263+
&& zend_string_equals_cstr(enc->details.clark_notation, type, type_len)) {
262264
return enc;
263265
}
264266
} else {

ext/soap/php_http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static bool in_domain(const zend_string *host, const zend_string *domain)
327327
{
328328
if (ZSTR_VAL(domain)[0] == '.') {
329329
if (ZSTR_LEN(host) > ZSTR_LEN(domain)) {
330-
return strcmp(ZSTR_VAL(host)+ZSTR_LEN(host)-ZSTR_LEN(domain), ZSTR_VAL(domain)) == 0;
330+
return zend_string_equals_cstr(domain, ZSTR_VAL(host) + ZSTR_LEN(host) - ZSTR_LEN(domain), ZSTR_LEN(domain));
331331
} else {
332332
return false;
333333
}

0 commit comments

Comments
 (0)