Problem/Motivation

After updating php to version 8.1, there are problems with the required library hubspot/hubspot-php

Deprecated function: Return type of SevenShores\Hubspot\Http\Response::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 9 of /var/www/vendor/hubspot/hubspot-php/src/Http/Response.php).

include('/var/www/vendor/hubspot/hubspot-php/src/Http/Response.php')

Deprecated function: Return type of SevenShores\Hubspot\Http\Response::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 9 of /var/www/vendor/hubspot/hubspot-php/src/Http/Response.php) 

Proposed resolution

Update hubspoth/hubspot-php to newest version

Issue fork hubspot-3323840

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

stella created an issue. See original summary.

stella’s picture

Status: Active » Needs review

Alternative composer patch if stuck before 7.4 EOL:

https://github.com/HubSpot/hubspot-php/pull/378

https://patch-diff.githubusercontent.com/raw/HubSpot/hubspot-php/pull/37...

            "hubspot/hubspot-php": {
                "PHP 8.1": "https://patch-diff.githubusercontent.com/raw/HubSpot/hubspot-php/pull/378.patch"
            }

joaopauloscho made their first commit to this issue’s fork.

joaopauloscho’s picture

Title: PHP 8.1 Deprecated function: Return type of SevenShores\Hubspot\Http\Response::offsetExists($offset) » PHP 8.1 Return and Argument type errors - SevenShores\Hubspot\Http\Response

I'm not sure if https://www.drupal.org/project/hubspot/issues/3388150 would be a duplicate of this but I'm adding psr/http-message:^1.1 as a requirement along with hubspot/hubspot-php:^5.0 . The reason of this is because the hubspot newest version (5.2) requires psr/http-message::^1.1 now. Please take a look, thanks!

gigiabba’s picture

Status: Needs review » Reviewed & tested by the community

I've tested this patch on a Drupal 10.3.x fresh install, with PHP 8.1, and solved the issues found using the 3.0.0-alpha4 version.

richgerdes’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the fix!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.