Skip to content

sapi: convert current_user field to zend_string* - #22902

Merged
Girgias merged 2 commits into
php:masterfrom
Girgias:2026-07-sapi-globals-types
Jul 30, 2026
Merged

sapi: convert current_user field to zend_string*#22902
Girgias merged 2 commits into
php:masterfrom
Girgias:2026-07-sapi-globals-types

Conversation

@Girgias

@Girgias Girgias commented Jul 27, 2026

Copy link
Copy Markdown
Member

Prevents some reallocations and strlen() recomputations

Prevents some reallocations and strlen() recomputations
@Girgias
Girgias force-pushed the 2026-07-sapi-globals-types branch from 8f111cd to 4af34c4 Compare July 28, 2026 07:55
@Girgias Girgias changed the title sapi: various minor refactorings (2026-07 #1) Jul 28, 2026
@Girgias
Girgias marked this pull request as ready for review July 28, 2026 08:22
Comment thread ext/soap/php_sdl.c Outdated
PHP_MD5Final(digest, &md5_context);
make_digest(md5str, digest);
key = emalloc(len+sizeof("/wsdl-")-1+user_len+2+sizeof(md5str));
key = emalloc(len+sizeof("/wsdl-")-1+ZSTR_LEN(user)+2+sizeof(md5str));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key = emalloc(len+sizeof("/wsdl-")-1+ZSTR_LEN(user)+1+2+sizeof(md5str));
...
memcpy(key+len, ZSTR_VAL(user), ZSTR_LEN(user));
len += ZSTR_LEN(user);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if maybe this shouldn't be converted to use a smart str as the logic seems quite brittle. But nicely spotted.

@Girgias
Girgias merged commit 5795e33 into php:master Jul 30, 2026
18 checks passed
@Girgias
Girgias deleted the 2026-07-sapi-globals-types branch July 30, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment