Skip to content

ext/pcntl: various refactorings#21282

Closed
devnexen wants to merge 5 commits intophp:masterfrom
devnexen:pcntl_refactoring
Closed

ext/pcntl: various refactorings#21282
devnexen wants to merge 5 commits intophp:masterfrom
devnexen:pcntl_refactoring

Conversation

@devnexen
Copy link
Member

No description provided.

pcntl_alarm() accepts a zend_long (signed) but passes it to alarm(),
which takes an unsigned int. Negative values silently wrap to large
unsigned values, scheduling an alarm far in the future instead of
raising an error.
deduplicated max signals computation by using globals
since it is casted to zend_long, better using add_assoc_long_ex due to
loss of precision with add_assoc_double_ex
@devnexen devnexen changed the title Pcntl refactoring ext/pcntl: various refactorings Feb 23, 2026
@devnexen devnexen marked this pull request as ready for review February 24, 2026 13:00
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Makes sense to me, only a small question regarding 0


if (seconds < 0) {
zend_argument_value_error(1, "must be greater or equal to 0");
if (seconds < 0 || seconds > UINT_MAX) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you really provide a value of 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes 0 means disabling any pending alarm.

@devnexen devnexen closed this in 9b01f51 Feb 26, 2026
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