Skip to content

Commit 5e5bf34

Browse files
committed
v3.6.3
1 parent b973010 commit 5e5bf34

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### [3.6.3] 2024-03-25
2+
3+
**BUGFIX:**
4+
5+
- Handle empty response headers in case if HTTP request to the API fails (and it fails regularly, kudos to Apple)
6+
17
### [3.6.2] 2024-01-25
28

39
**BUGFIX:**

examples/getTransactionHistory.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,24 @@
2121
echo "Transaction Info #$i\n";
2222
echo "App Account Token: {$transactionInfo->getAppAccountToken()}\n";
2323
echo "Bundle ID: {$transactionInfo->getBundleId()}\n";
24+
echo "Currency: {$transactionInfo->getCurrency()}\n";
2425
echo "Environment: {$transactionInfo->getEnvironment()}\n";
2526
echo "Expires Date: {$transactionInfo->getExpiresDate()}\n";
27+
echo 'Expires Date UTC: ' . date('Y-m-d H::i:s', intval($transactionInfo->getExpiresDate() / 1000)) . "\n";
2628
echo "In-App Ownership Type: {$transactionInfo->getInAppOwnershipType()}\n";
2729
echo "Is Upgraded: {$transactionInfo->getIsUpgraded()}\n";
30+
echo "Offer Discount Type: {$transactionInfo->getOfferDiscountType()}\n";
2831
echo "Offer Identifier: {$transactionInfo->getOfferIdentifier()}\n";
2932
echo "Offer Type: {$transactionInfo->getOfferType()}\n";
3033
echo "Original Purchase Date: {$transactionInfo->getOriginalPurchaseDate()}\n";
3134
echo "Original Transaction ID: {$transactionInfo->getOriginalTransactionId()}\n";
35+
echo "Price: {$transactionInfo->getPrice()}\n";
3236
echo "Product ID: {$transactionInfo->getProductId()}\n";
3337
echo "Purchase Date: {$transactionInfo->getPurchaseDate()}\n";
38+
echo 'Purchase Date UTC: ' . date('Y-m-d H::i:s', intval($transactionInfo->getPurchaseDate() / 1000)) . "\n";
3439
echo "Quantity: {$transactionInfo->getQuantity()}\n";
3540
echo "Revocation Date: {$transactionInfo->getRevocationDate()}\n";
41+
echo 'Revocation Date UTC: ' . ($transactionInfo->getRevocationDate() ? date('Y-m-d H::i:s', intval($transactionInfo->getRevocationDate() / 1000)) : '') . "\n";
3642
echo "Revocation Reason: {$transactionInfo->getRevocationReason()}\n";
3743
echo "Signed Date: {$transactionInfo->getSignedDate()}\n";
3844
echo "Subscription Group Identifier: {$transactionInfo->getSubscriptionGroupIdentifier()}\n";

src/HTTPRequest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ public static function performRequest(AbstractRequest $request): string
5959
stream_context_create($options)
6060
);
6161

62-
/** @noinspection PhpNullIsNotCompatibleWithParameterInspection */
62+
if (empty($http_response_header)) {
63+
throw new HTTPRequestFailed($httpMethod, $url, 'No response headers found, probably empty response');
64+
}
65+
6366
$statusLine = reset($http_response_header);
6467

6568
if (!preg_match('/^HTTP\/\d\.\d (?<statusCode>\d+) (?<reasonPhrase>[^\n\r]+)$/', $statusLine, $matches)) {

0 commit comments

Comments
 (0)