phpbb / epv

Extension Pre-Validator
GNU General Public License v2.0
9 stars 17 forks source link

epv_test_validate_php_functions.php can fail with strings #63

Closed iMattPro closed 7 years ago

iMattPro commented 7 years ago

This test can fail with the message:

PHP Catchable fatal error: Object of class PhpParser\Node\Expr\BinaryOp\Concat could not be converted to string in /home/travis/build/phpBB3/phpBB/vendor/phpbb/epv/src/Tests/Tests/epv_test_validate_php_functions.php on line 390

The failure will happen when an extension has, for example, a string or a string concatenated method name variable in the method call, like:

$result = $this->{'validate_' . $name}();

The obvious solution on the ext dev's end is not to do string concatenation in the method call, like:

$method = 'validate_' . $name;
$result = $this->{$method}();

However, since this is not an illegal style of coding, EPV should not fail on the string concatenated version in the first example. It should be able to successfully test both conditions.

Reference: https://travis-ci.org/phpbb-extensions/ad-management/jobs/270466947#L594