简体   繁体   中英

Laravel local virtual host returning FatalErrorException on MAMP server

I am working on a project, I decided to create local virtual host to keep my URL clean and easy.

When ever I hit a route that uses a controller it returns this error: Symfony \\ Component \\ Debug \\ Exception \\ FatalErrorException Can't use function return value in write context

I cannot figure what is causing this.

Anyone else run into this type of error on this environment? Any tips are appreciated. Thank you.

There are two general causes for this error. The first is something like this:

echo $_POST('test');

Notice that instead of indexing the array, you're calling a function. This will cause this error. Another cause of that particular error could be something like this:

$test = ' ';
if(empty(trim($test)) { // There be dragons

This is because the only valid arguments to the empty function are variables (you cannot call a function inside the call to empty ). Per the docs :

Note: Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). Instead, use trim($name) == false.

The same restrictions on empty also apply to isset as well .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM