amazonwebservices / aws-sdk-for-php

(DEPRECATED) AWS SDK for PHP - Version 1. Version 3 is the latest:

Home Page:https://github.com/aws/aws-sdk-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cleanup global namespace

ctrahey opened this issue · comments

sdk.class.php issues a call to unset() at the bottom of the file, and unsets several variables. At the surface, this is good housekeeping. However, these are all in the global namespace and therefore conflict with the calling scope.

A concrete example: I'm using the SDK in Drupal, and their library loading mechanism uses a variable called $path in the vary part of the code that requires this file, and it's in a loop (loading several of the files in this sdk). After including sdk.class.php, the $path variable is no longer present and subsequent file paths can no longer be created.

My suggestion is to use 'aws' namespaced variables (and not necessarily the PHP Namespace feature, though that would be great), but at least things like $aws_config_path instead of simply $path if you must use a global scope.

Cheers!