Skip to content

Fix #36 #37

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

Merged
merged 1 commit into from
Mar 26, 2018
Merged

Fix #36 #37

merged 1 commit into from
Mar 26, 2018

Conversation

samuelnogueira
Copy link

@samuelnogueira samuelnogueira commented Mar 26, 2018

Replacing string with the boolean condition should maintain compatibility with PHP 5.5 + PHP 7.
With this, a good error description on assertions failure is lost in PHP 5, but maintained for PHP 7.
These assertions are only an issue with E_DEPRECATED level errors are reported.

This will fix #36

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

From the php docs:

The assertion. In PHP 5, this must be either a string to be evaluated or a boolean to be tested. In PHP 7, this may also be any expression that returns a value, which will be executed and the result used to indicate whether the assertion succeeded or failed.

Warning: Using string as the assertion is DEPRECATED as of PHP 7.2.

Using a boolean is a great solution.

@mekras mekras merged commit 2ad65db into php-http:master Mar 26, 2018
@dbu
Copy link
Contributor

dbu commented Mar 27, 2018

@mekras is this check only for debugging purposes? afaik on a properly configured server, assert will be skipped. from http://php.net/manual/en/function.assert.php:

Assertions should be used as a debugging feature only. You may use them for sanity-checks that test for conditions that should always be TRUE and that indicate some programming errors if not or to check for the presence of certain features like extension functions or certain system limits and features.

Assertions should not be used for normal runtime operations like input parameter checks. As a rule of thumb your code should always be able to work correctly if assertion checking is not activated.

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.

PHP 7.2: Failure evaluating code: is_resource($handle)
4 participants