Azure / azure-storage-php

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

$blobClient->setServiceProperties($serviceProperties); looks to be needing only setLogging() and setHourMetrics() is required to be called before calling setServiceProperties() but needs to be updated to be needing a collection parameter before the call. #227

Open vick-git opened 4 years ago

vick-git commented 4 years ago

Which service(blob, file, queue, table) does this issue concern?

Blob

Which version of the SDK was used?

REST API Version

What's the PHP/OS version?

PHP 7 64-bit version

What problem was encountered?

Parameter must be an array or an object that implements Countable

Steps to reproduce the issue?

Just call setLogging() and setHourMetrics() as mentioned in the sample Then instantiate new ServiceProperties() call $blobClient-setServiceProperties($serviceProperties); without a collection.

Have you found a mitigation/solution?

Calling with a collection $serviceProperties-setCorses([]); resolves the warning.

This warning is mentioned as part of PHP documentation but with respect to the sample, it has been not mentioned this needs to be a collection until PHP throws the warning. Either the sample document needs an update or the constructor should be checked to see if a collection/array exists or not.

katmsft commented 4 years ago

Thanks for reporting the issue. This is marked as an enhancement and will be applied in the future.