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

Fix deprecation message appearing in CLI context with PHP 8.1 #65

Merged
merged 2 commits into from
Aug 1, 2022

Conversation

driehle
Copy link
Contributor

@driehle driehle commented Aug 1, 2022

Extracted into a separate PR upon request in #64 (comment).

This fixes another deprecation only related to CLI dumping. Please consider the following sample:

<?php

declare(strict_types=1);

require_once 'vendor/autoload.php';

Krumo::dump(null);

The output is as follows, with PHP 8.1 there is a deprecation:

driehle@DESKTOP-DENNIS:~/tmp$ php8.0 test.php
--------------------------------------------------------------------------------
NULL

Called from /home/driehle/tmp/test.php, line 7  (Krumo version 0.6.1)
--------------------------------------------------------------------------------

driehle@DESKTOP-DENNIS:~/tmp$ php8.1 test.php
--------------------------------------------------------------------------------
NULLPHP Deprecated:  trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/driehle/tmp/vendor/mmucklo/krumo/class.krumo.php on line 1611


Called from /home/driehle/tmp/test.php, line 7  (Krumo version 0.6.1)
--------------------------------------------------------------------------------

@driehle
Copy link
Contributor Author

driehle commented Aug 1, 2022

@scottchiefbaker re/ comment #64 (comment)

The trim() should go in a separate PR. Probably makes more sense to do:

$out = var_export($i) ?? "";

Instead of casting to a string? I dunno, what do you think? If you get these two issues separated I'll work on landing them ASAP.

I like this as well, but according to composer.json the minimum version for Krumo is 5.2.17 and ?? is only available with PHP 7.0, see https://3v4l.org/v2obQ.

We could, however, increase the minimum version to PHP 7.0 and continue with that syntax. This should then be a minor release (0.7.0) and not a patch release (0.6.2).

@driehle driehle changed the title fixed deprecation appearing in CLI context with PHP 8.1 Fix deprecation message appearing in CLI context with PHP 8.1 Aug 1, 2022
@scottchiefbaker
Copy link
Collaborator

We should definitely bump the support PHP version to 7.0 as a minimum. If you update the composer.json and the trim() line I will gladly land this fix.

@driehle
Copy link
Contributor Author

driehle commented Aug 1, 2022

Done

@scottchiefbaker
Copy link
Collaborator

Looks good!

@scottchiefbaker scottchiefbaker merged commit a513a50 into mmucklo:master Aug 1, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants