Skip to content
Open
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: 1 addition & 1 deletion ext/odbc/php_odbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ PHP_FUNCTION(odbc_execute)

if (ZSTR_LEN(tmpstr) > 2 &&
ZSTR_VAL(tmpstr)[0] == '\'' &&
ZSTR_VAL(tmpstr)[ZSTR_LEN(tmpstr) - 1] == '\'') {
zend_string_ends_with_literal(tmpstr, "'")) {

if (UNEXPECTED(zend_str_has_nul_byte(tmpstr))) {
odbc_release_params(result, params);
Expand Down
4 changes: 2 additions & 2 deletions ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,8 +1519,8 @@ static void zend_accel_add_key(zend_string *key, zend_accel_hash_entry *bucket)

static zend_always_inline bool is_phar_file(const zend_string *filename)
{
return filename && ZSTR_LEN(filename) >= sizeof(".phar") &&
!memcmp(ZSTR_VAL(filename) + ZSTR_LEN(filename) - (sizeof(".phar")-1), ".phar", sizeof(".phar")-1) &&
return filename &&
zend_string_ends_with_literal(filename, ".phar") &&
!strstr(ZSTR_VAL(filename), "://");
}

Expand Down
6 changes: 3 additions & 3 deletions ext/pgsql/pgsql.c
Original file line number Diff line number Diff line change
Expand Up @@ -3427,13 +3427,13 @@ static zend_result pgsql_copy_from_query(PGconn *pgsql, PGresult *pgsql_result,
}

int result;
if (ZSTR_LEN(tmp) > 0 && ZSTR_VAL(tmp)[ZSTR_LEN(tmp) - 1] != '\n') {
if (ZSTR_LEN(tmp) == 0 || zend_string_ends_with_literal(tmp, "\n")) {
result = PQputCopyData(pgsql, ZSTR_VAL(tmp), ZSTR_LEN(tmp));
} else {
char *zquery = zend_cstr_append_char(
ZSTR_VAL(tmp), ZSTR_LEN(tmp), '\n');
result = PQputCopyData(pgsql, zquery, ZSTR_LEN(tmp) + 1);
efree(zquery);
} else {
result = PQputCopyData(pgsql, ZSTR_VAL(tmp), ZSTR_LEN(tmp));
}

zend_tmp_string_release(tmp_tmp);
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/phar_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -4251,7 +4251,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 3, 5) static int extract_helper(const phar_archiv
if (FAILURE == phar_extract_file(overwrite, entry, path_to, error)) return -1;
extracted++;
} ZEND_HASH_FOREACH_END();
} else if (ZSTR_LEN(search) > 0 && '/' == ZSTR_VAL(search)[ZSTR_LEN(search) - 1]) {
} else if (zend_string_ends_with_literal(search, "/")) {
/* ends in "/" -- extract all entries having that prefix */
ZEND_HASH_MAP_FOREACH_PTR(&archive->manifest, entry) {
if (!zend_string_starts_with(entry->filename, search)) continue;
Expand Down
2 changes: 1 addition & 1 deletion ext/session/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ static PHP_INI_MH(OnUpdateRfc1867Freq)
return FAILURE;
}

if (ZSTR_LEN(new_value) > 0 && ZSTR_VAL(new_value)[ZSTR_LEN(new_value) - 1] == '%') {
if (zend_string_ends_with_literal(new_value, "%")) {
if (new_freq > 100) {
php_error_docref(NULL, E_WARNING, "session.upload_progress.freq must be less than or equal to 100%%");
return FAILURE;
Expand Down
8 changes: 2 additions & 6 deletions ext/soap/php_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,9 @@ static php_stream* http_connect(zval* this_ptr, php_uri *uri, bool use_ssl, php_
static bool in_domain(const zend_string *host, const zend_string *domain)
{
if (ZSTR_VAL(domain)[0] == '.') {
if (ZSTR_LEN(host) > ZSTR_LEN(domain)) {
return zend_string_equals_cstr(domain, ZSTR_VAL(host) + ZSTR_LEN(host) - ZSTR_LEN(domain), ZSTR_LEN(domain));
} else {
return false;
}
return zend_string_ends_with(host, domain);
} else {
return zend_string_equals(host,domain);
return zend_string_equals(host, domain);
}
}

Expand Down
Loading