Azure / azure-storage-php

Microsoft Azure Storage Library for PHP
MIT License
217 stars 198 forks source link

Update SAS expiry DateTime creation #307

Open vdiddlodka opened 3 years ago

vdiddlodka commented 3 years ago

Created new method to produce properly formatted expiry DateTime strings. Azure did not accept standard PHP generated ISO 8601 datetime with DateTime::ATOM as suggested in PHP docs. Instead had to produce the datetime string in Zulu. Also updated documentation around implementation of generateBlobServiceSharedAccessSignatureToken method.

ghost commented 3 years ago

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

:x: vdiddlodka sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

spaze commented 3 years ago

@vdiddlodka Try the DateTime format used in #294 when using non-UTC timestamps.

vdiddlodka commented 3 years ago

I'm receiving an error when trying to sign CLA, "Error There is no CLA to sign for Azure/azure-storage-php

({"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"})"

vdiddlodka commented 3 years ago

@vdiddlodka Try the DateTime format used in #294 when using non-UTC timestamps.

Edit 'p' was introduced in PHP 8.0 but 'P' should be available in PHP 7.

I thought 'P' in format was introduced in PHP 8 which would increase the minimum PHP version requirements. I could be wrong on that however.

spaze commented 3 years ago

@vdiddlodka Try the DateTime format used in #294 when using non-UTC timestamps.

I thought 'P' in format was introduced in PHP 8 which would increase the minimum PHP version requirements. I could be wrong on that however.

Lowercase p was indeed added in PHP 8 (see changelog) but I'm using uppercase P in the change. Uppercase P works since the DateTime class was added to PHP (at least since 5.2). This SDK targets PHP 5.6 and newer.

vdiddlodka commented 3 years ago

For reference, I found this link detailing the accepted datetime format by the API; https://docs.microsoft.com/en-us/rest/api/storageservices/formatting-datetime-values