Skip to content

Make CloudStorageTools::createUploadUrl compatible with PHP7#13

Open
goodevilgenius wants to merge 3 commits intoGoogleCloudPlatform:masterfrom
goodevilgenius:upload-max-size-php7
Open

Make CloudStorageTools::createUploadUrl compatible with PHP7#13
goodevilgenius wants to merge 3 commits intoGoogleCloudPlatform:masterfrom
goodevilgenius:upload-max-size-php7

Conversation

@goodevilgenius
Copy link

@goodevilgenius goodevilgenius commented Mar 20, 2018

createUploadUrl calls getUploadMaxFileSizeInBytes, which does the following operation on a mostly-numeric string:

$val *= 1024

In PHP5, this works fine, because non-numeric values are stripped from the end.

In PHP7, a warning is issued which states A non well formed numeric value encountered.

The value has a final non-numeric character which can be stripped to prevent this warning.

This will continue to function in PHP5 as well.

Fixes #10

Other changes were necessary simply to get the build to pass.

`createUploadUrl` calls `getUploadMaxFileSizeInBytes`, which does the following operation on a mostly-numeric string:

`$val *= 1024`

In PHP5, this works fine, because non-numerica value is stripped from the end.

In PHP7, a warning is issued which states `A non well formed numeric value encountered`.

The value has a final non-numeric character which can be stripped to prevent this warning.

This will continue to function in PHP5 as well.

Fixes GoogleCloudPlatform#10
Dan Jones added 2 commits March 20, 2018 11:31
This is testing a third-party library, anyhow.
@coveralls
Copy link

Coverage Status

Coverage increased (+1.0%) to 11.123% when pulling 070f503 on goodevilgenius:upload-max-size-php7 into 6bdf4bc on GoogleCloudPlatform:master.

@agnosticaf
Copy link

I'm currently facing this issue, may I know what the status is for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants