Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: prevent C errors when using weird max_execution_time values#13942

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

dunglas
Copy link
Member

Callingset_time_limit() or settingmax_execution_time to a negative value or to a value superior to 999,999,999 can trigger C errors:php/frankenphp#713 /https://linux.die.net/man/2/setitimer

This patch normalizes such values as 0.

@withinboredom raised the issue onhttps://externals.io/message/123108, and we may indeed correctly specify this behavior, but in the meantime, we should at least not throw a C error, which is inconsistent with what is done on other platforms.

realFlowControl reacted with heart emoji
@dunglasdunglas changed the base branch frommaster toPHP-8.2April 11, 2024 14:06
Copy link
Member

@withinboredomwithinboredom left a comment

Choose a reason for hiding this comment

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

LGTM


// Prevent EINVAL error
if (seconds<0||seconds>999999999) {
seconds=0;
Copy link
Contributor

@staabmstaabmApr 11, 2024
edited
Loading

Choose a reason for hiding this comment

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

maybe raise a warning?

arnaud-lb reacted with thumbs up emoji
Copy link
Member

@withinboredomwithinboredomApr 11, 2024
edited
Loading

Choose a reason for hiding this comment

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

FWIW, other SAPI's don't appear to raise a warning and a lot of people make warnings exceptions. But yeah, I agree and that's the entire purpose of the discussion on internals....

For now, it is probably better to conform to existing behavior vs. introducing new behavior.

dunglas and arnaud-lb reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

I agree. On a second look, this is just making zend-max-execution-timers consistent with other timeout implementations.set_time_limit(-1) disables the timeout (probably by accident), and people rely on it:https://github.com/search?q=%22set_time_limit%28-1%29%22&type=code.

dunglas reacted with thumbs up emoji
@arnaud-lbarnaud-lb merged commitf6e8145 intophp:PHP-8.2Apr 16, 2024
@arnaud-lb
Copy link
Member

Thank you!

dunglas reacted with heart emoji

arnaud-lb added a commit to arnaud-lb/php-src that referenced this pull requestApr 16, 2024
* PHP-8.2:  [ci skip] NEWS  fix: zend-max-execution-timers with negative or high timeout value (php#13942)  Use return value of getpwuid_r(), not errno (php#13969)
arnaud-lb added a commit to arnaud-lb/php-src that referenced this pull requestApr 16, 2024
* PHP-8.3:  [ci skip] NEWS  [ci skip] NEWS  fix: zend-max-execution-timers with negative or high timeout value (php#13942)  Use return value of getpwuid_r(), not errno (php#13969)
@dragoonis
Copy link
Contributor

Nice find@dunglas

dunglas reacted with heart emoji

@dunglasdunglas deleted the fix/invalid-max_execution_time-values branchApril 16, 2024 13:40
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@arnaud-lbarnaud-lbAwaiting requested review from arnaud-lbarnaud-lb is a code owner

@dstogovdstogovAwaiting requested review from dstogovdstogov is a code owner

2 more reviewers

@staabmstaabmstaabm left review comments

@withinboredomwithinboredomwithinboredom left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@dunglas@arnaud-lb@dragoonis@staabm@withinboredom

[8]ページ先頭

©2009-2025 Movatter.jp