I think it depends on the situation, but at first glance, without context, it seems odd for documentation wording to be dependent directly on the source code... in this context it seems odd, but I'm sure there are other contexts where the dependency is reasonable
Processing information and word formation is difficult for me at the moment :/
Although, based on the RFC I'm not sure you can actually use variadics and named functions parameters together like this.
function map(callable $transformer, iterable ... $inputs): iterable {
// for now I just care how named parameters work
return [];
}
map(transformer: fn ($x, $y) => [$x, $y], [1, 2], [3, 4]);
> Fatal error: Cannot use positional argument after named argument in /in/bQD6r on line 9
Since variadics always "positional" and must always go at the end, this basically means the features can't be used together, right? /cc @NikiC
> It is possible to use positional and named arguments in the same call, however the named arguments must come after the positional arguments[.]
As far as I can tell, the answer is "yes".
I think someone will need to convince me that this is not a bug: 3v4l.org/sSVTZ.
> Functions declared as variadic using the ...$args syntax will also collect unknown named arguments into $args.
Unless I've mis-spelled something then all those parameters are known, so it shouldn't be collected into the "unknown" parameters.
@Crell Briefly skimming the other functions like array_filter, array_reduce, etc, this should be named array; this way people can say array_reduce(array: $a, callback: $fn) and those same named parameters work for every array function of this type (but not sorting ones).
@LeviMorrison I've hit similar issue yestarday with varargs I've expected to be able to use splat operator to pass an arra of args, when I couldn't since the positional arguments where unpacked after named ones.
This causes an Fatal error: Uncaught Error: Cannot use positional argument after named argument during unpacking
in cases where we expect input array from unknown source we cannot expect the named ones to be at the end and a solution with sorting by key is also not gonna work since when unpacking arguments indexes of unnamed arguments will change
A solution to that is only use of foo('Foo', bars: $args);
Which shows that named arguments with variadics can and should be used only without splat operator - the unpacking argument operator.
IMHO splat operator ... should allow unpacking arguments from array and keep all keys regardles of varargs position in function signature and don't complain about positionals being placed after named arguments.
> I fear this workaround will become a dead end for PHP8. This will be a major issue because OMV is requiring this feature. And i don’t think OMV is the only one that wants to use PAM for authentication. IMO this is an essential requirement for a programming language that is used in professional applications.
Probably dumb question, but why do we keep the smart_string_* API? Sure there are a couple of usages still but the smart_str_* is a drop in replacement, or am I mistaken here?
There is no advantage of using char*, just the opposite. See the difference between "baseline" and the first (and second) zend_string lines: derickrethans.nl/…
I think PHP 8.1 could be a version where we added meaningful OO APIs. So I had a thought experiment.. of adding one to ext/json: gist.github.com/kocsismate/3936b27b2e445d8492ad395e8cb83ea7. What do you guys think about something like this?
@MarkR Yes, that would be my preference, too. And this is just an initial version of course, so if there's support behind it, we could bikeshed the details :)
@MarkR Do you mean that you'd go with static methods?
@MateKocsis Yup. JS does it right IMO, it has a JSON.parse and a JSON.stringify and accepts / returns native objects. Makes a lot of sense because the return value of JSON.parse might be legitimately a number, a single string etc
Hi, I have a question about OAuth2. Say for example I get access token from Auth0 Authorization Server. How does one save data related to this user on the Resource Server? Would you store the UserId that's in the token into a database?
@MarkR I agree, that's another sensible option. The reason why I started with non-static methods is that this way, it's comfortable to do multiple things with the same input (isValid(), keyExists() etc. methods). Althopugh, it might not be a major use-case.
@Wes No, but thinking about making one....but one problem is that just curating that would be a lot of work. And telling people, "no, that's a stupid idea" would be frustrating for everyone.
@IluTov haven't actually done anything but have been thinking about it. I still think the biggest problem is how to restrict discussions to only people who have enough done work to be able to actually have a positive contribution to make, rather than those who just want their voice heard.
@IluTov have you actually used that? It looks more like a bug reporting tool than a thing that could be used for helping people have focused discussions.
@Danack "You can choose to control access to your site by making it Private." Sounds like it should cover that, we could give out user accounts based on how well you behave on the ML.
@Danack Nope, literally just found this right now.
@IluTov yes. first, fuck the community feedback. The vast majority of PHP users just aren't that clever. And many of the ones who are clever focus solely on their own little use-case for PHP. Second, discussions need to be under a code of conduct where we are able to kick people out if they show that they are a negative contributor.
@MarkR ...I should probably know this by now, but does Oauth expose identity as well as permissions?
when I run php -v I get a confirmation that my mac is using 7.4..version I went to php.ini and set the memory limit to -1, but when I check again though the console it still tells me 128M. Any idea how else I do change the PHP memory limit on my mac?
@IluTov Not directly.....my general view is that each 'community' should have their own discussion, and work to produce a single output to send "upstream" to other communities. i.e. people in the symfony community could work on giving feedback on an rfc and saying the result of that discussion as a single voice. But realistically....people just don't want to do the work to do that as writing clear feedback is more work than people want to do.
the point at which community feedback becomes more useful is when we have enough spare developers who are looking around for what things should be worked on next, which is almost certainly not the case currently...
@Danack If we at least partially move the discussion to a private platform, would you lower the barrier to get a php.net account so that people like @Crell and @IMSoP can still partake in the discussion? Honestly, I think there are quite a few people with voting rights who know less about how the language works than some with no voting rights.
@MarkR This could also be useful to detach where the vote is held, for example on a tiny website vote.php.net where we don't need to deal with docuwiki (also makes it easier to move RFC around...)
Also, how do we know what people qualify for internal discussions without them having partaken in any major discussion? Quite obvious for those who contribute code but not those who don't.
@IluTov The problem is that because we are tied to docuwiki and there are no restriction so anyone who has a php.net account can vote, which is over 1000 people, which is pretty bonkers...
@IluTov yes creating an account should be easier. and to be clear, the platform can be public readable, it's just the posting requires authentication.....and we don't need to restrict it to just people.php.net. If the symfony community wanted to gather their thoughts, and push a summary of their thoughts to PHP internals that would be useful.
@Girgias I should work on my voting platform some more....which is actually the thing I want the identity/auth thing for first...
@Danack I mean I would expect the "hard" part is to tie into the current php.net infrastructure, then initially it's just a "dummy" system which allow anyone with a php.net account to vote
Because restricting voting power is going to be a bikeshed on its own which needs to go through the RFC process
@MateKocsis i don't like it being an instance of Json, because in JSON the difference between [] and {} is important, and you wrap it into an object now, so you don't know if its a list or an object
@Danack Makes sense. To be clear: I'm absolutely in favor of restricting who can post. This is probably the only realistic way to keep the platform from decaying into chaos. But there needs to be a way for them to join discussion without getting any other privileges to the php.net services.
@MateKocsis I'd love to have a built-in implementation that takes an iterable and outputs JSON to a stream. This should save a lot of memory in some use cases.
@Girgias We probably also need to take contributions into account. If Andi, Zeev or Rasmus don't contribute for 10 years, they should probably keep their accounts. Which makes it hard to come up with a strict rule.
Also hard to define contributions, does writing to the mailing list count?
That's why I said activity, not contribution. It's not about losing the PHP account it's about having voting rights removed as they should not be tied together. I am pretty sure even Z did say that at one point
And what do you think about revoking commit access from inactive members? I think it's also some kind of security threat that 1000+ people can push anything to php-src.
I know that it's OS, so commits usually get reviewed... But I can imagine that some might slip through any meaningful review (e.g. when Nikita is on vacation 😃)
I'm afraid there is no solution to the voting rights issue. A time limit is useless, since those who are interested in voting would just push a harmless commit from time to time. And getting a php.net account is also pretty easy (just apply as translator, and provide a couple of translations).
@Girgias The thing is also, it would probably take 1 e-mail to request the access back if you want to contribute something. If you've already been approved before that shouldn't be a huge problem.
@salathe Ohhh I see. If the moderation effort is not too high maybe that might be worth reconsidering. We could use that tool to gather feedback from the community and a different tool for internal discussion.
@Sjon, are you planning to pursue github.com/php/php-src/pull/5937? The compile failure appears to be resolved in github.com/php/php-src/pull/5959 (which looks pretty identical to your PR), but there are still some test failures. Point is, I'd like to close either PR. :)
@MarkR overall, I like this interface very much! I only don't like the stringify name. JsonEncoder::encode() would be more straightforward for me. Or maybe JsonSerializer::serialize()? What would you think about the 2 other methods I used: toArray() and toObject()? So that we can have more accurate types, and the $assoc optional parameter is not needed
@MateKocsis Would lead to some measure of confusion IMO as $assoc really just determines if object types are converted to assoc arrays during parsing. Would also need to throw a different kind of json error (or add new error flags for unexpected type) if the parsed result wasn't either but was still legit json
That sounds like a Sara and Gabriel problem now tbh :P
If anyone has a write up on how to compile PECL modules for 8.0 on docker that would be handy, I've been meaning to try it before public beta on Nov 26th
@Derick okay. I have a kubernetes/docker container running remotely on a server. I appreciate you may not know the answer in this context so I hope we can just pretend we have a remote shell on a remote SSH server. This remote shell we're running "phpunit" command line. Once we run this command then it should trigger a breakpoint in my IDE on local machine. Is there an online guide covering how to deal with remote CLI executors (versus remote WEB UI ones)
If you're already ssh-ing into it, just set up an SSH tunnel and forward remote port 9000 to local port 9000, something with ssh -R 9000:localhost:9000 yourhost — then set xdebug.remote_host = 9000 and make your IDE listen on port 9000 too. You can start phpunit with: XDEBUG_CONFIG="idekey=dr remote_host=localhost" path/to/phpunit
@Derick @Derick good news! the project here is already using "ngrok" to forward port 9000 to localhost. So that's done. Perhaps it's a matter of .ini configuration and IDE config.
you can make the xdebug.remote_host setting in php.ini too, and if you always want to debug, set xdebug.remote_autostart=1 and then you don't need the XDEBUG_CONFIG env var
If web already works, and the php.ini's are the same, just running it like: XDEBUG_CONFIG="idekey=dr remote_host=localhost" path/to/phpunit should work
@Sara You know how much work for how little pay that is?
@cmb Yeah I'll do that. It also fails on Windows, I was hoping I wouldn't have to set it up :P
I'll also need help with nullsafe JIT. I'm utterly confused how jumps are implemented in the JIT. I can only find a few referenced of some opcodes (like ZEND_COALESCE) but no real implementation of those. And I can make JMP_NULL (the opcode for nullsafe) work by adding it to the same places, but I have no idea how :D
Doesn't quite work with Visual Studio, though. But the manual install isn't really hard (you only need the "Desktopentwicklung mit C++" Workload with default settings).
@LeviMorrison The problem with dropping all explicit arrays on array_map() is that you then can't use an explicit param name to specify the input array. At least, I don't think so... Also, changing the behavior of array_map is out of scope (and my skillset at the moment).
Standardizing on "input" and "callback" works for me if it works for everyone else.
@cmb The batch script calls phpsdk_deps but that doesn't seem to be available at that point, do I need to add C:\php-sdk\bin to the path variable? When I call it directly it directly I get this error:
> INFORMATION: Es konnten keine Dateien mit dem angegebenen > Muster gefunden werden. > > Fatal error: Uncaught SDK\Exception: Couldn't execute cl.exe. in C:\php-sdk\lib\php\libsdk\SDK\Config.php:66 > Stack trace: > #0 C:\php-sdk\bin\phpsdk_deps.php(120): SDK\Config::getCurrentArchName() > #1 {main} > thrown in C:\php-sdk\lib\php\libsdk\SDK\Config.php on line 66
@MarkR not exacly, there's a lot of things to finish 🙂. E.g. warning to error promotions, fixing default value handling for named params, improving param names, or syncing the manual with the stubs
@IluTov ugh, I think that can't work (thought I checked that, but probably not). Point is after you installed the SDK, you have to start phpsdk-vs16-x64.bat (or -x86.bat) in the php-sdk installation directory. Then you cd to php-src, and are good to go.
and one particular gotcha (for those used to building PHP on other systems): name test does not rebuilt anything; need to nmake first
@IluTov because on typical Win dev setups there are several VS versions and multiple Win SDKs, and the script tries to setup the correct ones for the PHP version.
That stuff is mostly written for the PHP Windows maintainers.
@Tiffany My gut feeling at the moment is to put it with coalesce, and then link to it from assignment. But I could probably make a good argument the other way around, too.
@Crell yeah, I added a readme to ext/mysqli/tests that was just a markdown file, and one or two of my commits "failed," I'm guessing because I happened to push them in between failing builds, then the final commit passed
@Crell You need to check the CI failures, because we have some flaky tests due to networking or FPM, and sometimes the CI pipelines can't update APT and just dies
@StatikStasis The number of candidates to elect. E.g. in the release manager election there are two seats. For attribute syntax only one candidate can be elected, so one seat.
There's no explicit casting, maybe it has something to do with the var args? I have no clue. Not being able to reproduce it locally makes it pretty much impossible to solve.
Or maybe the underlying value is just matching by chance.
@Tiffany it only deserves special mention on that page, if it is special. I'm not sure if it is; the long discussion on the final implementation is more about internal details, but there might be some actual edge-case that might be worthwhile to document.
@IluTov I did a typical debug build (configure --enable-snapshot-build --enable-debug --disable-debug-pack --disable-zts), and when I'm running the test (nmake test TESTS=ext\opcache\tests\match\005.phpt), I hit an abort. Quick debugging shows that zend_get_type_by_const() is called with type=236. That happened already several times, and I think it always was due to erroneous register usage (it's different on Windows and Linux).
What I was also wondering, Dmitry switched to tracing JIT by default, which means lots of code will never be jitted in CI. Should we also add a build with opcache.jit=1205? I'm afraid this could allow bugs to sneak in.
and yes, a PITA, if I even knew the basics of the JIT implementation to start real debugging ;)
and for Dmitry that means switching to Windows, what he doesn't like
not sure if we should have a 1205 built; maybe it was just temporary, but when we switched to tracing JIT there were issues on Windows (and likely on Linux, but these had been already fixed)
@Tiffany well, none of the combined assignment operators are explicitly documented (there's an example showing +=, but that's about it)
and thinking about it, it's probably a good idea to document the exact semantics of combined assignment in general, namely that $a +=$b is sugar for $a = $a + $b with the exception that $a is evaluated only once
@cmb If we don't it's very hard to write tests that actually test the JIT. You never know what part of a function the JIT will actually decide to optimize. I found a bug that only gets triggered with the 1205 flag.
@IluTov Well, we could add tests for any newly found bugs as they are noticed (that's called bug driven developement or BDD). ;) But yeah, may make sense to add another configuration, if we have the capacities. Not sure we have.