Welcome Guest, Not a member yet? Register   Sign In
PHP PSR Logger Error
#1

(This post was last modified: 10-07-2024, 12:41 PM by occitan.)

I ran composer update and now I am getting the following error:

My composer has "psr/log": "^3.0",

I tried sudo dnf remove php8.2-psr but it was not found. Tried 8.1 and 8.3 too, I am running PHP 8.3.12.

extension=psr.so isn't in my php.ini file.

What else can I try? I read all the previous threads I can find but have no luck. This worked fine before I ran composer update.

Codeigniter 4.4.4


Code:
AH01071: Got error 'PHP message: PHP Fatal error: Declaration of CodeIgniter\\Log\\Logger::emergency($message, array $context = []): bool must be compatible with Psr\\Log\\LoggerInterface::emergency(Stringable|string $message, array $context = []): void in /var/www/vhosts/domain.com/httpdocs/system/Log/Logger.php on line 159; PHP message: PHP Fatal error: Uncaught Error: Class "CodeIgniter\\Log\\Logger" not found in /var/www/vhosts/domain.com/httpdocs/system/Config/Services.php:401\nStack trace:\n#0 /var/www/vhosts/domain.com/httpdocs/system/Config/BaseService.php(258)
Reply
#2

this is my composer.json:

Code:
{
    "name": "codeigniter4/appstarter",
    "description": "CodeIgniter4 starter app",
    "license": "MIT",
    "type": "project",
    "homepage": "https://codeigniter.com",
    "support": {
        "forum": "https://forum.codeigniter.com/",
        "source": "https://github.com/codeigniter4/CodeIgniter4",
        "slack": "https://codeigniterchat.slack.com"
    },
    "require": {
        "php": "^8.1",
        "codeigniter4/framework": "4.5.5",
         "phpmailer/phpmailer": "^6.8"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9",
        "mikey179/vfsstream": "^1.6",
        "phpunit/phpunit": "^10.5.16"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Config\\": "app/Config/"
        },
        "exclude-from-classmap": [
            "**/Database/Migrations/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\Support\\": "tests/_support"
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "scripts": {
        "test": "phpunit"
    }
}

ran :
Code:
[andrew@darkstar ~]$ cd /srv/http/CI4-CMS
[andrew@darkstar CI4-CMS]$ composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 2 updates, 0 removals
  - Upgrading nikic/php-parser (v5.2.0 => v5.3.1)
  - Upgrading phpunit/phpunit (10.5.34 => 10.5.36)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
  - Downloading nikic/php-parser (v5.3.1)
  - Downloading phpunit/phpunit (10.5.36)
  - Upgrading nikic/php-parser (v5.2.0 => v5.3.1): Extracting archive
  - Upgrading phpunit/phpunit (10.5.34 => 10.5.36): Extracting archive
Generating optimized autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
[andrew@darkstar CI4-CMS]$
can you paste your composer.json
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply
#3

If you want to use psr/log v3, upgrade to CI 4.5.
See https://github.com/codeigniter4/CodeIgniter4/pull/8339
Reply
#4

(This post was last modified: 10-09-2024, 07:24 PM by occitan.)

I changed my composer.json to "psr/log": "^2.0", and the error went away, but I feel like this is a bad idea.

(10-09-2024, 05:20 PM)kenjis Wrote: If you want to use psr/log v3, upgrade to CI 4.5.
See https://github.com/codeigniter4/CodeIgniter4/pull/8339

What is the best way to upgrade? Do I just swap out the system folder?
Reply
#5

You need to upgrade step by step and yes you will need to backup your app folder and make changes to it also
to get to CodeIgniter v4.5.5
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB