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

PHP 8.4 deprecation error #438

Closed
sebastianfeldmann opened this issue Oct 18, 2024 · 2 comments
Closed

PHP 8.4 deprecation error #438

sebastianfeldmann opened this issue Oct 18, 2024 · 2 comments

Comments

@sebastianfeldmann
Copy link
Contributor

Phive 0.15.2 - Copyright (C) 2015-2024 by Arne Blankerts, Sebastian Heuer and Contributors

Error: [ERROR]   An error occurred while processing your request:
    PharIo\Phive\XmlFile::query(): Implicitly marking parameter $ctx as nullable is deprecated, the explicit nullable type must be used instead
          
    #0 src/shared/XmlFile.php(71)
    #1 (347): PharIo\Phive\Cli\Runner->errorHandler()
    #2 (347): require()
    #3 src/Factory.php(438): {closure:/home/runner/work/captainhook/captainhook/tools/phive:27}()
    #4 src/Factory.php(97): PharIo\Phive\Factory->getPhiveXmlConfig()
    #5 src/commands/CommandLocator.php(42): PharIo\Phive\Factory->getInstallCommand()
    #6 src/shared/cli/Runner.php(241): PharIo\Phive\CommandLocator->getCommand()
    #7 src/shared/cli/Runner.php(95): PharIo\Phive\Cli\Runner->execute()
    #8 (354): PharIo\Phive\Cli\Runner->run()
    #9 {main}
    Environment: PHP 8.4.0-dev (on Linux 6.5.0-1025-azure)
    Phive Version: 0.15.2
    This should not have happened and is most likely a bug.
    Please report it at https://github.com/phar-io/phive/issues, make sure you include
    the full output of this error message. Thank you!
Error: [ERROR]   An error occurred while processing your request:
    PharIo\Phive\Config::__construct(): Implicitly marking parameter $now as nullable is deprecated, the explicit nullable type must be used instead
          
    #0 src/shared/config/Config.php(34)
    #1 unknown file(0): PharIo\Phive\Cli\Runner->shutdownHandler()
    #2 {main}
    Environment: PHP 8.4.0-dev (on Linux 6.5.0-1025-azure)
    Phive Version: 0.15.2
    This should not have happened and is most likely a bug.
    Please report it at https://github.com/phar-io/phive/issues, make sure you include
    the full output of this error message. Thank you!
Error: Process completed with exit code 10.

The problem is here:

public function query(string $xpath, ?DOMNode $ctx = null): DOMNodeList {

And I think here as well

?DateTimeImmutable $now = null

and here and following
?Version $installedVersion = null,

⚠️ But I'm not sure this is an actual problem ⚠️

Because if I understand the RFC correctly using ?Type $var = null should be the actual fix for the deprecation Type $var = null. But maybe I did not get it :/
So it could be a dev version issue and actually a problem with PHP

@theseer
Copy link
Member

theseer commented Oct 18, 2024

Please try using the current version of phive first and report the result.

@sebastianfeldmann
Copy link
Contributor Author

I was just too stupid to realize that it was fixed in the latest version and only broken in the one I had.

As you said, too late and too many projects

Nevertheless ignoring deprecations if they occur is still a valid point, so nobody has to wait for a new build because of deprecations.

Sorry for this one ;)

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

2 participants