Skip to content
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

Relax possible E_ERROR condition to an Error exception #17285

Merged
merged 2 commits into from
Dec 27, 2024

Conversation

nielsdos
Copy link
Member

See #17231

@nielsdos nielsdos requested a review from Girgias as a code owner December 27, 2024 15:05
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.

MSTM!

@@ -1600,8 +1600,7 @@ PHP_METHOD(GlobIterator, count)
RETURN_LONG(php_glob_stream_get_count(intern->u.dir.dirp, NULL));
} else {
/* This can happen by abusing destructors. */
/* TODO: relax this from E_ERROR to an exception */
php_error_docref(NULL, E_ERROR, "GlobIterator lost glob state");
zend_throw_error(NULL, "GlobIterator lost glob state");
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to improve the error message? Also can you add a test to trigger this.

@nielsdos
Copy link
Member Author

@Girgias I just found out that it is actually impossible... The reason being that there's a get_method hook that checks the validity of the object. The reason this crashed in the other PR is because it was on a property instead of on a method, which isn't checked the same way. So I just replaced the code with an assertion and explanation comment.

@nielsdos nielsdos merged commit accf957 into php:master Dec 27, 2024
10 checks passed
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