Open klonos opened 2 years ago
The code being mentioned in the error is this:
$projects_list = implode(', ', $projects);
$projects_list = drush_chalk($projects_list, '1m');
...trying to enable one module at a time doesn't make any difference.
The problem seems to be with typehinting. See: https://stackoverflow.com/questions/4103480/how-to-resolve-must-be-an-instance-of-string-string-given-prior-to-php-7
Prior to PHP 7 type hinting can only be used to force the types of objects and arrays. Scalar types are not type-hintable. In this case an object of the class
string
is expected, but you're giving it a (scalar)string
. The error message may be funny, but it's not supposed to work to begin with. Given the dynamic typing system, this actually makes some sort of perverted sense.
http://php.net/manual/en/language.oop5.typehinting.php
Type Hints can only be of the object and array (since PHP 5.1) type. Traditional type hinting with int and string isn't supported.
So we basically need to decide if we'll be supporting php5 (in which case the type hinting should be removed from the drush_chalk()
function), or leave things as they are and clearly state that things may not work properly if you are using php5.
@quicksketch @serundeputy thoughts on the above? ^^
The following error is thrown when trying to run
drush en devel devel_generate -y
in php 5.6.40:The same command works w/o throwing any errors in php 7.0+.