You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
Zend\Mvc\ControllerAbstractRestfulController::getIdentifier() has two instances of
if ($id)
These should both be
if ($id!==false)
Otherwise the route /xxx?id=0 gets routed to the getList() action instead of the get() action
The unit test for this is probably this. I say probably, as can't run it; the ZF2 unit tests require phpunit-3.5 and I can't manage to downgrade my phpunit-3.6.10
public function testDispatchInvokesGetMethodWhenNoActionPresentAndZeroIdentifierPresentOnGet()
{
$entity = new stdClass;
$this->controller->entity = $entity;
$this->routeMatch->setParam('id', 0);
$result = $this->controller->dispatch($this->request, $this->response);
$this->assertArrayHasKey('entity', $result);
$this->assertEquals($entity, $result['entity']);
$this->assertEquals('get', $this->routeMatch->getParam('action'));
}
The text was updated successfully, but these errors were encountered:
returns either a JSON list of widgets or an HTML list of widgets
GET /widget?id=123
returns either a JSON representation of widget 123, or an HTML page to edit widget 123.
GET /widget?id=0
returns an HTML page to create a new widget (not a list of widgets)
In any case, being a programmer, I might want to number my widgets from zero, rather than one ;-)
<< Also, BTW, ZF2 unit tests require PHPUnit 3.7, not 3.5 >>
My mistake. I got an error about 3.6.10 not being valid, and the first google result for the error message was a comment saying that ZF2 hoped to upgrade from 3.5 to 3.6 shortly. I guess I didn't check the date of the article (or look at the code...
Zend\Mvc\ControllerAbstractRestfulController::getIdentifier() has two instances of
if ($id)
These should both be
if ($id!==false)
Otherwise the route /xxx?id=0 gets routed to the getList() action instead of the get() action
The unit test for this is probably this. I say probably, as can't run it; the ZF2 unit tests require phpunit-3.5 and I can't manage to downgrade my phpunit-3.6.10
The text was updated successfully, but these errors were encountered: