aws / aws-sdk-php

Official repository of the AWS SDK for PHP (@awsforphp)
http://aws.amazon.com/sdkforphp
Apache License 2.0
6.03k stars 1.22k forks source link

PHP Error[2]: include(../vendor/aws/aws-sdk-php/src/Aws/Rds/Exception/InvalidParameterValueException.php): failed to open stream: No such file or directory #255

Closed jamesmbowler closed 10 years ago

jamesmbowler commented 10 years ago

This file, InvalidParameterValueException.php, seems like it should be in all services. It's not currently in Rds/Exception. Copying the file over and changing the namespace declaration and making the class extend RdsException fixes it.

jamesmbowler commented 10 years ago

Also the same case for InvalidParameterCombinationException.php

jeremeamia commented 10 years ago

This is odd. Can you show us some code that reproduces this problem?

jamesmbowler commented 10 years ago

Any incorrect parameter will trigger it, like this (Iops must be >= 1000):

$client = Aws\Rds\RdsClient::factory(app()->params['aws_creds']);
$result = $client->createDBInstance(array(
                'DBInstanceIdentifier' => 'somename',
                'AllocatedStorage' => 150,
                'DBInstanceClass' => 'db.t1.micro',
                'Engine' => 'MySQL',
                'MasterUsername' => 'asdf',
                'MasterUserPassword' => 'password',
                'DBSecurityGroups' => array( 'default'),
                'VpcSecurityGroupIds' => array(),
                'AvailabilityZone' => AWS_REGION.'a',
                'MultiAZ' => false,
                'EngineVersion' => '5.6.13',
                'AutoMinorVersionUpgrade' => true,
                'LicenseModel' => 'general-public-license',
                'Iops' => 10,

));

The InvalidParameterValueException.php is just missing in some Service Directories.

jeremeamia commented 10 years ago

I cannot reproduce this error, and I think there is something strange going on.

First, let me explain how the exceptions work in the SDK. We produce Exception classes only for exceptions that are modeled in service descriptions. The RDS service description does not contain InvalidParameterValue. So it is correct that the exception class doesn't exist, but it should not cause an error. The exception factory class checks if the Exception class exists, and if it doesn't reverts to throwing the provided default exception. In the case of the RdsClient, it should be throwing Aws\Rds\Exception\RdsException.

Do you have another autoloader registered that might be interfering with the normal class_exists() behavior?

jamesmbowler commented 10 years ago

Oh, that must be it, yeah I'm working in a framework that has an autoloader, thanks for clearing that up.

On Wed, Mar 12, 2014 at 10:46 PM, Jeremy Lindblom notifications@github.comwrote:

I cannot reproduce this error, and I think there is something strange going on.

First, let me explain how the exceptions work in the SDK. We produce Exception classes only for exceptions that are modeled in service descriptions. The RDS service descriptionhttps://github.com/aws/aws-sdk-php/blob/master/src/Aws/Rds/Resources/rds-2013-09-09.phpdoes not contain InvalidParameterValue. So it is correct that the exception class doesn't exist, but it should not cause an error. The exception factory classhttps://github.com/aws/aws-sdk-php/blob/master/src/Aws/Common/Exception/NamespaceExceptionFactory.php#L74-L102checks if the Exception class exists, and if it doesn't reverts to throwing the provided default exception. In the case of the RdsClient, it should be throwing Aws\Rds\Exception\RdsException.

Do you have another autoloader registered that might be interfering with the normal class_exists() behavior?

— Reply to this email directly or view it on GitHubhttps://github.com/aws/aws-sdk-php/issues/255#issuecomment-37502103 .

jeremeamia commented 10 years ago

Cool. Thanks for double checking that. I'm going to go ahead and close this.