Skip to content

sapi/fpm/status: replace variable-length array with emalloc() #10660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

MaxKellermann
Copy link
Contributor

According to @cmb69, PHP does not require VLA support (#10304 (comment)). VLAs are a bad idea for several reasons, so let's get rid of them.

This is a continuation of #10645 (@bukka)

According to @cmb69, PHP does not require VLA support
(php#10304 (comment)).
VLAs are a bad idea for several reasons, so let's get rid of them.

This is a continuation of php#10645
struct fpm_scoreboard_proc_s procs[scoreboard.nprocs];
struct fpm_scoreboard_proc_s *procs = safe_emalloc(scoreboard.nprocs, sizeof(*procs), 0);
if (procs == NULL) {
return FAILURE;
Copy link
Member

@devnexen devnexen Feb 22, 2023

Choose a reason for hiding this comment

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

I'd suggest not to mix "semantics", FAILURE is meant for zend_result type, like above, I would suggest to return just -1.

Copy link
Contributor Author

@MaxKellermann MaxKellermann Feb 22, 2023

Choose a reason for hiding this comment

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

What I have assumed here is that fpm_status_export_to_zval() is really supposed to return zend_result according to PHP's guidelines, but I have not yet submitted a PR that actually does this.
(It already returns the hard-coded integers, but not formally zend_result, but that's just a formal change.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants