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

Support for PHP 8 #1599

Closed
Chaz6 opened this issue Dec 12, 2020 · 5 comments
Closed

Support for PHP 8 #1599

Chaz6 opened this issue Dec 12, 2020 · 5 comments
Assignees
Labels
feature New feature request
Milestone

Comments

@Chaz6
Copy link
Contributor

Chaz6 commented Dec 12, 2020

Feature description

Weechat supports PHP 7.x but not 8.x which is the current release. When running cmake with PHP 8.0.0 it fails with the output:-

CMake Warning at cmake/FindPHP.cmake:61 (message):
  Could not find libphp7.  Ensure PHP >=7.0.0 development libraries are
  installed and compiled with `--enable-embed`.  Ensure `php-config` is in
  `PATH`.  You may set `-DCMAKE_LIBRARY_PATH=...` to the directory containing
  libphp7.
Call Stack (most recent call first):
  src/plugins/CMakeLists.txt:157 (find_package)


CMake Error at src/plugins/CMakeLists.txt:161 (message):
  Php not found

Output from php-config --version:-

8.0.0
@Chaz6 Chaz6 added the feature New feature request label Dec 12, 2020
@flashcode
Copy link
Member

Hi,

It seems there's some work to make the PHP plugin compatible.

I just pushed a "php8" branch with the detection of PHP 8.0 and I fixed some compilation errors.
I'm able to load a script, but tests are failing because of issues with the calls to hooks callbacks.

For example with this test script:

<?php

$command_cb = function ($data, $buffer, $args) {
    weechat_print("", "php command_cb: data=" . $data . ", buffer=" . $buffer . ", args=" . $args);
    return WEECHAT_RC_OK;
};

weechat_register("test", "FlashCode", "0.1", "GPL3", "test", "", "");
weechat_print("", "Hey, I'm a PHP script!");
weechat_hook_command("testphp", "description", "args", "desc_args", "", $command_cb, "my_data");

I have this output when loading the script:

php: loading script "/home/flashcode/.weechat-dev/php/test.php"
php: registered script "test", version 0.1 (test)
Hey, I'm a PHP script!

But if I run the command /testphp:

    | php: PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function {closure}(), 0 passed and exactly 3 expected in /home/flashcode/.weechat-dev/php/test.php:3
    | Stack trace:
    | #0 [internal function]: {closure}()
    | #1 {main}
    |   thrown in /home/flashcode/.weechat-dev/php/test.php on line 3
=!= | php: error in function "0x7f844e070000"

And I have an error when quitting WeeChat (even with no PHP scripts loaded):

zend_mm_heap corrupted

As I don't have enough time to debug this now, help is welcome to fix the support of PHP 8.0 on the php8 branch. 😃

@flashcode flashcode self-assigned this Dec 13, 2020
@flashcode flashcode added the help wanted Help is welcome for this issue label Dec 13, 2020
@flashcode
Copy link
Member

Now the PHP plugin doesn't compile any more on Ubuntu Impish (21.10), where the PHP 7 devel package is not available any more.

@adsr : as you're the original author of the PHP plugin, your help would be appreciated if you have time to look and fix the support of PHP8 (on the php8 branch), thanks!

@adsr
Copy link
Contributor

adsr commented Jul 3, 2021

Yes I will take a look. Thank you for the heads up @flashcode

@adsr
Copy link
Contributor

adsr commented Sep 5, 2021

@flashcode Anything else remaining to close this?

@flashcode
Copy link
Member

@adsr: no, I forgot to close this one, thanks for the reminder.

@flashcode flashcode added this to the 3.3 milestone Sep 5, 2021
@flashcode flashcode removed the help wanted Help is welcome for this issue label Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

3 participants