Repository navigation
Conversation
|
cc @alexandre-daubois as this concerns frankenphp cc @shivammathur for windows-specific review I think |
|
Hmm, small issue in this is also that we're kind of expecting embedders to pass argv in the internal encoding (which is utf-8 by default, but short of explicitly overwriting it, an embedder couldn't be sure). Should we instead require utf-8 and do the conversion if necessary? It's a bit extra code. Edit: went with always taking utf-8, I don't see another good way of dealing with it. |
|
@shivammathur @alexandre-daubois what do you think, pass argv as utf-8 or always as wchar_t and always do the encoding like before? |
|
Thinking more about this, I think we can preserve argv and document the caller’s encoding responsibility. That’s simpler and avoids misinterpreting UTF-8 |
|
I don't think that's a good idea, because the embedding program may not know php's internal encoding. |
|
Yes, unless the embedder explicitly sets it. |
But cli never takes the UTF-8 path, it's still going into the argv == __argv branch and converts from wstring to string. |
https://learn.microsoft.com/en-us/cpp/c-runtime-library/argc-argv-wargv?view=msvc-170
if we get called by an embedder (argv != __argv) don't re-parse the cmd.