Skip to content

Update Sapi.php - #61

Closed
chakphanu wants to merge 1 commit into
sabre-io:masterfrom
chakphanu:patch-1
Closed

chakphanu wants to merge 1 commit into
sabre-io:masterfrom
chakphanu:patch-1

Conversation

@chakphanu

Copy link
Copy Markdown

ensure $contentLength is integer value.

@evert

evert commented Apr 4, 2016

Copy link
Copy Markdown
Member

Our of curiosity.. what problem does this solve?

@chakphanu

Copy link
Copy Markdown
Author

from: owncloud/core#23788
have error log: "stream_copy_to_stream() expects parameter 3 to be integer, string given at /var/www/owncloud/3rdparty/sabre/http/lib/Sapi.php#78"

@evert

evert commented Apr 4, 2016

Copy link
Copy Markdown
Member

If the Sapi receives a string with a number in it, this will work just fine. PHP will cast it. The only case that error is triggered is when the received value is not a number at all, in which case intval will likely turn it to 0, which I think is undesirable.

What should happen is :

  1. sabre/http should throw a better error when the value is non-numeric.
  2. Find the root-cause of the issue. Why is it getting a non-numeric string?

@staabm

staabm commented Apr 4, 2016

Copy link
Copy Markdown
Member

@evert I guess php7 is used with strict types in the above warning/error case

@evert

evert commented Apr 4, 2016

Copy link
Copy Markdown
Member

@staabm , not possible. Strict types are set by the caller and strict is off per-file by default. Only if Sapi.php was explicitly set to strict, this could have resulted in that error.

@evert

evert commented Oct 13, 2016

Copy link
Copy Markdown
Member

It was never clear what the root cause was for this issue, however.. I've now made a change that fixes this as a side-effect of using PHP 7 strict_types everywhere.

@evert evert closed this Oct 13, 2016
@rikmeijer

rikmeijer commented Apr 5, 2017 •

Copy link
Copy Markdown

In nextcloud this problem arises when downloading files > 2 GB on 32 bit machines. In my comment I showed a possible fix, but it involves changing sabre/http

@derkostka

derkostka commented Apr 5, 2017 •

Copy link
Copy Markdown
Contributor

@evert please consider taking this change over. This effectively enables owncloud and nextcloud users to be able to transfer large files even on 32 Bit machines. Thanks @rikmeijer 👍

Patch is here: nextcloud/server#1707 (comment)

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.

5 participants