sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

PHP 5.4 required

Open igfarm opened this issue 10 years ago • 3 comments

When trying to use this library in PHP 5.3.29 I get the following fatal error:

PHP Fatal error: Using $this when not in object context in .../vendor/jms/serializer/src/JMS/Serializer/Serializer.php on line 99, referer: ...

This appears to be a problem in JMS library which requires PHP 5.4 or later. Need to provide a workaround or update the requirements statement.

igfarm avatar Jul 13 '16 19:07 igfarm

@igfarm It is highly recommended to use a newer version of php. Not only Goetas and other dependencies have moved to higher versions, but also we anticipate a TLS 1.2 upgrade by our APIs in near future. TLS upgrade is mandated by PCI compliance. One immediate workaround can be to use an older version of the sdk. For this, you need not clone the sdk. You simply need a) A composer.json that references an older version of the sdk, e.g.


{

  "require": {
  "php": ">=5.2.0",
  "ext-curl": "*",
  "authorizenet/authorizenet": "1.8.1",
  "jms/serializer": "xsd2php-dev as 0.18.0"
},
"repositories": [{
    "type": "vcs",
    "url": "https://github.com/goetas/serializer.git"
    }]

}

b) You php code with require 'vendor/autoload.php';as its first line , as in this sample code

ashtru avatar Jul 14 '16 06:07 ashtru

5.4 is no longer maintained. 5.5 is EOL. For security and performance, use 5.6 as a minimum.

texdc avatar Jul 14 '16 14:07 texdc

Thanks @texdc . I would recommend to use PHP >=5.6 as well.

ashtru avatar Jul 25 '16 07:07 ashtru