« first day (4541 days earlier)      last day (398 days later) » 

3:36 PM
\o
 
o/
 
 
1 hour later…
5:11 PM
\o
 
5:25 PM
Today I found out that `zend.exception_string_param_max_len` influences the error output of a UnhandledMatchError.

`$x = match("wrong") { "a" => 1 };`
With exception_string_param_max_len=0 that outputs
`PHP Fatal error: Uncaught UnhandledMatchError: Unhandled match case '...'`
and with exception_string_param_max_len=5 the value in the match is printed.

Haven't seen that before, took a while to find. The docs just say `The maximum length of string function arguments in stringified stack traces. Must range between "0" and "1000000".` so I'm a bit unclear if this is intentional behavior.
 
Seems like OK to me?
 
Might it make sense for me to send a doc PR to note that somewhere (match docs / in the docs of the setting?).

Spend some time trying to figure out why the string in that place is "..." before understanding it's not the value that's printed here but that this means [redacted].
 
5:41 PM
The name of the setting is zend.exeception_string_param_max_len — the word param is important there.
 
"The maximum length of string function arguments in stringified stack traces"

I guess technically, from a core perspective, match is a string function. Yes.
 
string function arguments
it has nothing to do with it being match
the argument is a string, hence, needs to fit in the zend.exceptions_string_param_max_len size
 
But you do understand my confusion, no?
It's not how throw new Exception("bar"); or anything else I've come across works. At least I can't come up with another example where this happens.
And I get that that's not how things work internally in PHP, but without reading the src I wouldn't have found that.
Or am I just that off here? :)
That's ok then. Thank you!
 
 
1 hour later…
7:17 PM
@Trowski Using AMPHP, I need to stream a file from a URL to the FileBody of another POST request. Can I just give the URL to the $path property of the FileBody, or should I use the HTTP client to download the contents first and then use addFileFromString() on FormBody? (It must be POSTed to the service using multipart form encoding, otherwise I could use StreamBody instead with a ReadableStream)
 
@ramsey You can't directly pass the URL to the $path property, that's for local files only.
 
@kelunik That's what I thought
but I wasn't sure if it also used stream wrappers
 
7:32 PM
I want to allow directly adding streams to FormBody in v5, but many servers will probably reject these requests IIRC, because they won't have a content-length header then.
 
ah... makes sense
I wonder if you can make a HEAD request first to get the length, but that might be expensive, especially if the server you're fetching from generates the content on every request, even HEAD
 
Currently, request bodies are stream factories instead of streams. I'd like to change that for v5 and have already started a refactoring locally, but we still need to somehow handle content-length and content-type. And I don't want users to have to do that manually.
 
when streaming from a URL, though, wouldn't you have all the headers before the content begins streaming?
 
@ramsey That might work sometimes, but that response could also be chunked instead of providing a content-length.
 
got it
 
7:35 PM
@ramsey If they're present, yes, so you can indeed skip the HEAD request.
 
8:15 PM
@ramsey I recently wrote something that did a HEAD request to determine content-length to then simultaneously request different chunks with multiple requests.
So it depends on your source and how it behaves for HEAD requests or if it's always providing a content-length on GET. If we're talking about small files in general, buffering the file before forwarding it is probably fine.
 
thanks
 
@LeviMorrison Paul Dragoonis asked for edit permissions @ wiki.php.net/web* on the webmasters mailing list for the redesign. Are you involved in that somehow? Do you know who usually grants new permissions?
 
8:40 PM
@kelunik I don't believe Levi is. I believe CMB is the karma master.....has anyone heard from him recently?
 
 
1 hour later…
9:48 PM
@Trowski @kelunik I decided not to attempt streaming it. I'm requesting it, getting the contents, and then sending it to the other with an HTTP request. Problem I'm seeing now is that I need to use a FormBody, which I'm doing, and I'm using addFileFromString(), but the request that's created doesn't appear to have the contents in it.
I've used Xdebug to drill all the way down into it, and the contents are in the object, but when the request goes to the server, they are not in the body after the multi-part boundary. There's a multi-part boundary, and that's it. I switched to using a StringBody just to see what would happen, and that properly included the contents, as expected, but the server can't process that.
 
@ramsey Which version do you use?
 
v5.0.0-beta.8
of amphp/http-client, in case that wasn't clear :-)
 
10:05 PM
@kelunik here's a reproducible example. I figured I was doing something wrong, but now, I'm not sure. Maybe a bug? play.phpsandbox.io/amphp/http-client/roeVyplYaqKnqbPj
@kelunik Here's a similar example using StringBody, so you can see the difference I was talking about: play.phpsandbox.io/amphp/http-client/zxrR0ELkNg5J92VB
 
@ramsey Thanks, I'll have a look now.
 
Thanks! I'm stepping away for a PHP user group meeting, so it might be a while before I respond, if you have any questions.
 
10:40 PM
@ramsey Had any chance with figuring out what was crashing on you with Bref?
 
@ramsey Figured it out: You're overriding the content-type header. The form body generates it's own header which contains the necessary boundary. Took me a while to realize that unfortunately. Perhaps we should overwrite existing headers instead of skipping?
 

« first day (4541 days earlier)      last day (398 days later) »