php-xdebug-proxy icon indicating copy to clipboard operation
php-xdebug-proxy copied to clipboard

PHP 8.2

Open bilogic opened this issue 1 year ago • 13 comments

Hi,

Can make it support new PHP versions? Thank you.

bilogic avatar Sep 02 '24 17:09 bilogic

Hi, @bilogic!

Please, provide more info. What is the problem with php8.2?

Anyway, feel free to make a merge request.

According to the page https://www.php.net/supported-versions.php, now minimal supported version php8.1, so we can up it >= 8.1.

mougrim avatar Sep 02 '24 17:09 mougrim

Sorry, I thought it was just PHP version in your composer.json, that was why I did not provide any logs.

This showed up when I have only php8.2, it seems to be something you are depending on

# composer create-project mougrim/php-xdebug-proxy
Creating a "mougrim/php-xdebug-proxy" project at "./php-xdebug-proxy"
Installing mougrim/php-xdebug-proxy (0.5.0)
  - Installing mougrim/php-xdebug-proxy (0.5.0): Extracting archive
Created project in /usr/local/bin/php-xdebug-proxy
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - phpspec/prophecy is locked to version v1.15.0 and an update of this package was not requested.
    - phpspec/prophecy v1.15.0 requires php ^7.2 || ~8.0, <8.2 -> your php version (8.2.23) does not satisfy that requirement.
  Problem 2
    - phpspec/prophecy v1.15.0 requires php ^7.2 || ~8.0, <8.2 -> your php version (8.2.23) does not satisfy that requirement.
    - phpunit/phpunit 9.5.13 requires phpspec/prophecy ^1.12.1 -> satisfiable by phpspec/prophecy[v1.15.0].
    - phpunit/phpunit is locked to version 9.5.13 and an update of this package was not requested.

#

bilogic avatar Sep 02 '24 17:09 bilogic

@bilogic, try to run composer with --no-dev, it should work.

Anyway fell free to make marge request with fix dev mode.

mougrim avatar Sep 02 '24 18:09 mougrim

I tried adding --no-dev, but it still does not run properly even though /home/user/configs/config.php, factory.php and logger.php exists. This issue does not appear if run composer create-project mougrim/php-xdebug-proxy using php8.1

# /usr/local/bin/php-xdebug-proxy/bin/xdebug-proxy --configs=/home/user/configs
Using config path /home/user/configs

There is error:
You should install "amphp/log" by default or provide your custom config/logger.php via config for use php-xdebug-proxy

Usage:
  /usr/local/bin/php-xdebug-proxy/bin/xdebug-proxy [options]

Mandatory arguments to long options are mandatory for short options too.
Options:
  -h, --help         This help.
  -c, --configs=PATH Path to directory with configs:
                      - config.php: you can customize listen ip and port;
                      - logger.php: you can customize logger, file should return object, which is instanceof \Psr\Log\LoggerInterface;
                      - factory.php: you can customize classes, which is used in proxy, file should return object, which is instanceof \Mougrim\XdebugProxy\Factory\Factory.

Documentation: <https://github.com/mougrim/php-xdebug-proxy/blob/master/README.md#readme>.

bilogic avatar Sep 03 '24 10:09 bilogic

Eventually, I had to run composer twice using php8.2 to make things work, really weird.

php8.2 /usr/local/bin/composer create-project mougrim/php-xdebug-proxy --no-dev
cd php-xdebug-proxy
php8.2 /usr/local/bin/composer update

bilogic avatar Sep 03 '24 12:09 bilogic

@bilogic

You should install "amphp/log" by default or provide your custom config/logger.php via config for use php-xdebug-proxy

Looks like the problem was because you didn't install amphp/log.

If all are ok, can I close the issue?

mougrim avatar Sep 04 '24 05:09 mougrim

You should install "amphp/log" by default or provide your custom config/logger.php via config for use php-xdebug-proxy

Looks like the problem was because you didn't install amphp/log.

If all are ok, can I close the issue?

Hmm, my expectation was to run composer create-project mougrim/php-xdebug-proxy using only PHP8.2 and everything will work, however it isn't like that now, so from my perspective, not all ok.

  1. From the docs, need amphp/log using --dev, but I need to install using --no-dev to fix composer problem, I'm lost as to what to do
  2. I think it is better to have a set of defaults that work out of the box for PHP8.2

I understand it takes effort to troubleshoot/debug, you can decide to close the issue or not. Thank you.

bilogic avatar Sep 04 '24 06:09 bilogic

@mougrim

Would you be able to provide a logger.php that does not require amphp/log? I tried but was unsuccessfully.

bilogic avatar Sep 07 '24 15:09 bilogic

Hi, @bilogic!

According to the doc, you can install amphp/log manually:

composer.phar require amphp/log '^1.0.0'

If you don't want to use amphp/log, you can just implement LoggerInterface by yourself or use another implementation if you want, just change logger.php.

amphp/log isn't required dependency.

mougrim avatar Sep 09 '24 04:09 mougrim

amphp/log isn't required dependency.

For someone new trying to use php-xdebug-proxy for the first time

  1. they have to implement a LoggerInterface first before being even able to use it, why would they know how to write something like that?
  2. either that, or they require amphp/log as a dependency

Right?

bilogic avatar Sep 09 '24 04:09 bilogic

they have to implement a LoggerInterface first before being even able to use it, why would they know how to write something like that?

They can install amphp/log manually according to the doc.

either that, or they require amphp/log as a dependency

What if somebody don't like amphp/log? Or it's conflicting with something?

It's not a required dependency, but it's in suggest section in the composer.json.

If you think, that something not obvious enough in the doc, please, make merge request.

If you want to update the minimum version of php, please, make merge request.

If you want required dependency amphp/log, please, make and support your own fork, license is MIT :)

mougrim avatar Sep 09 '24 05:09 mougrim

Yes, I plan to file a PR, but i'm stuck with writing a dependency free logger, so asking for your help.

bilogic avatar Sep 09 '24 05:09 bilogic

but i'm stuck with writing a dependency free logger, so asking for your help.

I'm not sure, that a dependency free logger is needed in this project.

This project should be depends on psr/log, but as I see this dependency is missing in the composer.json required section, you can add it.

If you want to write you own logger, you just need to implement LoggerInterface.

mougrim avatar Sep 09 '24 05:09 mougrim

Closing during no activity.

mougrim avatar Nov 15 '24 05:11 mougrim