Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Class Stripe\Exception\ExceptionInterface was not found

Aperta
#180 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
testing-qa

Direzione di ricerca

Riproduci il caso bogus-key di tests/unit/library/StripeFunctionsTest.php:680 con AspectMock abilitato, quindi traccia il percorso attraverso goaop/parser-reflection/src/ReflectionEngine.php e codeception/aspect-mock/src/AspectMock/Intercept/BeforeMockTransformer.php. Confronta il percorso che fallisce attraverso stripe/stripe-php/lib/ApiRequestor.php con il trace con AspectMock disabilitato. Il lavoro è completato quando il fallimento intenzionale di Stripe raggiunge ApiErrorException e conserva il messaggio di AuthenticationException invece di segnalare un’interfaccia di eccezione Stripe mancante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

In my tests, I am forcing Stripe to fail by giving it a bogus API key, so that I can test the error logging etc.

However, when I have Aspect Mock enabled, it seems that due to some internal reflection, Stripe's actual error message is being tampered with. Instead of seeing:

[Stripe\Exception\AuthenticationException] Invalid API Key provided: boguskey

which is what I see when AspectMock is totally removed from my project, instead, I get:

[InvalidArgumentException] Class Stripe\Exception\ExceptionInterface was not found in the /path/to/stripe/vendor/files

Here is the trace:

/work/vendor/goaop/parser-reflection/src/ReflectionEngine.php:152
/work/vendor/goaop/parser-reflection/src/ReflectionClass.php:44
/work/vendor/goaop/parser-reflection/src/ReflectionClass.php:68
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:974
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:323
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:322
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:971
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:323
/work/vendor/goaop/parser-reflection/src/Traits/ReflectionClassLikeTrait.php:309
/work/vendor/codeception/aspect-mock/src/AspectMock/Intercept/BeforeMockTransformer.php:31
/work/vendor/goaop/framework/src/Instrument/Transformer/CachingTransformer.php:121
/work/vendor/goaop/framework/src/Instrument/Transformer/CachingTransformer.php:78
/work/vendor/goaop/framework/src/Instrument/ClassLoading/SourceTransformingLoader.php:136
/work/vendor/goaop/framework/src/Instrument/ClassLoading/SourceTransformingLoader.php:103
/work/vendor/goaop/framework/src/Instrument/ClassLoading/AopComposerLoader.php:139
/work/vendor/goaop/framework/src/Instrument/ClassLoading/AopComposerLoader.php:139
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:182
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:142
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:429
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:113
/work/vendor/stripe/stripe-php/lib/ApiOperations/Request.php:63
/work/vendor/stripe/stripe-php/lib/ApiOperations/Create.php:25
/work/library/stripe_functions.php:266
/work/tests/unit/library/StripeFunctionsTest.php:680
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1408
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1028
/work/vendor/phpunit/phpunit/src/Framework/TestResult.php:691
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:756
/work/vendor/phpunit/phpunit/src/Framework/TestSuite.php:597
/work/vendor/codeception/phpunit-wrapper/src/Runner.php:117
/work/vendor/codeception/codeception/src/Codeception/SuiteManager.php:158
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:193
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:160
/work/vendor/codeception/codeception/src/Codeception/Command/Run.php:391
/work/vendor/symfony/console/Command/Command.php:255
/work/vendor/symfony/console/Application.php:1012
/work/vendor/symfony/console/Application.php:272
/work/vendor/symfony/console/Application.php:148
/work/vendor/codeception/codeception/src/Codeception/Application.php:107
/work/vendor/codeception/codeception/codecept:43

It seems that when Stripe hits my (intentional) error, it gets rerouted into the internals of AspectMock and gets lost.

This is the trace when AspectMock is disabled:

/work/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:189
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:149
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:438
/work/vendor/stripe/stripe-php/lib/ApiRequestor.php:118
/work/vendor/stripe/stripe-php/lib/ApiOperations/Request.php:63
/work/vendor/stripe/stripe-php/lib/ApiOperations/Create.php:25
/work/library/stripe_functions.php:266
/work/tests/unit/library/StripeFunctionsTest.php:680
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1408
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:1028
/work/vendor/phpunit/phpunit/src/Framework/TestResult.php:691
/work/vendor/phpunit/phpunit/src/Framework/TestCase.php:756
/work/vendor/phpunit/phpunit/src/Framework/TestSuite.php:597
/work/vendor/codeception/phpunit-wrapper/src/Runner.php:117
/work/vendor/codeception/codeception/src/Codeception/SuiteManager.php:158
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:193
/work/vendor/codeception/codeception/src/Codeception/Codecept.php:160
/work/vendor/codeception/codeception/src/Codeception/Command/Run.php:391
/work/vendor/symfony/console/Command/Command.php:255
/work/vendor/symfony/console/Application.php:1012
/work/vendor/symfony/console/Application.php:272
/work/vendor/symfony/console/Application.php:148
/work/vendor/codeception/codeception/src/Codeception/Application.php:107
/work/vendor/codeception/codeception/codecept:43

You can see it goes straight to /work/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php:38.

I should say that when using my correct Stripe API key (and no exceptions are thrown), my code connects fine to Stripe and does what it is supposed to on their platform.

I am using PHP-Unit 8.5, Codeception 3.1.2, Aspect Mock 3.1.0. Will upgrading to the latest versions of PHPUnit/CodeCeption make any difference? Suggestions?

Lingua principale
PHP
Stelle
784
Fork
132
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Codeception/AspectMock

Tutte le issue di Codeception/AspectMock

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.