« first day (3500 days earlier)      last day (1438 days later) » 

cmb
12:19 AM
@PeeHaa finally it's how it supposed to be. :) If you wanted to run this code on older PHP versions, you'd do:
$call = "\"\"$command\" \"$arguments[0]\" \"$arguments[1]\"\"";
Or, preferably, you'd set bypass_shell=>true and skip the outmost double-quotes.
^ the outmost quotes inside the string
 
@cmb Did you just tell me to go fuck myself?
:D
Thanks though for letting me know
 
cmb
nope, I wouldn't dare to ;)
 
Much appreciated
I have it working perfectly on windows now. Only linux is being retarded
 
 
4 hours later…
Wes
 
 
2 hours later…
6:59 AM
Hey, i have a question to ask, is ti okay to ask here..
 
 
1 hour later…
8:02 AM
Git mergin'.
 
 
2 hours later…
10:24 AM
Doc Bulid problem ・ Doc Build problem ・ #79606
 
10:43 AM
One, how is that a doc build problem; two, isn't that just assigning NULL to an array instead of converting?
 
@Tiffany Apparently they don't understand the difference between array(null) and (array) null.
 
hmm... can you read INI settings in MINIT?
 
pretty sure you can...
 
i gues only one way to find out :D
 
10:59 AM
@Derick that's what I'm basing my assumption on..... I added an ini setting to allow people to skip over a warning message when Imagick is run against a different version than it was compiled against. github.com/Imagick/imagick/blob/master/imagick.c#L3747 and no-one has complained about it blowing up....
 
cmb
If it's about INI setting of other extensions, it depends on the loading order, I think.
 
It's only from within my own extension, so that's not a problem.
and it works - cheers
 
Request for notes: Please can people dump any bits of info they have about legacy cruft in how PHP handles requests.....e.g. things like max_input_vars, the magic behaviour around header() function, there's something to do with encoding of space to + rather than %20....
I'm trying to collate info related to what things should be cleared up for a new CGI sapi, just so all the info is one place, rather than distributed in people's heads.
 
11:58 AM
@IMSoP Some things can't be trivially explained. If someone tries to explain it in a small amount of time, it just doesn't produce a convincing argument to everyone. So, here is a story about a plane accident, where the fact that any people on the plane survived is surprising, and that the majority lived is astounding: youtube.com/watch?v=S2FUSr3WlPk
Every passenger on that plane has a high level of interest in figuring out how to land safely, but if they were all trying to stick their head into the cockpit and shout their advice at the flight crew, even though they were all trying to help, there is not going to be a good outcome from letting them all shout.
But recognising that one of the passengers has a very high level of knowledge of the plane, and inviting him into the cockpit did have a great benefit. With him on the throttle, the flight crew had more spare brain-power, which would have helped the situation.
The statement "Yes, we can see you want to help, but you aren't by taking part in this conversation." is a thing that can be both true, and at the same time slightly rude to say.
I really don't think the internals email is a good enough tool for communication to figure out what should be done about the PHP libraries. Also, that conversation would need to involve people who have sufficient understanding of what is happening internally, and the problems around distributing and installing software for it to be even minimally productive.
Trying to start that conversation from "Hey, why don't you use phars!?" is not a good way to setup that conversation. If nothing else, it would be far more productive to ask questions that help people understand the problem space, rather than throwing out possible solutions.
 
12:35 PM
I've created a match v2 draft. I removed blocks, secondary votes and massively simplified the RFC (from 550 to 180 lines).
[RFC](https://github.com/iluuu1994/match-expression-rfc/blob/v2/match_expression_rfc.md) - [Diff](https://github.com/iluuu1994/match-expression-rfc/pull/8/files)
Unless there are objections I'll announce it in a few days.
"Markdown", yeah right.
One area that could still be improved are real world examples. I might add a link to a gist with a bunch of examples from various repos.
 
@IluTov it gets disabled when you go multi-line.
 
@Tiffany But why :(
 
¯\_(ツ)_/¯
 
So I'm looking into Autoconf a bit (yes because I'm a masochist) and I'm confused about of setup in php-src, we got a Makefile.global but I can't see any references about it in the docs (of Autoconf) but I see loads of Makefile.am, does that mean we should convert/rename the Makefile.global to Makefile.am?
 
12:51 PM
PHP doesn't use automake any more, only autoconf
 
Ah, this explains that
 
And the Makefile.global is a PHP build system idiosyncrasy
 
Any explanation as to why? (cause I don't know shit about it)
 
Why what?
It's a bunch of rules shared between PHP, and extension building with phpize, I think.
 
Well why it's an idiosyncrasy?
 
12:58 PM
oh, I meant "invention", I suppose
 
Ah okay ^^
 
 
1 hour later…
2:12 PM
Hmmm https://github.com/php/php-src/pull/5578

`
guard ($condition = false) else {
//code
thrown new \LogicException();
}
`

Isn't it kinda funny that the _guard_ example, allegedly to empower defensive programming, seems to contain an assignment by mistake? 🤔
 
Btw @MátéKocsis do you have a list of extensions we went through for Warning to Error promotions?
 
Wes
2:31 PM
ha @marcio :D
oh maybe they just wanted to give a name to "false"
if($condition = false); else{

}
i hope we don't go on that route again, "adding stuff just because". that being said, i haven't read the rationale for that yet. seems a very redundant thing to have tho
 
Yup. I suspect that one will go down in flames if brought to a vote
 
The people who use Swift seem to like it: ericcerney.com/swift-guard-statement
Though one reason why it's so useful in swift seems maybe less useful in php:
> If the condition passes, the optional variable here is automatically unwrapped for you within the scope that the guard statement was called – in this case, the fooGuard(_:) function. This is an important, yet notably strange feature that really makes the guard statement useful.
 
I don't see the reasoning behind the recent fascination with putting the logical check after the operation.
 
3:05 PM
@Danack The feature actually has a use in Swift though, unlike in PHP
I think one needs to view "guard let" as the inverse of "if let", which cannot be elegantly achieved without a dedicated language construct
The fact that in addition "guard" exists as the inverse of "if" is just consistency. But it's not where the usefulness lies.
 
Wes
@NikiC there's something i would've liked that declaration and assignment of properties in constructors did
in theory you should call the parent constructor before doing any assignment
that's what C# does for example, if i recall correctly
 
@Wes Correct. It does not really matter in PHP though
Constructor ordering is very important in some language (C++ probably the foremost), but it seems to be mostly irrelevant in PHP
 
Wes
it does not in most of cases, but feels nicer to do so
for example
is this allowed? imagine bar() requiring to be constructed in the parent class

public function __construct(public Foo $foo = $this->bar()){
    parent::__construct(42);
}
no that's not possible, right?
 
@Wes It's not possible at present at least
It could potentially be possible in the future, but it's on very thin ice
Especially if you consider that the parent constructor call likely also needs arguments from your constructor
 
Wes
indeed
i don't think $this in default arguments should be allowed at all, i am mixing different things. it's not default values of properties but default arguments
for the reason that $this is not available to the caller if arguments were passed explicitly
so c# doesn't allow any transformation to the variables when calling the parent constructor?
ah no you can:
public Foo(string message) : base(message + " baz")
 
3:54 PM
-_-
 
Wes
4:22 PM
\o @Leigh
 
@Wes o7
 
Wes
all good? you disappeared for a while, right? i can't tell because i disappeared too :P
 
Disappeared? Naaaah. I just went away :P
I'm alright. You still cranking out art?
 
Wes
no, just 5 year old drawings :P
how affected is your area? live in a big city?
 
nah, London
 
4:37 PM
is it possible to mock only some dependencies of a class and instantiate the real versions of the rest?
i have a class that has a lot of injected dependencies and i'm only interested in mocking 1
 
yes
only mock one
job done
 
yeah but the class won't instantiate if i don't pass the others into the class
 
so instantiate them without mocking them
 
well that would involve me having to construct those manually
and it could be a long chain
 
sure
but that's what you asked
is it possible to mock one? yes, mock one. You still have to do the real work for the rest
 
Wes
4:50 PM
@Leigh lol :P
@RobertCalove yes, it's up to you whether it's an acceptable risk. if dependencies are thoroughly tested and simple, why not
if constructing them is a problem you can use fakes, that is simple implementations of the actual things
i.e. new FakeMailSender() vs new ActualMailSender(), where the former just logs the mails it's supposed to send without actually sending them
then you verify by doing self::assertSame($expectedMail, $fakeMailSender->sentMail);
 
 
2 hours later…
6:45 PM
@NikiC Greetings. Can you expand on your comment here? https://github.com/php/php-src/pull/5425#discussion_r411953366

What specifically do I need to change here? Plus there's apparently still a test fail, but I don't know if it's from my PR or not.
 
@Crell You need to add a tests that actually prints the AST, like here: github.com/php/php-src/blob/master/Zend/tests/arrow_functions/…
 
Interesting... Using assert() as a backdoor way to print the code as the engine sees it?
 
Yep pretty much
 
7:18 PM
Bleh, for the instrumentation hooks I have a sigsegv on every platform CI builds on... but not my local machine. Annoying.
 
@LeviMorrison i have it locally as well from my opcache jit build test
 
I just rebased on master and force-pushed, btw; were quite a few commits behind.
@beberlei Where everything segfaults or only jit?
 
Is there a reason why we don't track parentheses in the AST? The printer has to track operator precedence, if we tracked parens that would be solved automatically. Also, some things are printed incorrectly right now ((function () {})() is printed as function () {}()).
 
7:47 PM
I'm just gonna try it.
 
@IluTov Because it then no longer trivially holds that $x and ($x) behave the same
We don't really care about the pretty printer anyway. If the investment wasn't already made, I'd just throw it out and use the code as written in assert().
 
@NikiC Alright :)
 
8:13 PM
@kelunik probably an opportunity to push amphphp on internals: externals.io/message/110188
 
Anyone aware of a really nice container for compiling php-src? As in, don't have to install any deps?
 
@Danack It's a related problem, but what's really asked for is a preemptive timeout, while Amp only offers cooperative timeouts.
 
@kelunik they appear to be wanting to use it while doing rest requests....and amp would solve it for that adequately right?
 
8:31 PM
yesterday, by NikiC
whew, not enough rfcs to break jeeves yet
you may have jinxed it.
 
8:54 PM
Wrong return type ・ Filesystem function related ・ #79607
 
I just built the instrumentation API in a Debian image -- also no segfault. It must somehow be poorly interacting with certain build flags (that apparently every build in CI uses?)
Any ideas? /cc @NikiC
I mis-spelled zend_extension when enabling opcache; okay, can reproduce it now.
$ phpdbg -p* tmp.php
function name: (null)
L1-5 {main}() /usr/local/src/php-src/tmp.php - 0x7f7463264380 + 4 ops
 L3    #0     INIT_FCALL<1>           96                   "var_dump"
 L3    #1     SEND_VAL                "hello"              1
 L3    #2     DO_ICALL
 L5    #3     RETURN<-1>              1
Program received signal SIGSEGV, Segmentation fault.
0x00005631b557f845 in zend_instrument_call_begin_handlers (execute_data=0x7fd900614070, cache=0x0)
    at /usr/local/src/php-src/Zend/zend_instrument.h:64
64			cache->handlers + cache->instruments_len;
(gdb) bt
#0  0x00005631b557f845 in zend_instrument_call_begin_handlers (execute_data=0x7fd900614070, cache=0x0)
    at /usr/local/src/php-src/Zend/zend_instrument.h:64
#1  0x00005631b5581370 in execute_internal (execute_data=0x7fd900614070, return_value=0x7ffca7dbe410)
At this point, execute_internal expects the zend_instrument_cache to be initialized, but it's not.
Happens when -d opcache.jit_buffer_size=16M is added.
My first guess: I assume the JIT does something for INIT_FCALL (this is where we init the cache) or for var_dump specifically?
Not sure how to approach debugging this. /cc @SammyK @beberlei
 
9:36 PM
Hm. Well, this is interesting.
assert((5 |> '_test') == 99); // This is giving me a syntax error in a test that > is unexpected... yet all of the other tests pass on a clean build, so it's definitely building with the pipe support.
 
Did we elevate assert to a language construct? I know we wanted to make it so nobody could write their own assert function, even in a namespace.
If so the grammar might be forked somehow.
 
That... would be unpleasant.
assert did become a language construct in 7.0. I have no idea what the implications of that are, however.
asserting with a string works, however. Ugh.
Or rather... produces no output or parse error. Which is actually not what I'd expect it to do.
 
@LeviMorrison Yes
7.0.0 assert() is now a language construct and not a function.
 
Great. So... how do I adapt it to make new syntax inside an assert() work?
 
I can't help you with that, as I have no idea and I should be revising some Group and Ring theory for my exams
Also the string assertion was deprecated so it should be removed on master, but may want to check that it's actually the case
 
9:49 PM
@Girgias wat
docs are just wrong, as usual...
 
That's what the changelog says
Welp
 
assert() is still a function, with some special semantics
 
Well that's weird that it got changed then, because IIRC these changelogs are based on what is written in the UPGRADING file
 
@NikiC Special enough that I'd need to do extra work to make a pipe operator behave inside it?
 
@Crell no
 
9:52 PM
Hm. Then I don't know why I'd be getting this error.
 
@Crell me neither, makes no sense
 
Oh good. That makes me feel better. :-)
 
Btw @NikiC what do you want to do about TSRM_ASSERT? And did you have a look at this magic I decided to introduced for ReflectionParameter::__construct()? github.com/php/php-src/pull/5534
 
I'd uh double check that it's really valid code. Like, that the | is not some weird unicode character or something
 
Nope. Just retyped that line from scratch. Definitely no funky extended characters.
... Wait, no, I'm just an utter moron.
 
9:57 PM
@Girgias not a fan of the reflection change
It's close to a callable, but it's no one, so imho we shouldn't be pretending it is...
The callable concept is already gnarly enough without introducing special cases like this
 
Fact...
 
@NikiC Yeah, I didn't think about the fact that it was possible to reflect a non-static methods (which obviously should be the case) and decided to see if I can without thinking if I should :D
 
OK, the error message for the assertion 1) Is showing the post-modification code, so "_test(5)". 2) Is also not matching because of the file and line number, which I'm unclear how to placeholder. The sample that @IluTov linked to above is using %d and %s in the error, but that seems to still fail.
 
@Crell You you using EXPECTF?
 
That would do it.
<-- demonstrating his newb status.
 
10:02 PM
And true, callable is a special kind of thing already without this weird case, but the ZPP check was failing if I used the callable typehint which was pretty confusing to me, but with a bit of hindsight it's probably accurate
 
OK, so now the question is what to do with that. Presumably we'd want the error message to show the |>, not the modified version. Hrm.
 
@Crell The amount of times I forget to change the section from EXPECT to EXPECTF if and then not understand why the tests fails is way too often...
 
:-)
So this is where the flag I'm adding would be useful. But... I'd need to check it somewhere. Where would I look for that?
 
@Crell In zend_ast.c
Whatever node you're setting the attribute on, you can check whether that was originally a pipe operation.
And then print it the correct way.
 
10:30 PM
Is there a reference for the functions that can be called from the giant case statement? Or do I just guess what they do?
 
@Crell Not sure what you mean, what do you need?
 
Well, looking at the code that's already there, my first guess is gist.github.com/Crell/1e858f0e361575dd546757333acc9863 . (The else clause is what's there now for ZEND_AST_CALL.) However, there are a couple of different variants of every one of those functions so I'm not sure which I should be using. (smart_str_appends, smart_str_appendc, etc.) And that code of course compile errors on me.
Assuming that routine is even doing what I am guessing it does.
 
zend_ast_export_ex(str, ast->child[1], 0, indent);
smart_str_appends(str, " |> ");
zend_ast_export_ns_name(str, ast->child[0], 0, indent);
Can you try that?
The position and if check looks fine. Do you have a debugger? You could also check if the if condition is true.
 
Same error. arg 1 of zend_ast_export_ex from incompatible pointer type.
Not a C debugger.
 
cmb
@Girgias but nothing about expectations/assert is written in UPGRADING …
 
10:39 PM
@Crell Try it :) It helps tremendously. It's really easy to set up lldb in VSCode or most other editors.
 
I'm in IntelliJ.
(This is the only C code I ever touch at this point.)
 
@cmb SVN blame
 
Would a debugger even help with just a compile error?
 
cmb
I've already blamed SVN
@Crell nope
 
@Crell No I mean just in general
@Crell Can you send the whole error?
 
cmb
The code in the else branch appaers to be correct (zend_ast_export_ex(str, …)
 
@Crell Yeah, you're missing the str argument
 
Yeah, the else is what was already there in master.
 
Look at the code I sent above :)
 
sigh
Now it compiles. I should try to avoid coding on weekends, it seems...
 
10:48 PM
Ah you're fine. Every beginning is difficult.
 
cmb
+1
 
Ah, bingo!
OK, that's updated and pushed. Thanks!
I... think that's the code for the pipe done; now it's just a question of if I can figure out how to do partials before calling a vote on pipe, since that seems to be a blocker for some.
Thanks, @IluTov!
You wouldn't happen to have a good idea of how to implement Levi's partial application RFC would you?
 
@Crell No problem! Nope, I've only skimmed the proposal. Levi also has much experience with the code base so if he can't come up with a solution I doubt I will.
 
Exciting. I likely have no hope on my own then. :-/
 
What are the main obstacles?
 
11:04 PM
Aside from the fact that I don't know what I'm doing? I think the first step is detecting a syntax of functionName(?).

Once that can be hooked into, then my inclination is to process that into a closure, but Levi and Nikita felt there was a better way that would allow preserving the types without doing C-level reflection.
 
I would assume you'd need new instructions that mimic a function call but instead of calling a function return a closure. Initially I thought that maybe this could be implemented solely through the parser by rewriting it to closure syntax (like @IMSoP suggested) but Nikita mentioned that this wasn't feasible (I don't remember the reason why).
> I think the first step is detecting a syntax of functionName(?).
That shouldn't be too hard. In zend_compile.c before compiling a function call you'd loop through the arguments to see if any of them is a ? AST node.
You need to return a closure at some point (correct me if I'm wrong), I think the question is whether to transform the AST or to create new VM instructions.
 
:thinking face emoji:
Well, part of the goal is to have the new function inherit the parameter and return types automatically.
 
11:20 PM
Oh I see, so you can't transform the AST because you only know the function signature at runtime. But either way, the new instruction should probably generate a closure on the fly (with the correct parameter types and return type). Do you have a link to Nikitas statement so I can verify my statement?
 
"LeviMorrison Crell Without having thought too much about it, I think the most promising approach would be to mostly leave it as a normal function call and only add one custom SEND for the placeholders and a custom DO_FCALL opcode" - That's all Nikita said that I have written down.
So I've found zend_compile_call(), which seems like the place to be. But, if one of the parameters is a question mark would it have errored out by then?
 
@Crell What do you mean by errored out?
 
Well, if you just write foo('baz', ?) now, you'll get a parse error today. I don't know if that parse error would happen before zend_compile_call() gets invoked.
Presumably whatever we do has to happen before that.
 
Well, you need to add support to the parser first.
That's gonna stay, regardless of the rest
 
Ah. That's another part I've no idea how to do. :-)
Or rather, I saw how to add the |> operator, but it seems like the ? would require an extra lookahead logic.
Hm. I wonder if Sara's old PR has something useful in it.
 
11:29 PM
I think that's mostly what you're looking for. Additionally you'd allow ? there and return a new AST node.
 
github.com/php/php-src/compare/master...sgolemon:pipe.operator - Here's Sara's original code. Does that seem vaguely reasonable? (I have no clue if it would even still apply in the slightest.)
I understand maybe a quarter of it, if I'm being generous.
Although that version does both |> and the placeholder at once.
 
@Crell Yours is not quite the same, in hers $$ was unrestricted to the entire expression. In yours ? is restricted to exactly the argument of a function. Thus I think argument is the right place to put it.
(I'm still talking about the parser)
 
Ah, so add a 3rd possibility to argument, which is whatever the existing ? token is?
 
@Crell Exactly
 
Huh. If I read this right, ? doesn't actually have a token? At least not in zend_language_parser.y.
 
11:43 PM
@Crell Just '?' should do it.
 
/shrug
So that would then map to {$$ = zend_ast_create(some new ast value) } ?
 
Yep
 
OK, so I've got this:

argument:
expr { $$ = $1; }
| T_ELLIPSIS expr { $$ = zend_ast_create(ZEND_AST_UNPACK, $2); }
| '?' { $$ = zend_ast_create(ZEND_AST_PARTIAL_PLACEHOLDER, $1); }
;
And then I added ZEND_AST_PARTIAL_PLACEHOLDER to zend_ast.h
 
No need for $1
 
OK...
 
11:48 PM
Also, make sure to add ZEND_AST_PARTIAL_PLACEHOLDER under the "no children" section
 
Yep, it's there.
 
Ok, give it a try :)
 
Does C support variadic parameters, or is that another part of the meta macro that is Zend?
 
It does but in a very ugly way ^^
 
OK, ran a make clean, now running the tests I wrote before. We'll see what explodes.
twiddles thumbs
 
11:50 PM
If you get a compilation error, that's good. :)
Anyway, I'm off to bed. See you tomorrow
 
Thanks! I'll likely be around again tomorrow with more questions, if you have time. :-)
 
👍
 
@Crell you need to look into va_args for variadics, but you can't really deconstruct the "array" back into an argument list (well there are ways, one example on the top of my head is a PHPBDG macro which uses a special attribute)
 
I'm perfectly OK not supporting variadic partials.
 
Oh for PHP functions, don't know how they work, I was thinking of C function variadics
 

« first day (3500 days earlier)      last day (1438 days later) »