Coder Social home page Coder Social logo

Comments (5)

weierophinney avatar weierophinney commented on July 1, 2024

The problem is that you have an optional segment followed by required segments. This has always had problematic behavior, and we do not recommend it.

Instead, create two separate routes, one that does not have the :embed segment, and one that has it as a required segment.

from mezzio.

mimmi20 avatar mimmi20 commented on July 1, 2024

Instead, create two separate routes

In our project we have in summary 9 routes with this optional Parameter. We had duplicated routes before for some of them, until we found out in Zend MVC does this kind of routing work. Our problem with duplicated routes was, that we forget often to change the second one.

from mezzio.

jscssphtml avatar jscssphtml commented on July 1, 2024

Please leave this open. This happens also for routing without any non-optional postfixes....

We have a very simple route defined: (this is just a extension of the skeleton app)

$app->get('/[:projectId]', App\Handler\HomePageHandler::class, 'home');

With the same result during building the url:

Laminas\Router\Exception\InvalidArgumentException thrown with message "Missing parameter "projectId""

We have researched a little bit on this and found out, that the "name" parameter is added to the options here:
https://github.com/mezzio/mezzio-laminasrouter/blob/3.8.x/src/LaminasRouter.php#L118

Which results in the options parameter "has_child" parameter here:
https://github.com/laminas/laminas-router/blob/3.10.x/src/Http/Part.php#L202

Which than results in this invalid argument exception:
https://github.com/laminas/laminas-router/blob/3.10.x/src/Http/Segment.php#L329

from mezzio.

Ocramius avatar Ocramius commented on July 1, 2024

@jscssphtml new issue, perhaps with test case, would be nice

from mezzio.

boesing avatar boesing commented on July 1, 2024

I guess that this issue is better placed in https://github.com/mezzio/mezzio-laminasrouter as that seems to be a specific laminas-router issue rather than a mezzio issue.

from mezzio.

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.