Error: Call-time pass-by-reference has been removed in path/to/sites/all/themes/boilerplate/boilerplate.drush.inc, line 92
It's in this line:
$custom = str_replace('/contrib/', '/custom/', $newtheme_path, &$count);
Introduced in this commit (16-Jan-2013):
http://drupalcode.org/project/boilerplate.git/commitdiff/b2c1b3bb5266c3c...
The first issue here is that the developer must be running PHP with a low error reporting setting or running a very old version of PHP. Call-time pass-by-reference has been deprecated for a long time, as of PHP 5.3 (June 2009!) it raises a warning and as of PHP 5.4 (March 2012) it raises a fatal error.
http://php.net/manual/en/language.references.pass.php
This means that you really can't use this parameter in a str_replace anymore. So you can test for the string with strpos and then do the replace if it works. Should be the same result (untested code - I'm being told it's late and I need to quit!)
if (strpos('/contrib/', $newtheme_path,) and is_dir(preg_replace('|/[^/]+$|', '', $custom))) {
$newtheme_path = str_replace('/contrib/', '/custom/', $newtheme_path);
}
Comment | File | Size | Author |
---|---|---|---|
#1 | boilerplate-call_by_ref_fix-1900072-2.patch | 832 bytes | ergophobe |
Comments
Comment #1
ergophobe CreditAttribution: ergophobe commentedHere's a simple patch using the code in my initial comment.
Note that I have only done the most rudimentary testing. I don't use the /custom dir so I didn't test it. All I've tested is that I can now run
drush en boilerplate
without a fatal error.
Comment #2
twardnw CreditAttribution: twardnw commentedThanks for pointing this out (and the initial patch).
I've gone a little different direction with this now though, a bit simpler method to check where to put the theme. Pull the latest from git and take a look ;)
Comment #3
ergophobe CreditAttribution: ergophobe commentedLooks good! I always try to make the smallest number of changes to someone else's code, but yeah, that's better than the preg_replace() solution.
Anyway, thanks for staying on it!
Comment #5
theamoeba CreditAttribution: theamoeba commented+1
Comment #6
michaelmallett CreditAttribution: michaelmallett commentedCan you submit this as a patch please twardnw?
Comment #7
michaelmallett CreditAttribution: michaelmallett commentedI tried to use the patch for the issue from git and I still get the error from line 80 and 103
$custom = str_replace('/contrib/', '/custom/', $newtheme_path, &$count);
Comment #8
apprentia CreditAttribution: apprentia commentedI've built a number of sites with boilerplate but I am encountering this for the first time.
A drush status prior to the error gives this information :
Drupal version : 7.26
Drush version : 6.2.0
PHP configuration : php5.5.3
I'm using the 7.x-1.9 of boilerplate. and I'm getting this error whenever I try to drush in the project. (not getting the error in other projects that don"t have boilerplate)
"Error: Call-time pass-by-reference has been removed in /boilerplate.drush.inc, line 92"
Could this be something to do with the vesion of PHP that I'm running?
in #2 twardnw "Pull the latest from git and take a look ;)", isn't that what i did when I got the last version of the theme?
I'm a little bit lost as to what i should do... can you please clarify it for me?
Comment #9
theamoeba CreditAttribution: theamoeba commentedWhy is this still an issue in 2014?
Comment #10
grendzy CreditAttribution: grendzy commentedThis was fixed in http://cgit.drupalcode.org/boilerplate/commit/?id=a1aac65. The fix will be in the next release.