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

php7.1: fix non-numeric value encountered warning #34

Merged
merged 1 commit into from
Aug 29, 2017

Conversation

ctrlrsf
Copy link
Contributor

@ctrlrsf ctrlrsf commented Aug 29, 2017

Some swivels can return an empty string, and we can't perform bitwise & on
non-numeric values on 7.1 without getting a warning.

php 7.1 (adding cast eliminates the warning):

$ php --version
PHP 7.1.8-2+ubuntu16.04.1+deb.sury.org+4 (cli) (built: Aug  4 2017 13:04:12) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.8-2+ubuntu16.04.1+deb.sury.org+4, Copyright (c) 1999-2017, by Zend Technologies

$ php -r 'var_dump("" & 0);'
PHP Warning:  A non-numeric value encountered in Command line code on line 1
int(0)
$ php -r 'var_dump((int)"" & 0);'
int(0)

php 5.6 (doesn't require the cast):

$ php --version
PHP 5.6.31-4+ubuntu16.04.1+deb.sury.org+4 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

$ php -r 'var_dump("" & 0);'
int(0)
$ php -r 'var_dump((int)"" & 0);'
int(0)

Signed-off-by: Rene Fragoso ctrlrsf@gmail.com

Some swivels can return empty string, and we can't perform bitwise & on
non-numeric values on 7.1 without getting a warning.

php 7.1 (adding cast eliminates the warning):
```
$ php --version
PHP 7.1.8-2+ubuntu16.04.1+deb.sury.org+4 (cli) (built: Aug  4 2017 13:04:12) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.8-2+ubuntu16.04.1+deb.sury.org+4, Copyright (c) 1999-2017, by Zend Technologies

$ php -r 'var_dump("" & 0);'
PHP Warning:  A non-numeric value encountered in Command line code on line 1
int(0)
$ php -r 'var_dump((int)"" & 0);'
int(0)
```

php 5.6 (doesn't require the cast):
```
$ php --version
PHP 5.6.31-4+ubuntu16.04.1+deb.sury.org+4 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

$ php -r 'var_dump("" & 0);'
int(0)
$ php -r 'var_dump((int)"" & 0);'
int(0)
```

Signed-off-by: Rene Fragoso <ctrlrsf@gmail.com>
@jrbasso
Copy link
Member

jrbasso commented Aug 29, 2017

Travis failures are related with travis deprecating the HHVM. I will fix that in a separated PR.

@jrbasso jrbasso merged commit b2abbb7 into zumba:v1.3 Aug 29, 2017
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