Skip to content

PHP fatal error sendRequest #38

Description

@sidelux
  • Search for existing issues

Summary

When i run the following function:

function mailerliteAddEmail($email, $username) {
	$mailerliteClient = new \MailerLite\MailerLite(['api_key' => "xxx"]);
	$subscriberData = [
		'email' => $email,
		'fields' => [
			'name' => $username
		],
		'groups' => [
			113072541
		]
	];
	try {
		$apiResponse = $mailerliteClient->subscribers->create($subscriberData);
	} catch (\Exception $exception) {
		error_log("Errore Mailerlite: " . $exception->getMessage());
	}

	mailerliteAddEmailOld($email, $username);
}

I get the following error:
PHP Fatal error: Declaration of Http\\Client\\Curl\\Client::sendRequest(Psr\\Http\\Message\\RequestInterface $request) must be compatible with Psr\\Http\\Client\\ClientInterface::sendRequest(Psr\\Http\\Message\\RequestInterface $request): Psr\\Http\\Message\\ResponseInterface in /var/www/html/hydestore/mailerlite/php-http/curl-client/src/Client.php on line 111

Expected Results

The expected result is that the function works without errors.

Actual Results

Error printed.

Steps to Reproduce

  1. Install the latest version from composer
  2. Execute the example provided

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions