yajra / pdo-via-oci8

PHP PDO_OCI functions via OCI8 extension
Other
88 stars 61 forks source link

getAttribute returning empty array instead of null in PHP v8.1.16 #123

Closed PauloGraca closed 1 year ago

PauloGraca commented 1 year ago

https://github.com/yajra/pdo-via-oci8/blob/2666f4c15d3472338874d1df567757d5854b800e/src/Pdo/Oci8.php#L492

When PDO attribute is not set the method getAttribute() returns empty array [] while it should return null.

This will be an issue downstream when methods will expect a string or null resulting in ERROR: Array to string conversion.

Example of usage for this attribute: Laravel Queue https://github.com/laravel/framework/blob/38f022d01fd85caf88c11cec52dade7ccccccfdf/src/Illuminate/Queue/DatabaseQueue.php#L259:L261

Thank you in advance for looking into this!

yajra commented 1 year ago

Thanks for reporting. I agree that this method should return null based on the description and php.net:

A successful call returns the value of the requested PDO attribute. An unsuccessful call returns null.

PauloGraca commented 1 year ago

Thanks for the quick fix! :) 👍