« first day (3882 days earlier)      last day (1052 days later) » 

12:28 AM
what is a mixed pickle?
 
 
1 hour later…
1:41 AM
shmop_close returns deprecated but function_exists recognizes as valid ・ *General Issues ・ #81098
 
1:52 AM
<?php
function Z(...$z) {}

echo (string)
    new ReflectionFunction(Z(?, ?, ?));
?>
Function [ <user> partial function Z ] {
  @@ /opt/src/php-src/compile.php 5 - 5

  - Parameters [3] {
    Parameter #0 [ <required> $z ]
    Parameter #1 [ <required> $z ]
    Parameter #2 [ <required> $z ]
  }
}
you see what I did there ...
 
 
4 hours later…
6:19 AM
and begin again ...
 
 
1 hour later…
7:30 AM
@Girgias huh, how is it related to the arena?
Though to be clear, I'm not saying it needs to be supported
 
8:16 AM
moin
 
@cmb My next documentation related contribution could be to add support for generating class synopsis pages. We have all the necessary info now except for constants. :( Do you think my idea would be still feasible?
 
8:35 AM
Incident with Issues ・ Notifications has Partial Outage
Incident with API Requests and Issues ・ API Requests has Partial Outage ・ Notifications has Partial Outage
Incident with API Requests, Issues, and Pull Requests ・ API Requests has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage
Incident with API Requests, Issues, GitHub Pages, and Pull Requests ・ API Requests has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage
Incident with API Requests, Git Operations, Issues, GitHub Pages, and Pull Requests ・ Git Operations has Partial Outage ・ API Requests has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage
Incident with API Requests, Git Operations, Issues, GitHub Packages, GitHub Pages, and Pull Requests ・ Git Operations has Partial Outage ・ API Requests has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage
Incident with GitHub Actions, API Requests, Git Operations, Issues, GitHub Packages, GitHub Pages, and Pull Requests ・ Git Operations has Partial Outage ・ API Requests has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage ・ GitHub Pages has Partial Outage
 
@cmb I had totally forgotten about that repo!
 
Incident with GitHub Actions, API Requests, Git Operations, Issues, GitHub Packages, GitHub Pages, Pull Requests, and Webhooks ・ Git Operations has Partial Outage ・ API Requests has Partial Outage ・ Issues, PRs, Dashboard, Projects has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage ・ GitHub Pages has Partial Outage
Incident with GitHub Actions, API Requests, Git Operations, Issues, GitHub Packages, GitHub Pages, Pull Requests, Slack Integration, and Webhooks ・ Git Operations has Partial Outage ・ API Requests has Partial Outage ・ Issues, PRs, Dashboard, Projects has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage ・ GitHub Pages has Partial Outage
 
@cmb I'm hoping to do some bug fixing in Xdebug on Win10 with WSL2... but it seems my VS Subscription has expired and hence I don't have a valid key for Win10. Is that something you can assist with?
 
@DaveRandom It was no different in my earlier days of contributing to Windows support
 
8:58 AM
@cmb Actually, my plan isn't going to work as I can't run WSL2 in Win10 in a VirtualBox Guest :-)
 
You could always pick up a second hand Dell W10 pro box for a couple of hundred £
 
Incident with GitHub Actions, API Requests, Git Operations, Issues, Microsoft Teams Integration, GitHub Packages, GitHub Pages, Pull Requests, and Webhooks ・ Git Operations has Partial Outage ・ API Requests has Partial Outage ・ Issues, PRs, Dashboard, Projects has Partial Outage ・ Notifications has Partial Outage ・ Gists has Partial Outage ・ GitHub Pages has Partial Outage
 
@MarkR I don't need more laptops, especially not one that I'd need only once.
 
krakjoe@Fiji:/opt/src/php-src$ cat compile.php
<?php
class Foo {
    public function __call($method, $args) {
        printf("%s::%s\n", __CLASS__, $method);

        var_dump($args);
    }
}

$foo = new Foo;

$bar = $foo->method(?, ?, ...);

echo (string) new ReflectionFunction($bar);

$bar(one: 1, two: 2, three: 3);
?>
krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php compile.php
Method [ <user, prototype Foo> partial public method method ] {
  @@ /opt/src/php-src/compile.php 12 - 12

  - Parameters [3] {
magic
 
Yer a Wizard, Watkins!
2
 
cmb
9:15 AM
@Derick I don't think so; MSFT is rather ungenerous with subscriptions nowadays.
@MateKocsis do you mean constants and properties?
 
9:29 AM
Incident with GitHub Actions, API Requests, Git Operations, Issues, GitHub Packages, GitHub Pages, Pull Requests, and Webhooks ・ Issues, PRs, Dashboard, Projects has Partial Outage ・ Gists has Partial Outage
Incident with GitHub Actions, API Requests, Git Operations, Issues, GitHub Packages, GitHub Pages, Pull Requests, and Webhooks ・ Issues, PRs, Dashboard, Projects has Partial Outage
 
Do we know someone working at New Relic on their php agent?
It seems like they have the same issue with the ZTS flag on their builds
But I'm not really sure how to confirm that
 
@cmb nope, we already know almost all the properties - even the dynamic ones ;)
 
cmb
@MateKocsis well, not sure what you actually mean. Is it about gen_stub.php to doc conversion?
 
9:44 AM
Yes, just like how the methodsynopses were generated. Now, we could generate a lot of class synopses as well
 
cmb
That makes sense. :)
 
Cool! I'll keep this in mind, and I'll implement it during feature freeze
 
9:59 AM
Minor Service Outage ・ Issues, PRs, Dashboard, Projects has Partial Outage
All issues have been resolved!
 
 
1 hour later…
11:27 AM
Test
 
\o/
 
11:56 AM
@NikiC So because all types were class types, the type list would always have the same amount of types as the AST has children, so I allocated the necessary size directly on the arena instead of using the heap and then do a memcpy, which is not the case anymore if static is used
@NikiC Well basic support (haven't done/tested variance) is rather simple, but I really don't like it, it seems to point more to a questionable design choice then be actually useful, I'll try to flesh out the RFC to explain that.
 
@Derick i spent about 2 hours last night trying to setup Xdebug with PhpStorm ( windows 10, Xdebug in wsl2, and PhpStorm running on host ), with no luck, eventually gave up and opened VS code 😂
 
12:17 PM
the bit that normally trips me up with PhpStorm's Xdebug integration is the server and path mappings
I've never used VS Code so no idea if those are actually handled better there or just differently enough to be unfamiliar if you try to switch
 
12:37 PM
I finally managed to install libmysqlclient
it wasn't so hard
now I can see all these test failures with mysqli
 
12:59 PM
If you uninstall it, they will go away just as fast and it ccan once again be forgotten!
 
1:43 PM
...lol...
 
1:57 PM
@NikiC added a motivation section and clarified why self/parent/static aren't accepted github.com/Girgias/intersection-types
 
2:15 PM
@Crell I guess Nikita had an answer for us: github.com/php/php-src/pull/7089 :)
 
oooo nice. That's going to make data objects a lot easier
 
@MateKocsis Ugh. Didn't we just vote against that in 8.0?
 
Certainly not "we" :D
 
Royal we. :-P
 
But I think the semantics are slightly different from what I tried to achieve
 
2:20 PM
Well it's been much more than 6 months since wiki.php.net/rfc/write_once_properties
 
I still think we should at least go for the implicit get/set, even without the explicit accessors, as it gives more functionality and is more forward compatible. And wouldn't inherently be incompatible with with-er methods.
 
@IMSoP "it just works out of the box"™
 
I'll believe that when I see the pigs flying
 
You will have to wait for me to get on a plane again
 
which is not meant as offense to either Derick or whoever built the VSCode stuff, but there's so many different ways Xdebug could be set up, and relationships between the code, the server, and the IDE, that it's basically luck if any defaults work
 
2:32 PM
Yea, i have tried searching for solutions but all problems people are facing are after the fact that they have setup Xdebug, vs code works by default without the need to modify any configuration.

And i'm certain the issue is the fact phpstorm is running on windows host, and xdebug is in WSL2, since with VS Code, VS Code server also runs in WSL2, so both xdebug and vs code can establish a connection, while PhpStorm and Xdebug can't.
 
that's what I'm saying, it's not that it "works" by default, it's that it happens to do the particular combination of configuration you need by default
I have code checked out locally, and Xdebug running on a remote server; my "just works" configuration is going to be very different to yours
 
Yea :) the problem is xdebug.client_host, when the client ( vs code ) is running in wsl2 also, that's localhost, but when the client is on the windows host and you are in wsl ... well, it's more complicated, see: silverf0x00.com/setting-up-xdebug-for-phpstorm-on-windows-wsl2/… ( P.S, also tried this, won't work ... )
 
cmb
2:45 PM
@IMSoP maybe it works better because the VSCode integration is an Xdebug project
 
@SaifEddinGmati I think I'd probably just solve that with SSH port forwarding; but then, I have a habit of solving everything with SSH port forwarding
 
yea ... no, i'm okay with using vs code once every two weeks, i need it installed anyways
 
an IDE/editor having its own server application sounds weird to me, but people say good things about it, so what do I know
 
actually, vs code integration with WSL 2 is way much better than PhpStorm, especially when dealing with linux filesystem.

PhpStorm treats WSL2 as a remote server
 
well, it basically is just a VM
as opposed to WSL1, which runs in the Windows process space
like I say, many different ways of working
 
2:55 PM
well, you can't do this with a VM :p
 
last time I tried, accessing the host file system felt like going over a 56k modem
 
Yeah, you have to mount on the linux FS if using a lot of files
 
also, I didn't sleep well in the heat, so I'm feeling contrary :P
 
not really bad
 
I think the problem is more with working with lots of files
e.g. doing a "git clone"
because every file operation is translated across the VM barrier
 
3:01 PM
Yeah, it's the back and forth handling the file metadata and such that takes the time. You can pull over a large sequential file quickly
 
with WSL1, it's the opposite: the file system inside the WSL instance is slow, because it's a virtual file system; but not nearly as bad
 
oh, you mean running git clone in wsl, but you are cloning in a windows directory ( /mnt/c/... )?

yea, that is extremely slow, i tried doing that at first thinking maybe PhpStorm will be a bit faster dealing with windows fs lol
 
yeah, precisely; in WSL1, that works really smoothly
presumably the Windows mounts mostly just by-pass the emulation
 
Setting the WSL directory to be in the root of a separate drive made everything work a lot more nicely for me, compared to having it in the default location on C.
 
i just use the wsl filesystem, everything is there
 
3:08 PM
I use WSL1 a bit like cygwin or "git bash" or whatever: just point it at Windows mounted locations, but run Linux commands on them
 
phpstorm is a bit slow, but not really noticeable that much ( unless it's indexing ), and everything else works perfectl
 
Mounting files on the ext4 partition is lightning fast
 
@IMSoP I do too - and when I do need an actual linux instance with all capabilities I just ssh into my hyperV linux vm
 
@bwoebi what capabilities do you get from that, that you don't from WSL2?
 
@SaifEddinGmati well, you cannot run wsl 1 and wsl 2 at the same time, right?
 
3:12 PM
oh, yea, you can't.
 
And performance of wsl 1 when working on the windows host fs is vastly superior, so wsl 1 it is
 
but why not use WSL2? ( unless your CPU doesn't support HyperV )
ah, okay
yea, i don't use windows host fs at all, so i don't really have that problem
 
and the only thing wsl2 really provides is a pre-existing mount of the windows host
(I mean over just using a HyperV vm directly)
 
I wonder if they'll come up with a WSL3 which magically has the best of both worlds
no idea what that would be, though, they're quite fundamentally different approaches
 
WSL will slowly consume windows kernel
 
3:15 PM
@IMSoP they just have to replace the NT kernel by linux and provide a NT emulation layer on top of that
 
hah, yes! genius!
 
eventually you will get a linux distro with cmd.exe installed by default, running on top of wine
 
@MateKocsis Yes, one difference is that initialization is private only
 
switching a distro from one mode to the other takes a few minutes, so you can't quickly hop back and forth
 
3:19 PM
you can* have two**, one for commands to use on windows, and one as a distro
 
you could run a separate WSL2 instance, but at that point, it won't share anything with the WSL1 one, so is not much different from starting up a VM
 
better UX if using windows console
since you can have the WSL1 start in /mnt/c/, and the other one in /~
 
@NikiC yeah saw it from one of the tests :) This rule is a bit strange for me, but I'm sure you have good arguments. P.S. I missed tests about cloning. Also, if you don't mind, I'd follow-up your "readonly" RFC with a "clone with" RFC.
 
@SaifEddinGmati well, you can have a terminal profile to SSH to the VM; but yeah, it saves having to click a separate "start vm" button
 
+ no need for another software to create a VM
 
3:27 PM
are you on commission? ;)
 
No, i just can't stop recommending Microsoft products since i got the Covid vaccine
10
weird
 
hah!
 
lol, that's great!
 
4:32 PM
@MateKocsis For example, it would ensure that "clone with" only works in private scope and you can't violate invariants through it. I'm not sure whether the rule is really necessary.
 
@Crell ping
 
@MateKocsis I also thought it would make things "actually covariant", but that's not really the case.
 
@JoeWatkins vibrates
 
@Crell the last issues I had are gone, you can update the rfc (magic is back) and go back to internals when ready
 
Wait, wait, __call() works now? how?
 
4:45 PM
I rewrote half the patch, much better signature/prototype generation ...I'm happy we revisited that, for the first time ever you can determine the shape of call magic by static analysis, that's kinda cool ..
 
O_o
So a magic method now reflects as just a blind ...$args, essentially?
> for the first time ever you can determine the shape of call magic by static analysis, that's kinda cool ..

Is that something worth mentioning at all, or no?
 
it reflects exactly as you would expect:
<?php
class Foo {
    public function __call($method, $args) {
        var_dump($args);
    }
}

$foo = new Foo();

echo (string) new ReflectionFunction($foo->method(?, ?));

echo (string) new ReflectionFunction($foo->method(...));

echo (string) new ReflectionFunction($foo->method(?, ...));
?>
Method [ <user, prototype Foo> partial public method method ] {
  @@ /opt/src/php-src/magic.php 10 - 10

  - Parameters [2] {
    Parameter #0 [ <required> $args ]
    Parameter #1 [ <required> $args ]
  }
}
Method [ <user, prototype Foo> partial public method method ] {
  @@ /opt/src/php-src/magic.php 12 - 12

  - Parameters [1] {
    Parameter #0 [ <optional> ...$args ]
  }
}
Method [ <user, prototype Foo> partial public method method ] {
  @@ /opt/src/php-src/magic.php 14 - 14

  - Parameters [2] {
 
Ahso.
But untyped and with no name?
And that's now safe to do?
 
the "first time ever" was a bit over-excited, you can analyse calls now ... but the most precise signature you can infer is <optional> ...$args ...
@Crell yes
 
So what would ReflectionFunction($foo->method(?, ?, ?))->getParameters()[0]->getName() do? Empty string?
 
4:54 PM
it will return "args"
 
echo (new ReflectionFunction($bar))->getParameters()[0]->getName(); // This just segfaulted for me.
 
pull
oh I didn't get that ...
 
Still segfaulting after a pull.
 
yeah I got a bug in reflection there, it will return "args", when I've fixed it :D
magic is literally the most special case and it's not handled in one place there ...
 
Exciting.
So every parameter gets rendered as "mixed $args", basically?
 
5:10 PM
okay I think I got it ...
@Crell yeah there's not much to do about that, I don't think ...
 
Agreed. I might quibble about $arg vs $args, but that's it. The design logic seems fine.
Should I add checking the name/type to one of the tests or are you taking care of that?
 
I'm going to take care of it, next commit will include a test for that ... I've lost my last 2/3% of coverage because of refactoring, so I'm intending to bring it back up to 100% anyway ...
fixed after pull, right ?
 
:-) OK. I'll wait for your green light before posting to the list, but I'll update the RFC text.
Yes, my latest pull did not segfault.
 
oh don't worry about waiting for those tests, they'll come over the next day or so whatever, they're not going to change anything whatever ... push on if you like
98% is a lot more coverage than most pr's have, I'm spoiling us with coverage really ...
similarly I want to work on error messages bit more and the fine detail of that might change, and might change again after voting, mostly all we have left now are implementation details like that, not worth stalling over I think
 
OK. As soon as I update the magic method description I'll post it to the list. I'm also taking out the first paragraph of the intro about previous RFCs (which I don't actually recall), as requested.
Hm, what do named arguments do with __call? With or without partials...
They work, apparently. But since the name is the same for all of them, can you name-call a partial?
(I know, I know, name calling is bad...)
 
5:21 PM
krakjoe@Fiji:/opt/src/php-src$ cat magic.php
<?php
class Foo {
    public function __call($method, $args) {
        var_dump($args);
    }
}

$foo = new Foo();

$bar = $foo->method(?, ?, baz: "baz");

echo (string) new ReflectionFunction($bar);

$bar(foo: "foo", bar: "bar");

?>
krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php magic.php
Method [ <user, prototype Foo> partial public method method ] {
  @@ /opt/src/php-src/magic.php 10 - 10

  - Parameters [2] {
    Parameter #0 [ <required> $args ]
    Parameter #1 [ <required> $args ]
 
Huh. How about that.
 
Neat.
 
Please review the magic methods section for accuracy: wiki.php.net/rfc/partial_function_application
 
formatting
 
StackOverflow just got sold
 
5:28 PM
Who the heck is Prosus... sounds pretty sus
 
I <censored> hate DocuWiki...
 
@MarkR No idea... but I bet it's going the GitHub way from now on-ish.
 
@Crell can you fix formatting, can't read it
 
Working on it now.
 
one of the biggest tech giants in europe, apparently.
 
5:29 PM
/me shrugs - never heard of them
 
Try now.
 
cmb
@Derick np; nothing will change …
 
yep, nuff said
 
Sounds like another company that doesn't actually make anything useful, just buys up others and plays money shenanigans in order to make money on someone else's work.
Cool. I'll go post it then.
 
@Crell that's a description of most of the tech industry ....
 
5:34 PM
Time to ask them to sponsor open source projects that get asked about....
 
or big tech anyway ... isn't that what big tech means ?
once you are more interested in buying up the competition than actually creating, I reckon you're big tech by definition ...
 
manager vs maker mentality
not related, but fun read: paulgraham.com/makersschedule.html
 
he's turned into a manager
 
Some of his views are pretty bad, but sometimes he has some insights:
 
5:45 PM
not endorsing Paul Graham as a person, but I think his post was the original for the "maker vs manager schedule," which is why I linked it
 
Yeah, Graham is an example of how you can be both usefully insightful and a total jerk at the same time.
 
@Crell just to note, the handling of variadics that you see in magic is not really special, that's how we'll handle variadics (there's not another way to construct the correct signature) ...
krakjoe@Fiji:/opt/src/php-src$ cat magic.php
<?php
function foo(...$args) {

}

$foo = foo(?, ?, ...);

$reflector = new ReflectionFunction($foo);


echo (string) $reflector;

foreach ($reflector->getParameters() as $parameter) {
    var_dump($parameter->getName());
}
?>
krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php magic.php
Function [ <user> partial function foo ] {
  @@ /opt/src/php-src/magic.php 6 - 6

  - Parameters [3] {
    Parameter #0 [ <required> $args ]
    Parameter #1 [ <required> $args ]
    Parameter #2 [ <optional> ...$args ]
  }
}
string(4) "args"
string(4) "args"
string(4) "args"
 
That's fine. It just occured to me "if all the args reflect as $args, can we do named args?" And the answer is "yep", so I included that.
 
"args, args, args" sounds like code written by a cave man; or somebody in pain
 
5:46 PM
There's probably a Mel Brooks routine in there somewhere.
Email is away!
 
function creditMutantEnemy(Grrr $arg) { ... }
 
Precisely. :-)
 
hey there
 
krakjoe@Fiji:/opt/src/php-src$ cat compile.php
<?php
/* send PHP to sleep ... */
function Z(...$z) {};

echo (string)
    new ReflectionFunction(Z(?, ?, ?, ...));
?>
krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php compile.php
Function [ <user> partial function Z ] {
  @@ /opt/src/php-src/compile.php 6 - 6

  - Parameters [4] {
    Parameter #0 [ <required> $z ]
    Parameter #1 [ <required> $z ]
    Parameter #2 [ <required> $z ]
    Parameter #3 [ <optional> ...$z ]
  }
}
 
@Crell which is my core skill, but I try to do both parts somewhat deliberately...
 
5:53 PM
that is some awesome magic you've cooked up there Joe; thanks for sticking with it
 
thanks :)
 
I'm really quite happy with where this has ended up overall. Not ideal, but close to, and it's a huge amount of power packed into a few small characters.
 
let's please add just one more :p
 
....and let the random feedback of people thinking other syntaxes would be better begin...
 
I'm not that random :P
 
6:09 PM
I'll be glad when we have an answer, either way ... I've spent more time on this than we did on phpdbg before it was merged ...
 
reading through the RFC, and so far, I am super-excited by this
 
@Crell how has food from your grill fared since the jalapeno blessed it?
 
oh, wow: array_map(new Person(?), $data)
 
@Tiffany The evil fruit was kept far from other food.
 
I'm pretty sure "new Foo(...)" creates a kind of callable that's actually not expressible in current PHP :D
 
6:21 PM
$foo_factory = fn(...$args) => new Foo(...$args); ?
 
$arrow = fn($who) => speak($who, getArg());
print "JOe\n";
$arrow('Larry');

is the miscapitalization intentional?
 
Nope.
Fixed. Thanks.
 
@SaifEddinGmati yeah, but you have to have that explicit wrapper; you can't use ['Foo', '__construct'] or anything to directly reference it
in fact, I just turned up an RFC by Dan a few years ago proposing to make that work: wiki.php.net/rfc/callableconstructors
@Crell minor nitpick: "$points is an array of 4 distinct Person instances" - it might make more sense for the array to by "$people" or something
 
Leftover from earlier version of the example. Will fix, thanks.
 
I presumed so
 
@IMSoP yeah I was going to link that.....a different path to a similar goal. And possibly one with less resistance.
Also, anyone else just get logged out?
 
"One change that has multiple disparate benefits, especially when combined with another feature" is a sign that you're doing something right.
 
The warnings and disclaimers page on my new hot tub is like... 15 pages long
 
"but would only support $$ if it gets called T_BLING" ROFL
 
@SaifEddinGmati but that looses all reflection information :P
 
6:31 PM
I am super-hyped for this
 
@MarkR hot tubs don't have pages, I think you might be looking at the manual. The hot tub is the bigger bit, look in the box, you can't miss it
 
@IMSoP T_NOT_TOO_EXPENSIVE
 
well, $foo_factory = fn(string $bar, int $baz, ?array $qux = null) => new Foo($bar, $baz, $qux); ?

:p

but i'm in favor of Partials, would be really handy ( see https://github.com/vimeo/psalm/issues/3963 )
 
@DaveRandom >_> Unfortunately the thing I missed... was the decking I was stepping off when setting it up. Sprained heel and my foot is rather swollen
 
urgh :-/
 
6:32 PM
@MarkR was there a warning about that on the bottom of page 13?
 
you know what's good for sprained muscles? a nice soak in the tub
 
things that are outside with water in them are a nightmare
 
@DaveRandom Already done. Was planning on trying again tonight. I bought a St Lucia 2 / 3 person tub... which is kinda a joke, maybe 3 children but not 3 adults. I barely fit across it
 
@SaifEddinGmati How about new $class(?) :P
 
what you bought is a container for a puddle
 
6:33 PM
I'm going to see if I can have the self discipline to keep up the treatment.
 
@kelunik if i don't know the arguments i needs, how am i supposed to call it :p
 
I think it's prob similar to a "3-man" tent?
 
@SaifEddinGmati Reflection and amphp/injector :P
 
If i can't statically express it, i don't do it :p
 
apologies if I've missed this in the RFC, but what happens if you pass too many args to a partial that doesn't have a ...? do they get thrown away or passed somewhere?
function foo($a, $b, $c=0) { var_dump(func_get_args()); }
$partial = foo(?, ?); // requires two args
$partial(1, 2, 3); // is this foo(1,2) or foo(1,2,3) or foo(1,2,0,3) ?
I can kind of see reasoning for all three possibilities
 
6:43 PM
Throwing an error, hopefully.
 
oh, yeah, or that
 
<?php
function foo($a, $b) {
    var_dump(func_get_args());
}

$foo = foo(?, ?);

try {
    $foo(1, 2, 3);
} catch (Error $ex) {
    printf("%s\n", $ex->getMessage());
}

try {
    $foo(1);
} catch (Error $ex) {
    printf("%s\n", $ex->getMessage());
}

$foo = foo(?, ...);

try {
    $foo();
} catch (Error $ex) {
    printf("%s\n", $ex->getMessage());
}



$foo(1, 2, 3);
?>
 
I believe that errors now? It changed like 3 times as Joe changed his mind. :-)
 
too many arguments for application of foo, 3 given and a maximum of 2 expected, declared in /opt/src/php-src/compile.php on line 6
not enough arguments for application of foo, 1 given and exactly 2 expected, declared in /opt/src/php-src/compile.php on line 6
not enough arguments for application of foo, 0 given and at least 1 expected, declared in /opt/src/php-src/compile.php on line 20
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  int(3)
}
the words in these errors may change, I'm not really happy with them, but the error happens and has relevant trace information (line/file) ...
also, if you're hungry for details, look at tests in PR, they cover all of this behaviour ...
 
cool; just to be clear, the error's the same if the actual function could have accepted the third parameter, but the partial doesn't have a placeholder for it? as in function foo($a, $b, $c='some default') {...}
 
6:52 PM
the call must satisfy the prototype signature created as a result of application, it doesn't get as far as invoking implementation if prototype isn't satisfied
 
👍
 
7:33 PM
@Derick I mentioned a while ago that one of the more annoying things about Imagick was how many issues were not my fault, and not interesting to solve. Just found another nice example.
 
7:46 PM
looks like pretty cool effect, allow it, it's a feature, not a bug.
 
10:04 PM
indeed.mp4
 
@Danack The control flow graph is fantastic.
 
10:27 PM
 
what options are available from slowly migrating from passing an array to passing an object instead? two items from an "I wish this was present in PHP" list were method overloading and array to object conversion (that is, passing an array to a constructor and dynamically casting to an object instance) - but method overloading isn't possible presently (cont.)
and I vaguely remember scoffs (and myself scoffing) at the concept of array to object conversion
 
> If you're worried that this is still "jumping", the same effect could be achieved through pages aliased to the same address, wrapping execution around the upper range of memory,
 
@Tiffany What PHP version?
 
7.4 :(
 
Excrement.
Because union types and match() give you a really nice migration strategy.
 
10:33 PM
yeah :(
 
You can still do the same thing in earlier versions, you just can't type it.
 
@Tiffany one way would be to add an another function/method that takes the object, and make the existing function call that one, with appropriate object creation done, or converting from object to array for returning.
 
foo($obj_or_array) {
  if (is_array($obj_or_array) {
    $obj_or_array = Obj::fromArray($obj_or_array);
  }
  // It's now guaranteed an object.
}
 
then you can move every use of the existing function over...then eventually get rid of it.
 
Or what Danack said, depending on whether you want to rename the method in the process.
 
10:35 PM
it could be done, but I suspect we'd be on 8.x before migration is finished, unless I spearhead it myself... but currently behind on a couple other tickets, hmmm...
thanks for the suggestions, much appreciated
 
I think the deciding question is what other changes you want to make at the same time.
 
I've certainly been doing a lot of that XD
 
Like, do you want to change the signature in other ways while you're at it? Make a separate method and an internal translation layer. If not, the pattern I showed works.
 
yeah, there's a ticket that I'm on the tail end of completing that involved providing migration paths away from using a class's constructor, to eventually turn another object as a dependency for the original class. many TODO comments of "this code can be removed post-migration" in a couple classes, and about a dozen tickets opened for projects to change their code.
I suspect a lot of those tickets I will probably pick up myself once I catch up.
 
11:10 PM
A small benefit to doing it via a wrapping function/method, is that then you can use the "find uses" functionality in PHPStorm to ....find uses of the deprecated version, rather than having to either eyeball them or otherwise figure out if it's being called correctly.
 
A good point.
I think overall a separate method is better, iff you're OK with permanently renaming the method as part of the process. If not, for whatever reason, just internalize it.
 
And if you're okay with permanently having two functions if people don't complete the refactoring...
 

« first day (3882 days earlier)      last day (1052 days later) »