| Anonymous | Login | Signup for a new account | 06-10-2026 06:10 PDT |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0004415 | [Quercus] | minor | always | 03-01-11 07:01 | 06-23-12 00:38 | ||||
| Reporter | jamesdlow | View Status | public | ||||||
| Assigned To | nam | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | 4.0.14 | ||||||
| Summary | 0004415: php://temp is an unsupported or unknown path | ||||||||
| Description |
I'm trying to use a 3rd party library in my code. It reads from php://temp [^] I get the following error with the following code, trying to convert a string to a stream. Warning: php://temp [^] is an unsupported or unknown path for this protocol [fopen] $body = "Some text"; $stream = fopen('php://temp','r+'); [^] fputs($stream,$body); rewind($stream); |
||||||||
| Additional Information |
Additional information on wrappers can can be seen here: http://php.net/manual/en/wrappers.php.php [^] |
||||||||
| Attached Files |
|
||||||||
|
|
|||||||||
Notes |
|
|
(0005091) jamesdlow 03-01-11 09:42 |
I've been fiddling around trying to make this work. It should possible with some kind of buffered input/output stream. But I actually run out of memory on my computer when I try to compile Quercus. I've been trying with Pipes (see attached file PhpTemp.java) along with following changes to com.caucho.quercus.lib.file.PhpProtocolWrapper if (path.equals("php://output")) [^] return new PhpBinaryOutput(env); else if (path.equals("php://input")) [^] return new PhpBinaryInput(env); else if (path.equals("php://stdout")) [^] return new PhpStdout(); else if (path.equals("php://stderr")) [^] return new PhpStderr(); else if (path.equals("php://stdin")) [^] return new PhpStdin(env); else if (path.equals("php://temp")) [^] return new PhpTemp(env); |
|
(0005092) jamesdlow 03-01-11 09:44 |
I've also read that it might be better to use Oster Miller's CircularBuffer instead of pipes because its not limited to a 1k buffer: http://ostermiller.org/convert_java_outputstream_inputstream.html [^] |
|
(0005096) jamesdlow 03-01-11 19:43 |
Ok managed to get it compile without the memory errors, by compiling against the old resin.jar, and just compiling the two classes I changed. I've uploaded them, but had to rename the file PhpTemp2.java, change it back to PhpTemp.java if you download it and compile it. Though I'm not sure if its fully working or the best way to do this. It seemed to work for the most basic of cases, but I'm still having some trouble getting my library all the time. Trying to track down if that's the same issue, or something else. |
|
(0005108) jamesdlow 03-02-11 19:55 |
Ok, I've had a bit more of a try with my code and it seems it doesn't work. I'll keep trying, but if someone at Caucho know's how to implement this really easily do let me know. |
|
(0005117) jamesdlow 03-04-11 00:03 |
Ok PhpTemp2.java seems to work, but I also had to make a change to com.caucho.vfs.WriteStream (see attached file). in writeStream(InputStream source) I had to change the loop to include source.available() because otherwise read calls on some streams (like the PipedOutputStream I'm using) are blocking until there is date: while (source.available() > 0 && (len = source.read(_writeBuffer, _writeLength, length - _writeLength)) >= 0) { |
|
(0005119) jamesdlow 03-04-11 11:25 |
Hi, I ended up using the circular buffer mentioned here (see PhpTemp3.java), because 1K with the pipeinput buffer size was too small. Please note that the modification to WriteStream.java is still required to stop read blocking when there is no more data. http://ostermiller.org/convert_java_outputstream_inputstream.html [^] I'm not sure if you could make something work with your existing TempInputStream/TempOutputStream classes, but I wasn't confident enough in how these work to try. Thanks, James |
|
(0005941) nam 06-23-12 00:38 |
php/167k php/167l Fixed for 4.0.29. |
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
50 total queries executed. 33 unique queries executed. |