Forum Replies Created

Viewing 15 replies - 1 through 15 (of 760 total)
  • Plugin Author Fulvio Notarstefano

    (@nekojira)

    ouch, I’m not sure why
    better reach out the Chrome extension dev:
    https://github.com/barbushin/php-console-extension/issues
    eventually you might be able to add the extension manually from the repo
    I hope they’ll fix it

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    @austyfrosty please let me know your GitHub handle and I’ll add you as collaborator

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    is_home() is returning correctly false because you are not on the homepage, the WP_Query object it is tied to understands that. You are calling this function from the console context, and it cannot be used in this way. Functions that depend on some WordPress states or globals, will not behave as if you were inside the WordPress loop.

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    hey @oyatek thanks for reporting this and sorry for the late reply

    indeed that’s something that could happen, but in this case vendor/autoload.php should be exclusive to WP PHP Console and the classes generated by composer are unique

    out of curiosity which was the plugin that required that file?

    Thank you!

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    at some point I did try to use file storage, found this old ticket with PHP Console from 4 years ago:

    https://github.com/barbushin/php-console/issues/88

    I probably need to revisit some of that…

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Hey @nielash

    Much appreciate your digging into the plugin code and PHP Console.

    Anything related to https://github.com/barbushin/php-console is dependency so I can’t edit within the plugin files, but a issue/PR needs to be logged there and propose a change that is still framework/cms/project agnostic.

    Do you have cUrl/loopback request issues elsewhere on the site? I have not noticed those and I use loopback in other projects with WP PHP Console active.

    If you are having this problem only on the site health check page, I guess it’s safe to add an exclusion there for WP PHP Console not to initialize on that page specifically.

    I’ve kept this issue open to remind about this problem: https://github.com/unfulvio/wp-php-console/issues/19

    I’ve been going back and forth around session problems between PHP Console and WordPress, so I’m not so eager to move the current handling if everything else works fine. As you noticed, just making a little change breaks WP PHP Console. In other times I had other errors appearing in WP about headers already sent or session already started, etc.

    Ideally PHP Console should initialize at a different (earlier) time than plugins, so there’s a bit of compromise on how PHP Console works in WordPress.

    Thanks!

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Thanks for the feedback. The Chrome extension was developed by a third party. You can leave some feedback to them as well: https://github.com/barbushin/php-console-extension

    The lag you may have noticed sometimes may depend on WordPress and other conditions in the page; I rarely see it, but if you experience it, it may difficult to get around, especially on a heavy site which has a long loading time to begin with (not implying yours has, just noticed too on those sites).

    As for the disabled logging, that’s by design as I wanted to have this plugin to avoid let me check the log every single time and browse the entry related to a specific page or event. Additionally I can type PHP in the console, access all WordPress functions and dump variables or options where I saved some debug info. These are things I can’t quite do with XDebug, although XDebug comes with other useful things like stepping through. I’d advise to use both tools, as they have their own purpose each.

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    I see what you mean. I visited the same page and noticed the cURL error. I am not sure if this is directly related to WP PHP Console as you can use the WP API correctly, or the Gutenberg editor with WP PHP Console active. It may just be an interaction in that page. Perhaps I can look into it in the future and see if an exclusion is possible there, if WP PHP Console is confirmed to be the issue.

    I think you can still enjoy the benefits of both site health check and WP PHP Console. Please remember not to use WP PHP Console in production. The site health check may be more relevant in a production environment, probably.

    Thanks for the heads up

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    I don’t have problems using the WP API (or the WC REST API I work most frequently with) while this plugin is activated, nor did I see the cURL error. What did trigger it, specifically? I have checked the logs, or double checked with Query Monitor too, I don’t see anything like you mention unfortunately.

    Have you reverted to the default theme? Are there any must use or multi-site plugins enabled?

    As for the site health check, as far as I know it hooks very early, before I could hook with WP PHP Console, therefore fatal errors would at run time may not be caught anymore by this plugin, but rather by WordPress itself, which I guess is still ok. All the rest would work as before.

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    I believe that’s the Google Chrome popup you’re talking about. It’s intended to alert you of issues and can even work with your OS notification center probably.

    I suppose PHP Console is designed for that use. Could you post some screenshot of what looks like to you or some code snippet you have used?

    If you need to debug several lines, an alternative way in WordPress would be to store the the variables you need into some wp_options options and then return their content in the console by executing return get_option( 'your_option_key' ); later. So this won’t bug you at every load, and you can still access the information you’ve recorded.

    Sorry if I misunderstood your question otherwise.

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Thanks to you too for using this tool and for the kind words

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    I certainly believe so. Mind that this is intended for temporary debugging and you shouldn’t roll PHP Console on a production site.

    If you need to debug some variable in WordPress, another way of doing it is to store the data you want to output in the console in a WordPress option, e.g.

    update_option( 'my_test', $data );

    Then in the console you’d do return get_option( 'my_test' ); from the terminal and check results.

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    Are you able to use the other functions of the plugin, like the console terminal or the Google Chrome JavaScript console for variable and error dumping?

    Plugin Author Fulvio Notarstefano

    (@nekojira)

    There’s a FAQ. The PC class is used to print variables in your Chrome JavaScript console.

    For example

    <?php
    
    $foo = 'bar';
    
    add_action( 'plugins_loaded', function () use ( $foo ) {
        	
    	if ( ! class_exists( 'PC', false ) ) {
    		PhpConsole\Helper::register();	
    	}
    	  
      	PC::my_tag( $foo );
    	  
    } );
    

    This will output bar in your Chrome console.

Viewing 15 replies - 1 through 15 (of 760 total)