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

Cannot use "parent" when current class scope has no parent

Open KhanhTranJBI opened this issue 4 years ago • 48 comments

I am using PHP v7.4.4 with authorizenet/authorizenet v2.0.0 and got these errors, please fix the issues or how to get around these errors, thanks!

<b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php</b> on line <b>291</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/CreditCardSimpleType.php</b> on line <b>100</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/PaymentType.php</b> on line <b>263</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/NameAndAddressType.php</b> on line <b>262</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/CustomerPaymentProfileBaseType.php</b> on line <b>100</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/ANetApiRequestType.php</b> on line <b>129</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/ANetApiResponseType.php</b> on line <b>127</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MessagesType.php</b> on line <b>134</b><b>Unknown</b>: Cannot use "parent" when current class scope has no parent in <b>/vagrant/zeus/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MessagesType/MessageAType.php</b> on line <b>97</b>

KhanhTranJBI avatar Aug 30 '20 02:08 KhanhTranJBI

yea, same problem. Trying to move my application to a new server and coming across the same error.

AllCdnBoy avatar Sep 06 '20 07:09 AllCdnBoy

@AllCdnBoy Please let me know when you have a fix for this issue, thanks!

KhanhTranJBI avatar Sep 06 '20 20:09 KhanhTranJBI

I replaced my "authorizenet/authorizenet": "2.0", with "authorizenet/authorizenet": "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c" and it's working now.

AllCdnBoy avatar Sep 06 '20 23:09 AllCdnBoy

@AllCdnBoy dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c is working, thank you so much! Even though, it is working but dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c is private repo so I am looking for a real package version likes 2.1. Please let me know when that happens, thanks!

KhanhTranJBI avatar Sep 07 '20 06:09 KhanhTranJBI

Don't hold your breath. This was a reported issue 9 months ago and there haven't been any updates to the repo in 2 years. I've been working with Authorize.net for a client for 6 years and they are very antiquated. I don't expect an update anytime soon.

AllCdnBoy avatar Sep 07 '20 06:09 AllCdnBoy

@AllCdnBoy I see, thanks!

KhanhTranJBI avatar Sep 08 '20 05:09 KhanhTranJBI

Same here. When I use it in a queue'd job, it throws me this error; but when I use it in run-time it works fine (with php 7.2)

sentiasa avatar Sep 09 '20 22:09 sentiasa

I think its an old library and many php functions are deprecated, getting the same issue, im using php .7.2 laravel 6 "authorizenet/authorizenet": "^2.0",

mdasiff avatar Sep 18 '20 09:09 mdasiff

Same problem here using php 7.4.

aetikon avatar Sep 24 '20 19:09 aetikon

Same problem. Hoping this repo gets some more attention.

brianwoodridge avatar Oct 16 '20 17:10 brianwoodridge

Same here.
php 7.4 "authorizenet/authorizenet": "^2.0", Codeigniter 3.

Does authorize.net not care about transactions from php backends anymore?
Where is all their money coming from that they would abandon this repository?

rekliner avatar Oct 26 '20 07:10 rekliner

I replaced my "authorizenet/authorizenet": "2.0", with "authorizenet/authorizenet": "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c" and it's working now.

Where did you replace this? In a file? what file. Sorry I am confused, having the same issue

degive avatar Nov 11 '20 00:11 degive

@AllCdnBoy Where did you replace this "authorizenet/authorizenet": "2.0"? In a file? what file. Sorry I am confused, having the same issue...

degive avatar Nov 11 '20 00:11 degive

This is in my composer file. I replaced the original authorize.net package with the dev package.

AllCdnBoy avatar Nov 11 '20 00:11 AllCdnBoy

Am in shock with this am running with the same issue. Authorize.net is not longer maintenancing this repo? our brands are running daily several transactions which are paid to Auth.net and they are not supporting the php backend which is our API provider, should i change the company service or what??

christian-manrique avatar Nov 11 '20 20:11 christian-manrique

This is a common theme amongst these processors. I'm running into the exact same problem with Moneris

AllCdnBoy avatar Nov 11 '20 20:11 AllCdnBoy

@AllCdnBoy thank you palm! your hotifix works like a charm!

christian-manrique avatar Nov 11 '20 20:11 christian-manrique

I replaced my "authorizenet/authorizenet": "2.0", with "authorizenet/authorizenet": "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c" and it's working now.

Which PR is this commit from?

Also, unrelated...imagine me coming all this way to find @AllCdnBoy who's from the same place I am!

edalzell avatar Nov 11 '20 22:11 edalzell

What Branch do you use? Master?

degive avatar Nov 12 '20 16:11 degive

What Branch do you use? Master?

I copied it exactly as above into my composer.json and ran composer update

edalzell avatar Nov 12 '20 16:11 edalzell

Sorry for being dense, but when I add the line in the require section, it complains: [RuntimeException] Root package 'authorizenet/authorizenet' cannot require itself in its composer.json Did you accidentally name your root package after an external package? if I remove the first line with the "name" then I get this: Install of authorizenet/authorizenet failed [RuntimeException] Failed to clone [email protected]:AuthorizeNet/sdk-php.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as an internal or external command, operable program or batch file. Here is my composer file: { "type": "library", "description": "Official PHP SDK for Authorize.Net", "keywords": ["authorizenet", "authorize.net", "payment", "ecommerce"], "license": "proprietary", "homepage": "http://developer.authorize.net", "require": { "php": ">=5.6", "ext-curl": "", "ext-json": "", "authorizenet/authorizenet": "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c"
}, "require-dev": { "phpunit/phpunit": "~4.0", "phpmd/phpmd": "~2.0" }, "autoload": { "classmap": ["lib"] }, "autoload-dev": { "classmap": ["tests"] }
} Thank you for your help!

degive avatar Nov 12 '20 17:11 degive

You put that line in your projects composer.json.

edalzell avatar Nov 12 '20 17:11 edalzell

Sorry for being dense, but when I add the line in the require section, it complains: [RuntimeException] Root package 'authorizenet/authorizenet' cannot require itself in its composer.json Did you accidentally name your root package after an external package? if I remove the first line with the "name" then I get this: Install of authorizenet/authorizenet failed [RuntimeException] Failed to clone [email protected]:AuthorizeNet/sdk-php.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as an internal or external command, operable program or batch file. Here is my composer file: { "type": "library", "description": "Official PHP SDK for Authorize.Net", "keywords": ["authorizenet", "authorize.net", "payment", "ecommerce"], "license": "proprietary", "homepage": "http://developer.authorize.net", "require": { "php": ">=5.6", "ext-curl": "", "ext-json": "", "authorizenet/authorizenet": "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c" }, "require-dev": { "phpunit/phpunit": "~4.0", "phpmd/phpmd": "~2.0" }, "autoload": { "classmap": ["lib"] }, "autoload-dev": { "classmap": ["tests"] } } Thank you for your help!

Hey there, try to upgrade php version to at least 7.2, then remove the "authorizenet/authorizenet" package from your composer.json, then remove all vendor folder and run "composer install", once you composer ran successfully try to add the package through CLI i mean "composer require authorizenet/authorizenet". Once the .net package is installed update the composer.json to "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c" and then hit composer update authorizenet/authorizenet

christian-manrique avatar Nov 12 '20 20:11 christian-manrique

What, exactly, are you doing?

Can we see your composer.json?

edalzell avatar Nov 13 '20 00:11 edalzell

That's the wrong composer.json. You're supposed to be editing your project's composer.json NOT package's.

edalzell avatar Nov 13 '20 00:11 edalzell

Which composer.json are you putting this in? Show us the path please.

edalzell avatar Nov 13 '20 01:11 edalzell

Okay, so here's a question I think is worth asking.

If we're using an abandoned development branch to get around a full-on bug, what guarantees do we have that this development branch is using secure methods for payment processing? Clearly regression testing isn't being done on the master branch for core functionality, so is it even safe to use this package? Especially considering this is an SDK for handling sensitive credit card information?

Is there any good reason aside from maybe cost for me to use this package instead of Stripe? I mean, Stripe has a ton of verified integrations and they're modern. And their core PHP functionality isn't broken.

Edit: *I'm also asking these questions out of actual ignorance - I'm more than happy if I'm just being heckin' paranoid :)

david-m-sitation avatar Nov 16 '20 16:11 david-m-sitation

So is this package basically dead? No PHP 7.4 support? Does anyone have any recommendations for another library for Authorize.net, or do I basically have to roll my own?

mbiang avatar Dec 03 '20 15:12 mbiang

I've got this in my composer.json and it works. This is the reference to the PR that adds this. Plan on forking so it won't go away.

        "authorizenet/authorizenet": "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c",

edalzell avatar Dec 03 '20 16:12 edalzell

@mbiang hey there, what it said @edalzell is correct on my end works as well, i was running with weird responses using master branch but i changed my composer.json on the require block by "authorizenet/authorizenet": "dev-master#ef297d3e2d7c1092ddabd2c376eb485aac1aa66c", then i ran the composer install command removing that all the folder vendor/authorizenet and that works pretty well, your application should be good doing those changes

christian-manrique avatar Dec 03 '20 16:12 christian-manrique