-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Unable to cast curl_init to int in >=4.5.4 #3883
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
Comments
This is a known problem with Hook Curl, Co::set(['hook_flags'=> SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_CURL]); |
@grizzm0 Are there any questions? You can replace guzzle's handler to use Coroutine. It is a Notice error, you can also ignore it
or composer require sy-records/ringphp I forked it to fix the problem, see lufei/ringphp@1eb3dbb |
Thanks @sy-records It's a third party dependency of elastic/elasticsearch-php though and I'd rather not override the dependency. I guess I'll just have to stay on an older version or disable SWOOLE_HOOK_CURL in mezzio/mezzio-swoole for now. If this is not fixable in swoole itself we can close the issue. |
It should be these components that go on to modify the code, and in PHP8, curl is not a resource type anymore. |
Please help me fix this bug in mezzio/mezzio-swoole |
<?php
declare(strict_types=1);
namespace Core;
use Swoole\Http\Server as SwooleHttpServer;
final class ConfigProvider
{
public function __invoke(): array
{
return [
'dependencies' => $this->getDependencies(),
];
}
private function getDependencies(): array
{
return [
'delegators' => [
SwooleHttpServer::class => [
Factory\Delegator\SwooleHttpServerDelegatorFactory::class,
],
],
];
}
} <?php
declare(strict_types=1);
namespace Core\Factory\Delegator;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\DelegatorFactoryInterface;
use Swoole\Http\Server;
use const SWOOLE_HOOK_ALL;
use const SWOOLE_HOOK_CURL;
final class SwooleHttpServerDelegatorFactory implements DelegatorFactoryInterface
{
public function __invoke(ContainerInterface $container, $name, callable $callback, ?array $options = null): Server
{
/** @var Server $swooleHttpServer */
$swooleHttpServer = $callback();
$swooleHttpServer->set([
'hook_flags' => SWOOLE_HOOK_ALL ^ SWOOLE_HOOK_CURL,
]);
return $swooleHttpServer;
}
} |
Didn't know the options was exposed like that. Thanks. In that case there's no need for my delegator. |
I got it. I will try this. Thank you! |
+1 |
I've got a dependency on ezimuel/ringphp which casts
curl_init()
to an int (see here).This was working fine in swoole <=4.5.3 but stopped working with swoole >=4.5.4.
What did you expect to see?
What did you see instead?
php --ri swoole
)?uname -a
&php -v
&gcc -v
) ?The text was updated successfully, but these errors were encountered: