Understand the problem:
<?php
function spam(&$arg) {
print $arg . "\n";
}
$var = 'PHP';
spam(&$var); # Causa erro
spam($var); # Okay!
I don’t think this error is in the Laravel framework itself - because someone would have already detected it -, but in some specific part of the application like controllers, models, services etc.
All you should do now is search (with help of your code editor, IDE or LINUX command line tools) for something like this: "&$
" in function calls (but not in definitions) of the source code.
This is because the error derives from some function call where some parameter is passed with "&
" in front of the variable/parameter. Find these occurrences and it will be solved.
In the editor sublimetext there is a tool called Find in files, the menu is:
Find -> Find in Files... (Shift + Ctrl + F):
EDIT
I noticed that you posted only part of the mistake.
I’m pretty sure that if you post the rest of the message or Stacktrace (better) there will be the line where the error is and then you won’t even need to search the entire source code, just go on the line pointed at the error and make the adjustment. Please paste the stacktrace of the error.
A typical mistake like this is expected to return something like this:
PHP Fatal error: Call-time pass-by-Ference has been Removed in
/home/Martins/teste.php on line 10
Fatal error: Call-time pass-by-Ference has been Removed in
/home/Martins/teste.php on line 10
It’s probably a version incompatibility problem for PHP and Laravel.You know how to report their version.
– Pedro Erick
Which version do you use? Which version? It is always important to provide details in the questions, so we can detect the problem.
– Wallace Maxters
PHP is 5.5.12, and I’m using Laravel 5
– Isaias Lima
But other projects that I have Artisan works, only in this project that I took from a client that is giving this problem
– Isaias Lima
It looks like old code stuff, huh. This system has always been in Laravel 5 or is it being migrated? Do you know which version of php it was running in?
– Wallace Maxters
Try to disable file errors
artisan
to see if it works. It’s a trick, but it’s worth a try. Do it in the first line of Artisan (after <?php of course)– Wallace Maxters
Your mistake is related to a line more or less like this
obj = & new Classe();
look for a&
. They would not use a deprecated/removed resource or gambiarra.– rray
@rray maybe he wrote it himself then, right?
– Wallace Maxters
You need to add more details to the @Isaiaslima question. Artisan does not tell you which file the execution error occurs in?
– Wallace Maxters
Where exactly do I look for the "&"? I did a Composer update, and presented the sequinte error in Artisan: "Script php Artisan clear-Compiled Handling the pre-update-cmd Event returned with an error [Runtimeexception] Error Output: ". Hence it shows many Artisan commands like "update [-prefer-source] [-prefer-dist]...
– Isaias Lima
@Isaiaslima, do the following, try one
composer update no-scripts
. If it is, it is that there is a script added to the execution in the Composer that is giving way.– Wallace Maxters
I just tried, even though it wasn’t, it was the same mistake I made above
– Isaias Lima
@Isaiaslima I don’t think this error is in LARAVEL, but in some specific part of the application like controllers, models, services etc. All you should do now is search with the help of your code editor, IDE or LINUX command line tools by some standard like this: "&$". This is because the error derives from some function call where some parameter is passed with "&" in front of the variable/parameter. Find these occurrences and it will be solved.
– felipsmartins
@felipsmartins found out now that the project was done on Linux, and I’m trying to touch it on Windows... is there any problem regarding this condition? I’ve already had to make some changes to make the project work precisely because of this
– Isaias Lima
@Isaiaslima No, there is no relationship, you can rest assured on that. The only exception is the care of file paths or fact that Linux is case-sensitive as to file names (but this shouldn’t be a problem since you are currently using windows)
– felipsmartins