Jump to content

RockShell - a ProcessWire Commandline Companion ⌨️


bernhard
 Share

Recommended Posts

  • 2 months later...

Please upgrade to v3.5.2 which updates all dependencies due to security updates:

symfony/http-client CVE-2024-50342 Low severity
nesbot/carbon CVE-2025-22145 Moderate severity

Link to comment
Share on other sites

  • 3 months later...

@bernhard Somewhere in my codebase, an exception is occurring.  It's not rockshell specific, but I'm using rockshell to run a background job and at some point this exception occurs.  However, the exception details are very minimal in rockshell's output (just a simple line) which doesn't give me enough information me to track it down.  I would think the exception would get placed in ProcessWire's own logs, but it doesn't.  Any thoughts on how I can get the exceptions to get logged to help me debug?

Link to comment
Share on other sites

Hey @Jonathan Lahijani what you provide to me might be even more vague than what RockShell provided to you 😉 So I don't have any idea so far. What is your exception that you see? What is that one line that you get from RockShell?

Link to comment
Share on other sites

Basically, I'm running a rockshell command and I get this error due to a logic bug in my own code:

Call to a member function getProduction() on null

However because the error isn't really specific, I'm not sure where in my codebase that's exactly occurring (like which file and which line).  It doesn't log it to ProcessWire's 'errors' log.

If I run the same code that's inside my rockshell command "outside" of rockshell (using php on the command line), it will also error, but details about it like this:

PHP Fatal error:  Uncaught Error: Call to a member function getProduction() on null in /path/to/pw/site/classes/BlahPage.php:210
Stack trace: ...

Is it possible to log errors to the error log?

Link to comment
Share on other sites

2 minutes ago, Jonathan Lahijani said:

Is it possible to log errors to the error log?

I'm not sure, but I think so and that might be a good thing to add. Can you try to modify the rock.php file. There I catch any exceptions and only write the ->getMessage() output to the console.

If you remove the try/catch, do you get more helpful output?

Link to comment
Share on other sites

4 minutes ago, bernhard said:

If you remove the try/catch, do you get more helpful output?

That worked... I replaced the try/catch block with just $app->run();

The error appeared in the console and logged to 'errors' log.

I wonder if it can be refactored a bit?  Ideally I'd like to run try/catch in my own rockshell command, but with the current approach rockshell's try/catch will override it, right?

Link to comment
Share on other sites

  • 1 month later...

RockShell currently uses the following composer.json file:

{
    "require": {
        "illuminate/console": "^8.40",
        "illuminate/events": "^8.40",
        "symfony/browser-kit": "^5.4",
        "symfony/css-selector": "^5.4",
        "symfony/dom-crawler": "^5.4",
        "symfony/http-client": "^5.4",
        "symfony/mime": "^5.4"
    },
    "autoload": {
        "files": [
            "Application.php"
        ]
    },
    "config": {
        "platform": {
            "php": "7.4.0"
        }
    }
}

I'm using PHP8.4 on my latest project and get many warnings like this:

Quote

PHP Deprecated:  optional(): Implicitly marking parameter $callback as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/RockShell/vendor/illuminate/support/helpers.php on line 184

So I thought just update dependencies...

Turns out it's not that simple. "composer update" will only update to the listed versions, which are already quite dated. Any experienced composer users here @teppo @Jonathan Lahijani that know an easy way to do this?

illuminate/console for example is version 12.17 at the moment.

Link to comment
Share on other sites

Thx, already tried that, no luck. Also when updating dependencies manually which I already did I get some PHP errors 😞 Seems there is more to it, so if anybody wants to contribute his/her time and knowledge for this update it would be highly appreciated 🙂 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...