itsgoingd / clockwork

Clockwork - php dev tools in your browser - server-side component
https://underground.works/clockwork
MIT License
5.69k stars 321 forks source link

Web portal __clockwork/latest return false #576

Closed tokidoki11 closed 10 months ago

tokidoki11 commented 2 years ago

Version: 5.16

When checking via WebPortal /clockwork/app I can see /__clockwork/latest being called but it returns false thus leaving the page blank

Checking via Chrome Extension it is working as expected

L-P commented 2 years ago

find(null) is called on the storage instead of what I assume should be latest(). A quick workaround is to substitute FileStorage with:

class FixFileStorage extends FileStorage
{
    public function find($id)
    {
        if ($id === null) {
            return $this->latest();
        }

        return parent::find($id);
    }
}

(Clockwork 5.1.4 using \Clockwork\Support\Slim\ClockworkMiddleware.)

itsgoingd commented 2 years ago

Hey, can you please share more info about your environment?

tokidoki11 commented 2 years ago

@itsgoingd any command you want me to run?

as a rough idea I run this this with Laravel 6 on Docker environment

UlrichEckhardt commented 10 months ago
        $clockworkDataUri = '#/__clockwork(?:/(?<id>[0-9-]+))?(?:/(?<direction>(?:previous|next)))?(?:/(?<count>\d+))?#';
        if (preg_match($clockworkDataUri, $request->getUri()->getPath(), $matches)) {
            $matches = array_merge([ 'id' => null, 'direction' => null, 'count' => null ], $matches);
            return $this->retrieveRequest($request, $matches['id'], $matches['direction'], $matches['count']);
        }

This code is from today's master branch, in three different places. It lacks support for the symbolic "latest" ID. Support for "latest" seems to be present for Laravel, Lumen and Symfony only.