Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Mac MAMP PHP 5.4.X cast to String making crash #63

Open
lixiphp opened this issue Feb 4, 2014 · 2 comments
Open

Mac MAMP PHP 5.4.X cast to String making crash #63

lixiphp opened this issue Feb 4, 2014 · 2 comments

Comments

@lixiphp
Copy link

lixiphp commented Feb 4, 2014

In the Lastest SDK s3.class.php get_canonical_user_id function:

return array(
            'id' => (string) $id->body->Owner->ID,
            'display_name' => (string) $id->body->Owner->DisplayName
        );

The Converting to String making the Apache server crash.

@lixiphp
Copy link
Author

lixiphp commented Feb 4, 2014

Here is the patch.

Index: awssdk/services/s3.class.php
<+>UTF-8
===================================================================
--- awssdk/services/s3.class.php    (revision )
+++ awssdk/services/s3.class.php    (revision )
@@ -4070,8 +4070,8 @@
        $id = $this->list_buckets();

        return array(
-           'id' => (string) $id->body->Owner->ID,
-           'display_name' => (string) $id->body->Owner->DisplayName
+           'id' => $id->body->Owner->ID,
+           'display_name' => $id->body->Owner->DisplayName
        );
    }

@miccheng
Copy link

miccheng commented Feb 4, 2014

This "fix" doesn't address the cause of the crash, just hides the problem. Casting to string is good practice. Perhaps you should throw an exception if ID or display name are not castable to string.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants