New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CakeResponse::file() should accept an instance of SplFileObject #3515
Comments
👍 <3 |
This could be done in 2.6 and end up in 3.0 via merges. |
|
SplFileObject is always available |
Okay then, I will add this to my todo list. |
This could be done in 2.6, and then forward ported to 3.0. |
That's what i plan to do. |
So apparently SplFileObject doesn't have a method to read bytes making it unusable for non-text files. |
I guess we can't implement this then. |
Closing as it doesn't sound like this is going to be possible. SplFileObject does not provide the necessary tools to work with binary files. |
What is it lacking? |
Function to read binary files. It only has functions to read text files, per character or per line. |
It does not have to be line by line though. Just let php do the work for you using |
Yes but |
http://dk1.php.net/manual/en/splfileobject.fpassthru.php Do we need to send chunks? |
Oh sorry was looking at the We currently do send in chunks which allows terminating the output if client closes connection (at least that's what i understand). Also we would lose the ability to send only specified chunk based on |
@ADmad range can be done with I think doing chunks in php was a bad idea, personally. Web servers are good at negotiating that on their own. Anyway, I would be willing to live we the downside of no chunk when a SplFileObject is passed to Response::file() only because of the benefit of being able to pass it :D |
With fseek() you would be just able to set the start not the end isn't it?
I don't have much idea about how webserver handle this so I won't comment :)
In that case this would goto 3.0 since removing the chunking would be BC break. |
@ADmad You mark the end with I'm fine with it being in 3.0 |
Let me investigate bit more about that. I was under the impression that you needed to |
bah, too many complications. Scrap this feature |
https://cakephp.lighthouseapp.com/projects/42648-cakephp/tickets/3515 I used (string) because it is faster than strval() and there are no real benefits in this case. Also enabled assign(), append() and prepend() to take any values convertible to string. Removed try/catch as discussed with ADmad. Changed the three exception expecting tests to check for PHPUnit_Framework_Error now.
Conflicts: lib/Cake/Test/Case/View/ViewTest.php Fixes cakephp#3515
If an instance of a file is passed it should be able to stream the file. This is super useful for sending files that come from another stream, from a tmp file or just from memory.
The text was updated successfully, but these errors were encountered: