Git Product home page Git Product logo

Comments (7)

d13r avatar d13r commented on June 9, 2024

What's the error message?

https://github.com/davejamesmiller/laravel-breadcrumbs/blob/master/CONTRIBUTING.rst

from laravel-breadcrumbs.

kerwitz avatar kerwitz commented on June 9, 2024

Sorry for not providing the necessary details.
Apache log says:

[Thu Mar 19 17:09:29.843727 2015] [mpm_winnt:notice] [pid 4372:tid 388] AH00428: Parent: child process 3944 exited with status 3221225725 -- Restarting.

322..725 seems to be a stack overflow error.

PHP log says nothing.

The above description will not reproduce the error, it was a false analysis on my end.
The real issue seems to be when you try to register multiple breadcrumb entries with the same name. I had one registration left in another file and ended up registering two breadcrumb entries for the name "admin.job.index".

I don't quite get what goes wrong though as the register method should simply overwrite the prior entry, no?

public function register($name, $callback)
{
    $this->callbacks[$name] = $callback;
}

/src/Manager.php: 20

Once you catch the case where the desired name has already been taken you can throw an exception and exit before the crash of Apache.

if (isset($this->callbacks[$name]))
    throw new Exception("Entry name \"{$name}\" has already been assigned."

I've not been able to unset or reset the prior registered one. I would guess "simply overwrite the previous assignment" would be the desired functionality here but at least on my machine that won't work.

from laravel-breadcrumbs.

d13r avatar d13r commented on June 9, 2024

I can't see any reason that defining a breadcrumb twice would cause a problem - as you say it should just overwrite it. Are you sure you're not calling it in a way that would cause an infinite loop - e.g. parent() calling itself?

from laravel-breadcrumbs.

kerwitz avatar kerwitz commented on June 9, 2024

🙈

Breadcrumbs::register( 'admin.job.index', function( $breadcrumbs ) {
    $breadcrumbs->push( 'Overview', route( 'admin.job.index' ) );
} );

Breadcrumbs::register( 'admin.job.index', function( $breadcrumbs ) {
    // YOLO
    $breadcrumbs->parent( 'admin.job.index' ); 
    $breadcrumbs->push( 'Overview', route( 'admin.job.index' ) );
} );

Yup, reproduced it like so - I guess that was the original code that caused it.
Sorry for the mess.

from laravel-breadcrumbs.

d13r avatar d13r commented on June 9, 2024

:)

from laravel-breadcrumbs.

d13r avatar d13r commented on June 9, 2024

BTW You might want to look at your PHP setup, because on most systems that would cause a "maximum nesting level reached" PHP error, output to the screen or log, not a stack overflow / cryptic error.

from laravel-breadcrumbs.

kerwitz avatar kerwitz commented on June 9, 2024

Yes thanks for the heads up, I am currently looking into that, bugged me as well :)

from laravel-breadcrumbs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.