0

I am making my own package.

I simplified the code to explain the weird error. I have a simple method inside a simple controller. First, i am sending an email (printing in laravel.log) and works fine.

public function signup(){

    Mail::send('vendor.proto.register.emails.proto-register-new-account', [], function ($m) {
        $m->from('noreply@test.com', 'Hello');
        $m->to('sfs@dgf.c', 'pepe')->subject('Test. Congratulations, your account was created');
    });
    return view('view path');
}

But when i want to move the Mail:: to a private method like this.

public function signup(){
    $this->sendNotification2();
    return view('view path');
}


public function sendNotification2(){
    Mail::send('vendor.proto.register.emails.proto-register-new-account', [], function ($m) {
        $m->from('noreply@test.com', 'Hello');
        $m->to('sfs@dgf.c', 'pepe')->subject('Test. Congratulations, your account was created');
    });
}

It crash an print the error FatalErrorException in ClassLoader.php line 373: Maximum function nesting level of '100' reached, aborting!

Is it a bug? or i am doing something wrong ?

Solution.

Googling i found this solution. Notice i am using laravel 5.2 and php 5.6.7 Add in bootstrap\autoload.php this code ini_set('xdebug.max_nesting_level', 200); and it fix the problem.

Rolly
  • 3,205
  • 3
  • 26
  • 35
  • Possible duplicate of [Solution for "Fatal error: Maximum function nesting level of '100' reached, aborting!" in PHP](https://stackoverflow.com/questions/8656089/solution-for-fatal-error-maximum-function-nesting-level-of-100-reached-abor) – Bagus Tesa May 22 '17 at 23:20
  • @BagusTesa It could be the solution but the problem is more with laravel than the php configuration. – Rolly May 22 '17 at 23:29
  • 1
    conversely, i think its something with php since it works in the original location but then fails **when you move** the code into another **function** that clearly increase the **depth of function calls**. and as additional note, the cause for deep function call is.. you are using Laravel which in turn uses Symfony. – Bagus Tesa May 22 '17 at 23:50
  • @BagusTesa well. Maybe u where right. Searching on google i found it. add in `bootstrap\autoload.php` this code `ini_set('xdebug.max_nesting_level', 200);` and it fix the problem. – Rolly May 23 '17 at 00:18

0 Answers0