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

Kirby support: possible conflict with Kirby go() function and swoole extension go() function. #133

Open
dadambickford opened this issue Nov 19, 2020 · 7 comments

Comments

@dadambickford
Copy link

Bug report

Description

The PHP error is

Fatal error: Cannot redeclare go() in /var/task/user/kirby/config/helpers.php on line 222

We can not figure out the source of the original go() function that kirby is conflicting with. We've discovered many different forms of using PHP reflection to try and find the source with no luck - https://stackoverflow.com/questions/7026690/reconstruct-get-code-of-php-function - and posting our own question - https://stackoverflow.com/questions/64867808/get-function-definition-in-string-form-in-php

The only hint that we found is that the PHP extension swoole has a go() function that sounds like it may be the conflict (https://github.com/getkirby-v2/kirby/issues/643) however all of our attempts to disable that extension have failed, like overriding the php.ini config. Is there a way to not include that with vercel-php? maybe a past version that doesn't have it? or any other ideas?

Thanks in advance.

@f3l1x
Copy link
Collaborator

f3l1x commented Nov 19, 2020

Hi @dadambickford. Thank you for issue. That's really strange error, but I got it you need to disable some php extension.
I think there is now way how to disable already enabled extension, right? I need to think about it and introduce some logic to build phase, how to comment-out particular extension.

Something like:

{
  "build": {
    "env" : {
      "VERCEL_PHP_DISABLE_EXTENSIONS": "swoole", 
      # maybe in conjunction
      "VERCEL_PHP_ENABLE_EXTENSIONS": "json curl ..."
    }
  }
}

@dadambickford
Copy link
Author

I'm admittedly very amateur when it comes to PHP, so I can't say for sure. We did read about a PHP_MODULES_DISABLE environment variable but passing that with the swoole value did not do what we hoped. The php.ini override we attempted was just setting extensions to an empty string, but yeah that didn't disable it.

I think a config option would be a clean solution, and if we eventually get this sorted out I'd love to submit a working Kirby boilerplate to the examples repo.

@dadambickford
Copy link
Author

Hi there @f3l1x, wanted to touch base on this again and see if you've had any time to think about it.

@f3l1x
Copy link
Collaborator

f3l1x commented Jan 2, 2021

Hi @dadambickford. Unfortunately no, I tried to enjoy Christmas time. :-) I've released new v0.4.0 with PHP 8.0. Could you please test it? If so, this will be my next issue.

@dadambickford
Copy link
Author

No worries! Hope you had a good holiday. I will give that a test and let you know.

@leocavalcante
Copy link

Add swoole.use_shortname=Off to your php.ini file. It will make Swoole skip the go() function creation.

@f3l1x
Copy link
Collaborator

f3l1x commented Apr 9, 2022

@leocavalcante It works for me. Can you confirm it @dadambickford ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants