Why does this facebook create album code create du

2019-06-21 22:57发布

问题:

I have this code that works fine (in that it creates the album properly). However, it creates two identical albums. I've tried removing message and privacy (not that this should have changed anything, but still). Nothing I try is changing the fact that this code creates two albums. I've even gone so far as to comment it out to ensure that it was the only code firing and no albums were created. I have code after this to post two test pictures and it only posts the pictures to one of the groups. However, I have an exit after this code, so I've ensured it's the only code firing.

Help, Please!

print "Creating album\n";
try {
    $ret_obj = $facebook->api('/me/albums', 'post', array(
        'access_code' => $access_code,
        'name' => 'Coolest Album',
        'message' => 'Coolest Album containing bike stuff',
        'privacy' => array('value'=>'EVERYONE'),
        ));
} catch (Exception $e) {
print_r($e->getMessage());
}
print "Album created\n";`

回答1:

What version of php are using? And, what is the version of the Facebook API? If you use Facebook 2.0, you need php 5.4 or 5.5. Maybe that could help?



回答2:

The issue was not with the SDK but with Facebook itself. I had created a bug report after doing some more tests. Facebook confirmed and fixed the bug. Basically, it had to do with inappropriate permissions handling.

https://developers.facebook.com/bugs/1435856773345641/