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

Call to undefined function GuzzleHttp\Promise\unwrap() #109

Open
sunnysideup opened this issue May 25, 2023 · 4 comments
Open

Call to undefined function GuzzleHttp\Promise\unwrap() #109

sunnysideup opened this issue May 25, 2023 · 4 comments

Comments

@sunnysideup
Copy link

I am getting this error.

Call to undefined function GuzzleHttp\Promise\unwrap()

in

TheIconic\Tracking\GoogleAnalytics\Network\HttpClient::__destruct at line 51

This is what I am sending:

            $analytics = new Analytics();
            $analytics->setProtocolVersion('1')
                ->setTrackingId($this->getTrackingID())
                ->setUserId(base64_encode($memberID))
            ;

            $analytics
                ->setTransactionId($orderID) // transaction id. required
                ->setRevenue($total)
                ->setDebug($this->isTestMode())
                ->sendTransaction()
            ;

            $orderItems = $order->OrderItems();
            foreach ($orderItems as $orderItem) {
                $analytics->setTransactionId($orderID)
                    ->setItemName($orderItem->TableTitle()) // required
                    ->setItemPrice($orderItem->CalculatedTotal)
                    ->setItemQuantity($this->negateValue($orderItem->Quantity))
                    ->setDebug($this->isTestMode())
                    ->sendItem()
                ;
            }

Here are some of the packages we use:

guzzlehttp/guzzle                                 7.7.0              Guzzle is a PHP HTTP client library
guzzlehttp/promises                               2.0.0              Guzzle promises library
guzzlehttp/psr7                                   2.5.0              PSR-7 message implementation that also provides common utility methods
http-interop/http-factory-guzzle                  1.2.0              An HTTP Factory using Guzzle PSR7
php-http/promise                                  1.1.0              Promise used for asynchronous HTTP requests
phpspec/prophecy                                  dev-master 84c9814 Highly opinionated mocking framework for PHP 5.3+
spomky-labs/otphp                                 v10.0.3            A PHP library for generating one time passwords according to RFC 4226 (HOTP Algorithm) and the RFC 6238 (TOTP Algorithm) and compatible...
swiftmailer/swiftmailer                           v6.3.0             Swiftmailer, free feature-rich PHP mailer
theiconic/php-ga-measurement-protocol             v2.9.0             Send data to Google Analytics from the server using PHP. This library fully implements GA measurement protocol.
@ana-lisboa
Copy link

ana-lisboa commented Jun 13, 2023

This is the fix:
on TheIconic\Tracking\GoogleAnalytics\Network\HttpClient

use GuzzleHttp\Promise;
// ... 

  /**
     * We have to unwrap and send all promises at the end before analytics objects is destroyed.
     */
    public function __destruct()
    {
        Promise\Utils::unwrap(self::$promises);
        //Promise\unwrap(self::$promises); > deprecated
    }

@sakacjakub
Copy link

same error, can you fix this please?

@ahmad-gelato
Copy link

Hi
We have the exact same issue. When this fix will be released?
Thanks

@ahmad-gelato
Copy link

This is the fix: on TheIconic\Tracking\GoogleAnalytics\Network\HttpClient

use GuzzleHttp\Promise;
// ... 

  /**
     * We have to unwrap and send all promises at the end before analytics objects is destroyed.
     */
    public function __destruct()
    {
        Promise\Utils::unwrap(self::$promises);
        //Promise\unwrap(self::$promises); > deprecated
    }

Hi
We have the exact same issue. When this fix will be released?
Thanks

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

No branches or pull requests

4 participants