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

Resource and integerish #206

Closed
manuxi opened this issue Jan 24, 2017 · 3 comments
Closed

Resource and integerish #206

manuxi opened this issue Jan 24, 2017 · 3 comments

Comments

@manuxi
Copy link

manuxi commented Jan 24, 2017

Please try Assertion::integerish(fopen(FILE, 'r')); Works but should not.

@rquadling
Copy link
Contributor

Well, PHP's type juggling of a resource to non zero...

php -r 'var_dump(fopen("./index.php","r"));' : resource(5) of type (stream)
php -r 'var_dump((int)fopen("./index.php","r"));' : int(5)

So, the resource number is integer-ish ...

Interesting issue. I wonder how many people are asserting that resources are integer-ish and are happy with it.

@rquadling
Copy link
Contributor

Thank you for the report. Fixed in https://github.com/beberlei/assert/releases/tag/v2.7.3

@manuxi
Copy link
Author

manuxi commented Jan 24, 2017

Wow, that was fast ;)
Thank you!

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

No branches or pull requests

2 participants