-
Notifications
You must be signed in to change notification settings - Fork 273
Conversation
The parameters to str_pad were the wrong way round; see: https://secure.php.net/str_pad This would cause failures if there were more than 9 blocks. Up until then, the failure was masked.
Can one of the admins verify this patch? |
I dont think that change is correct. You need to include the STR_PAD_LEFT option in there to make it work correctly. ie: $block->setBlockId(base64_encode(str_pad($counter++, 6, '0',STR_PAD_LEFT))); Also, I cant remember as I haven't looked at it for sometime now, but I think the base64_encode() in that line is incorrect also, so just the fix to str_pad wont fix it 100%. I think it was double base64_encoding the blockID, once on that line and then again within createBlobBlock() just before the send. |
STR_PAD_LEFT makes it more elegant and intuitive (it'll still be a unique ID without). I haven't checked the base64 encoding. I'm not using this method myself. I just noticed the str_pad error whilst comparing my own chunked code with this fragment in the SDK. So probably best if I leave it to you, if you actively use the method. I just thought it'd be helpful to flag up that the current code can't work at all for people with >9 blocks. |
I think the STR_PAD_LEFT is needed to keep the blockID unique Since: echo str_pad(1, 6, '0') ."\n"; Without STR_PAD_LEFT, the result of both of these is '100000', which is not unique |
You are correct - sorry; I am rushing too much. |
Hi @DavidAnderson684, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution! TTYL, AZPRBOT; |
Since @RobDonovan did not provide a PR, I pushed a fix to https://github.com/yaqiyang/azure-sdk-for-php/tree/pull757 Thanks |
The parameters to str_pad were the wrong way round; see: https://secure.php.net/str_pad
This would cause failures if there were more than 9 blocks. Up until then, the failure was masked.