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

Change line mentioning assert should only be used when debugging #4537

Merged
merged 2 commits into from
Mar 23, 2025

Conversation

pvandommelen
Copy link
Contributor

The implication of only being used as a debugging tool is that it should never hit production code. This is contradicted by the line above ("but are optimised away to have zero cost in production") above and the paragraph following it which requires asserts to exist in running code to make sense.

As mentioned in a comment on the php.net page (https://www.php.net/manual/en/function.assert.php#129271), assert sees widespread usage in code in the wild. It definitely is used outside of debugging.

Instead of removing it, this changes the line to mention its relation to debugging which is relevant and otherwise absent from the article.

The implication of only being used as a debugging tool is that it should never hit production code.
This is contradicted by the line above ("but are optimised away to have zero cost in production") above and the paragraph following it which requires asserts to exist in running code to make sense.

As mentioned in a comment on the php.net page (https://www.php.net/manual/en/function.assert.php#129271), `assert` sees widespread usage in code in the wild. It definitely is used outside of debugging.

Instead of removing it, this changes the line to mention its relation to debugging which is relevant and otherwise absent from the article.
Copy link
Member

@TimWolla TimWolla left a comment

Choose a reason for hiding this comment

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

Thanks. This has also bothered me before and I wanted to give the page a larger rewrite when I have the time. But this is already a good incremental improment.

@TimWolla TimWolla merged commit bb9365a into php:master Mar 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants