Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not work with Phalcon version 4.0.0 #63

Open
zak-wojtek77 opened this issue Jan 4, 2020 · 10 comments
Open

does not work with Phalcon version 4.0.0 #63

zak-wojtek77 opened this issue Jan 4, 2020 · 10 comments

Comments

@zak-wojtek77
Copy link

Does not work with Phalcon version 4.0.0.

@snowair
Copy link
Owner

snowair commented Jan 7, 2020

Sorry, It does not support for 4.x now.

@casparjones
Copy link

Are there plans to upgrade the debugbar for phalcon 4.x?
I was a big fan of the debugbar and would not gladly give it up. :)

@alexbusu
Copy link
Contributor

@casparjones the Phalcon v4 api (of the common Di services) is slightly changed from v3, so it would not take a huge amount of time to make the phalcon-debugbar compatible with Phalcon 4; feel free to debug and push some adjustments in a PR :)

@OrangeTanguine
Copy link
Contributor

OrangeTanguine commented May 2, 2020

I just change this to stop the fatal error, but there is a lot of change to do
ServiceProvider.php - line 184 - $router->handle(); --> $router->handle($_GET['_url'] ?? '/');
How can we debug it ? i have no error...

@OrangeTanguine
Copy link
Contributor

ok, it's working with phalcon 4 now... but i don't know if all functionnality are ok...
I'm going to commit or do a diff file :)

@OrangeTanguine
Copy link
Contributor

can you do a branch for it ? one beta v4.0.0 ?

@OrangeTanguine
Copy link
Contributor

OrangeTanguine commented May 3, 2020

poke @snowair :)

ServiceProvider.php
Line 184

$router->handle();
$deny_routes = (array)$config->get('deny_routes');
$allow_routes = (array)$config->get('allow_routes');

to

$router->handle($_SERVER["REQUEST_URI"]);
$deny_routes = $config->get('deny_routes')->toArray();
$allow_routes = $config->get('allow_routes')->toArray();

PhalconDebugbar.php

Line 20 to 23

use Phalcon\Cache\Backend;
use Phalcon\Cache\Multiple;
use Phalcon\Db\Adapter;
use Phalcon\Db\Adapter\Pdo;

to

use Phalcon\Cache;
use Phalcon\Db\Adapter\AbstractAdapter;
use Phalcon\Db\Adapter\Pdo\AbstractPdo;

Line 241

if ($this->shouldCollect('doctrine', false) &&!$this->hasCollector('doctrine') && !$this->hasCollector('pdo') ) {

to

if ($this->shouldCollect('doctrine', false) &&!$this->hasCollector('doctrine') && !$this->hasCollector('AbstractPdo') ) {

Line 276

if ( $backend instanceof Multiple || $backend instanceof Backend ) {

to

if ( $backend instanceof Cache ) {

line 602

if( $this->hasCollector('pdo') ){
/** @var Profiler $profiler */
$profiler = $this->getCollector('pdo')->getProfiler();
$profiler->handleFailed();
}

to

if( $this->hasCollector('AbstractPdo') ){
/** @var Profiler $profiler */
$profiler = $this->getCollector('AbstractPdo')->getProfiler();
$profiler->handleFailed();
}

line 697

$eventsManager->attach('db', function(Event $event, Adapter $db, $params) use (

to

$eventsManager->attach('db', function(Event $event, AbstractAdapter $db, $params) use (

PhalconHttpDriver.php

Line 30

function isSessionStarted() {
if ( !$this->session->isStarted() ) {
$this->session->start();
}
return $this->session->isStarted();
}

to

function isSessionStarted() {
if ( !$this->session->exists() ) {
$this->session->start();
}
return $this->session->exists();
}

Storage/Filesystem.php

Line 23

public function __construct($dirname,$di)
{
if ( !$di['session']->isStarted() ) {
$di['session']->start();
}
$sid = $di['session']->getId();

to

public function __construct($dirname,$di)
{
if ( !$di['session']->exists() ) {
$di['session']->start();
}
$sid = $di['session']->getId();

Db/Profiler.php

Line 70

public function startProfile($sqlStatement, $sqlVariables = null, $sqlBindTypes = null)

to

public function startProfile($sqlStatement, $sqlVariables = null, $sqlBindTypes = null): \Phalcon\Db\Profiler

Line 172

public function stopProfile()

to

public function stopProfile(): \Phalcon\Db\Profiler

Phalcon\Db\Profiler.php

Line 10

use Phalcon\Db\Adapter;

to

use Phalcon\Db\Adapter\AbstractAdapter;

Phalcon/Cache/Proxy.php

line 9

Phalcon\Cache\Exception

to

Phalcon\Cache\Exception\Exception

remove line 10

use Phalcon\Cache\Frontend\Base64;

line 27

if ( is_object($frontend) && $frontend instanceof Base64 ) {

to (Base64 was deleted. Maybe there is another way to verify if $frontend is Base64)

if ( is_object($frontend)) {

Phalcon/Cache/ProxyTrait.php

line 9

Phalcon\Cache\Exception

to

Phalcon\Cache\Exception\Exception

remove lines 10 and 11

use Phalcon\Cache\Frontend\Base64;
use Phalcon\Cache\Frontend\Output;

line 32

if ( is_object($frontend) && $frontend instanceof Base64 ) {

to (Base64 was deleted. Maybe there is another way to verify if $frontend is Base64)

if ( is_object($frontend)) {

comment line 61 to 63

if ( ! $this->_backend->getFrontend() instanceof Output ) {
return null;
}

to (Output was deleted. Maybe there is another way to verify if $frontend is Output )

line 106 to 110

if ( !$this->_backend->getFrontend() instanceof Output ) {
return null;
}else{
$content = $this->_backend->getFrontend()->getContent();
}

to

$content = $this->_backend->getFrontend()->getContent();

Phalcon/logger/Adapter/Debugbar.php

Line 11

use Phalcon\Logger\Adapter;

to

use Phalcon\Logger\Adapter\AbstractAdapter;

Line 16

class Debugbar extends Adapter implements AdapterInterface{

to

class Debugbar extends AbstractAdapter implements AdapterInterface{

DataCollector/Formatter.php

Lines 15 and 16

use Phalcon\Validation\Message;
use Phalcon\Validation\Message\Group;

to

use Phalcon\Messages\Message;
use Phalcon\Messages\Messages;

Line 65

if ( $var instanceof Group ) {

to

if ( $var instanceof Messages) {

Line 87

if ( $messages instanceof Group ) {

to

if ( $messages instanceof Messages ) {

DataCollector/LogsCollector.php

Line 13

use Phalcon\Logger\Adapter;

to

Phalcon\Logger\Adapter\AbstractAdapter;

Line 49

if ( $log instanceof Adapter ) {

to

if ( $log instanceof AbstractAdapter) {

delete line 15

use Phalcon\Logger\Formatter\Syslog;

line 68

if ( is_scalar($message) && $this->_formatter=='syslog' && $formatter = new Syslog ) {

to (Syslog was deleted)

if ( is_scalar($message) && $this->_formatter=='syslog' && $formatter = new Line ) {

delete line 16

use Phalcon\Logger\Multiple;

// TODO :
REPLACE THIS PART, Multiple was deleted, I don't know how to replace it for the moment

if ( $log instanceof AbstractAdapter ) {
$di->remove('log');
$multiple = new Multiple();
$multiple->push( clone $log );
$multiple->push( $debugbar_loger );
/** @var DI\Service $service */
$di->set('log',$multiple);
}elseif($log instanceof Multiple){
$log->push( $debugbar_loger );
}elseif( class_exists('Monolog\Logger') && $log instanceof Logger ){
$handler = new \Snowair\Debugbar\Monolog\Handler\Debugbar($this->_debugbar);
$log->pushHandler($handler);
}

DataCollector/CacheCollector.php

Line 12

use Phalcon\Cache\Backend;

to

use Phalcon\Cache
--

I think there is all the needed modifications. I don't know if all functionnalities run but the toolbar open.

We don't show queries for the moment, i will update if i fix it

@OrangeTanguine
Copy link
Contributor

So, i failed for queries...
in DataCollector\QueryCollector

$succeed = (array)$this->profiler->getProfiles();

return null....

However $this->profiler object contains data, but getProfiles doesn't work...
If someone can find the solution...
Thks

@OrangeTanguine
Copy link
Contributor

I have found a solution, but it's not clean...
\DataCollector\QueryCollector.php

line 31 to 36 replace with

/** @var Item[] $succeed /
$succeed = (array)$this->profiler->getProfiles();
$succeed = $tab_profiles["_allProfiles"];
/
* @var Item[] $failed */
$failed = (array)$this->profiler->getFailedProfiles();

to

$tab_profiles = (array)$this->profiler;
/** @var Item[] $succeed /
//$succeed = (array)$this->profiler->getProfiles();
$succeed = $tab_profiles["_allProfiles"];
/
* @var Item[] $failed */
$failed = (array)$this->profiler->getFailedProfiles();

@OrangeTanguine
Copy link
Contributor

i pushed all my modifications to the project...

@fagai fagai mentioned this issue Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants