« first day (4067 days earlier)      last day (864 days later) » 

12:00 AM
if you add generics to Option, we have few problems.

1. this code will automatically stop working since return type Option is missing generic template
2. won't work as B is not A ( not saying that the code was sane before. )
 
I think the suggestion is more this:
I think the suggestion is more this:
 
the only way to get around this problem, is to make generic templates optional.

so if we have:

class Foo<T> {}

$a = new Foo();
// is same as:
$a = new Foo<mixed>();
 
function beep(): Option<A> {
  return Some(New A()); // Works now, but won't type check.
}

function boop(): Option<A> {
  return Some(New B()); // Will break in the future, as it should because you're just wrong.
}
 
class Foo<A = mixed> { } It feels like we could still check for the # of args even though the type checkng wouldn't be there
 
however, if the generic implementation allows constraints, and you add a constraint to it, it is now different, since

class Foo<T as string|int|float> {}

$foo = new Foo();
// is same as
$foo = new Foo<string|int|float>();
 
12:03 AM
@Crell no....some changes were needed as Bob added support for the functions to be called +() instead of __add(), but also some other changes/reverts.
 
@MarkR yes, if a constraint is not specified, it's the same as mixed.
 
@Danack Ah! Wait, do we actually want the methods called by their operation???
 
@SaifEddinGmati I would disagree, if there's nothing specified it should be an error.
 
@MarkR why? what else makes sense beside mixed as a default constraint?
 
If you want to have defaults, you should specify a default.
 
12:06 AM
P.S: HackLang generics were removed at runtime in the past, but Hack has a builtin type checker, when hack added reified generics ( generics that are kept at runtime ), they need a new syntax ( more specifically a new modifier )
I'm afraid PHP will have the same issue
 
I'm lost, how does that relate to defaults?
 
It relates to why it's pain to have syntax only, but for constraints, i think a generic template should always default to mixed to help migrate from non-generics to generics.
 
Disagree. If a class is declared generic, the author intends for you to specify a type. 99% of cases you want an actual type there, not just mixed. If the class was intended for mixed... it would just be mixed.
I'm far less interested in the inheritance Nikita showed there than I am instantiation time.
 
@Crell mixed constraint still means the class is using generics, but one of it's template types is generic 🤷‍♂️
 
Sure, which I don't see common enough to make it a silent default.
(Now it gets really interesting if we allow a generic to be populated by a compound type, like Foo&Bar|int.)
 
12:13 AM
@Crell yea, that makes sense in constraints like class Baz<T as Foo|Bar>
i just noticed Nikita RFC doesn't cover function-created generics :(
 
One epic multi-year effort at a time...
 
yea 🤞
doing

/**
* @var Channel\ReceiverInterface<string> $receiver
* @var Channel\SenderInterface<string> $sender
*/
[$receiver, $sender] = Channel\unbounded<string>();

would be super cool
 
The foundation is 20k away from hitting its 300k target
That's what... about 4 years of dev time?
 
I"d say 3 person-years, ish. Depending how it's spread around.
If the Foundation can sustain 3 FTE equivalents per year... that would be huge.
 
@MarkR 300k sounds like 2 full-time employees for one year to me …
 
12:27 AM
Depends if the Foundation is responsible for benefits.
Gotta go. Turkey time.
 
@bwoebi Depends on what they bring to the table I'd think. I've no idea how the foundation would work, a traditional business would certainly bring someone on at a lower wage until they'd proven themselves
 
since the people applying are already PHP contributors, i assume they would have proven themselves before being accepted, but idk 🤷‍♂️
 
Well there's quite a difference in expectations between an occasional contributor and a full time professional.
So I'm wondering if the first round of funding will go to people working on it part time, or for specific projects
 
@MarkR Depends what they are using to determine competitive market salaries. I would guess 2 people, or at most 3 people full time.
 
I imagine we'll find out eventually as the outgoings are all public I think?
 
12:38 AM
@MarkR yea, OC expenses are public
e.g: i spend all of my OSS donations on video games: opencollective.com/php-standard-library/expenses 😄
 
xD
 
I live in Tunisia, and i can't get an internal credit card, i have an international business credit card, but it's limited, so OC donations are for video games :p
 
 
1 hour later…
JRL
1:52 AM
@Crell I put it in Docuwiki yes, but I added a few things and updated some examples
and yes, I changed the format from function __op() to operator +()
since the main reason i never even considered that formatting is that i was unwilling to learn the parser to that degree
but since Bob offered and delivered on the patch for it, there was no reason not to do it
 
2:11 AM
what needs doing in order for a new translation repo to be created?
 
git init
I mean there's other stuff, but that definitely needs to be done by someone somewhere :-P
 
github.com/JSHar/doc-ka this is the start but ... ... not as much as I had hoped
dude said he had a team of ten able to do it ...
 
TIL: STDERR is both readable and writable 😶

https://twitter.com/azjezz/status/1466950834865029124?s=20
 
2:44 AM
@SaifEddinGmati this is cursed knowledge to not be spread.
2
 
2:57 AM
actually there's a valid use case, see: github.com/azjezz/psl/issues/299#issuecomment-985950550
 
JRL
3:41 AM
what is SSA in opcache exactly?
like what does the acronym stand for
stack size array? or something like that?
 
I'm guessing static single assignment, a common form in compiler tech.
 
JRL
ah, okay
yeah i dunno if i can fix the errors i made in the JIT assembly code. it's hard enough working with the assembly, but the C that is constructing the assembly is obtuse as well.
 
JRL
4:42 AM
wait, how do you write a test file for a compile error
or fatal error
oh, it works, you just don't get the comparison in the output
 
 
2 hours later…
JRL
6:40 AM
hey @bwoebi, when you have a moment, one of the tests is getting a memory leak error that's related to zend_objects_new(), and since that's related to the class def (and the class def changed with the parser change), i was hoping you might have some insight on where to start.
unfortunately gdb and valgrind say there are no memory leaks
but the test runner does
oh, actually nevermind. it's related to the reassignment operators somehow
 
7:10 AM
is it okay to output directly into the user's browser from the DB their $username without htmlspecialchars()? I mean I have filtered it, but my worry is that if someone got in into my DB
and use this for XSS, and should I even be doing something about this or just focus on strengthening against access to DB?
 
JRL
no fields that come from an external source should be displayed without santizing
 
You always encode on output
 
so like this or something htmlspecialchars($username) okay
 
Let's say you find a bug in your input sanitization, you patch it, so that can't be used for input anymore, but now what about everything that's already in your database that you let in with your old rules that may have exploited this?
 
JRL
htmlspecialchars is not santization
 
JRL
yeah well, it's wrong. that's not suitable to sanitize output.
 
i meant during output
 
JRL
there are libraries that do this good, and security is hard
 
by theway can I use both escape_string and preparing it?
 
JRL
i would look on packagist for a sanitization package
 
7:16 AM
I'll take note of that, thanks
 
When you output a string as HTML you're not sanitizing it per-se, you're encoding it. Security vulns of this class happen when you use one encoding in the context of a piece of code that expects a different encoding.

For example, a person's name is plain text, but if you just output it to the browser, it's going to treat it as HTML, because that's the encoding it expects, and you've not told it any different.
 
JRL
hey mark, do you happen to know if ZEND_ASSIGN_OP is the reassignment opcode? like += and -=
 
@MarkR makes sense
 
Equally if you take that same string that's plain text, and you shove it into an SQL statement without encoding it as an SQL string (escaping it) you get an SQL injection vuln, because it's expecting the data to be encoded as SQL, and it isn't.
 
and can I use both real_escape_string and prepared statement?
 
7:19 AM
You always do the encoding when you cross the context boundary
 
JRL
this is why there was the RFC for the is_literal
well, that wouldn't help the implementation here, but these kinds of questions in general
 
@JRL It loks that way based on the contents of zend_jit.c 1197
 
JRL
this is a really annoying bug tbh
apparently the compiler/engine just never expected that the left side of a reassignment operator would be an object
so there's an allocation for an object somewhere that isn't being freed
presumably because it's naively creating the tmp var assuming it'll never be an object
 
You're operating well beyond my ability to help im afraid
 
JRL
yeah, i get the impression that i've waded into some dark waters that most of the veterans have basically looked at and said "yeah, i don't touch that part"
 
 
3 hours later…
Wes
11:29 AM
shots fired
actually, bombs
nuclear ones
 
12:04 PM
o/ happy weekend all
 
Wes
12:19 PM
\o
first time i see round() has 3 parameters
 
I don't think I bumped into the use of 3rd param so far either
 
12:42 PM
huh TIL as well
> A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
 
Well that's not totally correct either because this is valid class 😭 {}
 
 
2 hours later…
2:26 PM
wiki.php.net/rfc/github_issues has been accepted \o/
4
 
2:54 PM
🎉
 
cmb
We should grant requinix appropriate karma for GH issue triage. Not sure if he is github.com/damianwadley.
 
3:43 PM
github.com/php/php-src/issues is now open, pls report any issues
Issues with the issues that is :P
 
4:12 PM
user image
8
@NikiC like that?
 
4:50 PM
@bwoebi In hindsight I think Nikita leaving should require an RFC.
 
5:14 PM
@IluTov And we'll make it fail with unanimous no, right?
 
5:26 PM
That RFC gives me GLaDOS vibes from portal. Sure, we merge their consciousness into a computer, but eventually they go rogue and flood the facility with a deadly neurotoxin.
 
Well, Nikita is a fan of tests...
 
O_O
 
@bwoebi Probably, except for Nikita :D
 
GitHub Copilot is so helpful for writing documentation! i listed all functions, wrote documentation for one of them, and then it started writing the rest with examples!
it gets a lost of stuff wrong, but i can still go through it later and edit it's mistakes, nonetheless, it's amazing
 
not sure if you're serious given the shit copilot was getting at the start >.>
and I can't tell the difference from the screenshot, my brain deceives me o_o
 
@Tiffany i'm serious! i haven't used it on work stuff cause i don't trust GH that much, but it's really useful for me when it comes to writing documentation for OSS
 
@SaifEddinGmati I tried it for a week but it got 95% wrong and caused me more cognitive overhead reading it, realizing it was wrong and just writing it myself. It's severely lacking context and just makes stuff up on the go (e.g. referencing classes/properties/constants that don't exist).
I think it could be better at documentation than code. But at our company we don't do that xD
 
yea, i don't trust it with code either, it keeps getting it wrong all the time, but turned out to be useful when it comes to documentation.
^ even this saves me time.
 
7:08 PM
I gotta say, the way that internal functions now fail when you pass excess arguments but user-space allows them sucks ass. Especially when trying to do anything with array manipulation.
 
what do you mean by " excess arguments"?
 
It takes 1 argument and you pass 2.
Like, say, an optional array key when doing a custom map or filter operation.
 
ah, got it.
 
@Crell if you wanted to make an RFC to fix it, the way would be to leave extra args on interfaces/classes still working. this is an annoyingly useful thing to do sometimes, as modifying the interface means having to touch every implementing class.
The same things not true for just functions, where you can modify just the one function.
 
I don't understand what you're doing there.
I cannot modify internal functions. :-)
Which means if I want to have, say, an array_map() equivalent that works on iterables and arrays, and passes the key as a second argument to the callable... it is incompatible with internal functions that only take one arg (don't care about the key), but works with user-space functions that don't care about the key.
Which is just all kinds of frustrating.
 
7:26 PM
i believe this is what you mean? 3v4l.org/SRPnb
 
Right, that thing.
 
I think that's the only thing where PHP core is more strict about than user-land lol
 
7:43 PM
I prefer the core behaviour, if you want to use extra args there's ...
 
Except I don't want to use the extra args. I want to ignore the extra args, and not have to have two separate versions of map, filter, reduce, etc; one that passes the key and one that doesn't.
 
@Crell Arrow functions are probably the best way to handle this. I'm probably the only one who still wishes they were shorter to make cases like this less tedious ^^
 
@Crell hmmm, yeah, I think you're right. Thinking on it more I use this behaviour near enough constantly in TS
 
@IluTov Um, remember who you're talking to. :-)
 
Not accepting extra params seems like the correct behavior. Otherwise technically adding a new optional param is a breaking chance which seems silly and counter intuitive.
 
7:53 PM
Being stricter about it and sending an error when something seems 'wrong' is my default preference, but I constantly use foo.forEach((val) => ...) and foo.forEach((val, key) => ...)
 
@MarkR Dropping params for closures actually makes sense though, contrary to normal functions.
 
I wonder if that would translate through if in Saif's example it was usort($data, strlen(...)) as it ends up as a closure.
 
@MarkR Hm, no (...) passes through all arguments.
Maybe closure wasn't the right word. Inlined closure, where you define your params directly and can't accidentally consume something you didn't expect.
 
JRL
8:22 PM
So, I think overloads are just about ready to open discussion on again
i don't think there's any more feature work
i have some annoying deep, deep engine bugs, but i don't think i'll be able to get the people who can actually help with that to work on it unless it seems closer to getting included
 
Surely this is not a unique/new question on SO. Does anyone know where the dupe is? stackoverflow.com/q/70222337/2943403
 
Man, AoC is kicking my butt the last two days...
 
@JRL can you link the RFC, I'm interested to take a look :)
 
@JRL The RFC needs some words on why a new keyword of 'operator' instead of function is the right choice, the impact that will have on tools, and also:
20 hours ago, by Danack
imo, i) The first paragraph only confuses people, and doesn't setup the rest of the text at all. The RFC is stronger without it.

ii) The Permissions example is probably bad there....it's a bit too much code that's too hard to read, and people are going to legitmately object to that as a use case.

iii) The 'Use Cases' section should be moved to FAQ, as it breaks up the flow, and people might object to some of the use cases.
 
@Danack thx
 
JRL
8:27 PM
two main bugs left:

1. somewhere, deep in the vm (I've mostly eliminated the compiler), when the ZEND_AST_ASSIGN_OP is called (reassignment like += and -=), a zend_object gets allocated with emalloc but doesn't get freed if an object instance is op1.
2. the assembly for the JIT opcache code that I wrote for ZEND_IS_LARGER and ZEND_IS_LARGER_OR_EQUAL opcodes has some bugs but i dont have the toolchains or assembly experience to truly bug hunt that
i think #2 has something to do with the swap variable in the JIT dasc code, which should be unnecessary once the opcodes are separated like this, but it also wasn't entirely obvious to me what code paths led to that variable being true
oh huh, i somehow missed your message yesterday @Danack
 
@JRL I'm not super fond on the enumset example. I think native support might solve this much better as it wouldn't require manual implementation for each enum. wiki.php.net/rfc/enumset
 
JRL
i think native support for enum sets is better too in almost all circumstances
but two things: 1. permissions is not a great example, but i can imagine enums that represent more complex things that shouldn't have the behavior of full enum sets, but might have some combinations (such as config option enums). 2. i didn't want to make assumptions about other RFCs with this RFC. for instance, if the ordering enum RFC that @Crell and i were working on got passed, I would come back to this and modify the operator <=>() so that it could return int|Ordering
that was more about illustrating the idea behind it, but i can remove the example and use something else
complex number probably since that doesn't have an example yet
 
I guess technically you could also return different types for custom operators. E.g. &ing two enums could return an instance of EnumSet. In that case it might make it possible to implement this in userland, albeit with traits.
Although to be completely honest, I think the bitwise operators make sense to C programmers because they're used to it but methods are still probably more expressive for most people. $flags->contains(Foo::Bar) instead of $flags & Foo::Bar. Or $flags->add(Foo::Bar) vs $flags | Foo::Bar.
 
JRL
8:43 PM
@Danack the intro paragraph can be replaced, but i feel like the RFC does need something there before it goes into the text you provided
 
Might also solve some typing questions like new EnumSet([Foo::Bar]) & Foo::Baz. What is the result? null? EnumSet with no values? That would evaluate to true in an if even if empty. contains could explicitly return a boolean. You'd use intersect or something like that to & values.
I guess that's solved by Bobs suggestion to override the coercion to boolean. Anyways.
 
JRL
9:05 PM
okay, the Permissions example was replaced with a ComplexNumber example
 
JRL
9:26 PM
k, and added a section on the operator keyword, though im sure it could use some feedback and refinement
 
10:25 PM
should the documentation here be updated to mention that php://stderr is read-write and not write-only? https://www.php.net/manual/en/wrappers.php.php

not sure if STDERR constant allows writing, but you can do $err = fopen('php://stderr', 'wb+');
yep, STDERR is also readable.
( STDERR as in the constant )
 
are they equivalent? in particular, is php://fd/2 different to that?
in terms of buffering layers etc I mean
 
no idea, i just learned about the fact that STDERR is read-write yesterday 🤷‍♂️
 
also btw afaik everything is readable, it doesn't really make a lot of sense to have write-only streams, they will always return the empty string I think?
I mean sematically it does but in general from the OS pov all fds are bi-di
 
no STDERR doesn't return an empty string!
it behaves exactly as STDIN, as in you can read user input
 
that surely falls into the category of "undefined behaviour"??
 
10:36 PM
php -r "echo fread(STDERR, 4), PHP_EOL;"
 
@SaifEddinGmati very confident that is not universally true cross-OS
 
let me check windows
 
Giddy, giddy, like four days until my dev machine arrives
 
failed with errno=9 Bad file descriptor under windows :D
 
@Tiffany in the intervening time, grind up your old machines and inject them directly into your veins to consume their power
 
10:38 PM
Nah, I'll still need Windows. And dev machine will be a laptop.
 
I didn't say get rid of windows, inject that shit direct into HOTKEY_TIFFANY
@SaifEddinGmati yeh stdio on windows is bare minimum :-P
 
@DaveRandom XD
 
no way
wait that's POSIX, MS abandoned that in the 90s
 
cmb
Windows is not really POSIX conforming anyway.
 
10:44 PM
exactly :-P windows is windows, it matters but only as an afterthought (in this context anyway)
 
https://unix.stackexchange.com/questions/574086/reading-from-stderr-in-c/574096#574096

> Reading from file descriptor 2 was frequently done for things like password input; before the /dev/tty device was introduced, around 1977. The reason for reading from file descriptor 2 was to obtain input from the original terminal when file descriptor 0 had been redirected elsewhere (as is the case in the middle of a pipeline, for example).
 
> 1977
 
JRL
anyone have an idea why a memory leak may be overlooked by valgrind?
 
in the context oif PHP, because zend mm was clever enough to spot the unfree'd mem block and reclaim it automagically (which would make said leak debatable whether it's worth fixing)
how do you know it's leaking without valgrind?
 
JRL
well, it's failing the test in make test because of it
 
10:50 PM
...suggesting that you have a specific error message?
 
JRL
yeah, hold on i'll grab it
 
@JRL what does "overlooked" mean? With the "right" bug, zend mm freeing (showing leaks) will occur earlier than the actual release - in that case it'll show up in zend mm, but valgrind will correctly see it as normally freed.
 
JRL
@bwoebi that might be what's happening i'm not sure. this aspect of zend im very unfamiliar with.
 
@cmb Thanks
 
^^^ this is what I actually meant expressed in one sentence
 
cmb
10:53 PM
@JRL pass -m to deactivate ZendMM for the test run
 
JRL
[Sat Dec 4 14:53:15 2021] Script: 'Standard input code'
/home/jordan/Projects/php-src/Zend/zend_objects.c(186) : Freeing 0x00007fcc01675050 (40 bytes), script=Standard input code
=== Total 1 memory leaks detected ===
 
@JRL yeh disable zmm as @cmb suggested to get meaningful output
"meaningful" = "shows you where shit gets free'd", you will still have to find the allocs :-P
 
JRL
huh
still nothing in valgrind with -m
 
nothing at all == you don't have a leak...
I feel a bit of XY here tbh, what are you actually trying to do and what is the error when you try to do it?
 
JRL
wait, -m isn't the option i want on the php executable is it?
that just shows a list of modules
 
11:02 PM
no on run-tests.php (I think)
afk ~15mins btw
 
cmb
something like make test TESTS='-m tests'
 
JRL
hmmmm. still nothing.
 
cmb
does the test runner output that valgrind is enabled?
 
JRL
valgrind marks them as still reachable in 7 blocks, but gdb finds no breakpoints
yes it does
 
cmb
oh, sorry, don't know about valgrind + gdb
 
11:09 PM
you might have found a weird problem. congrats! you are one of today's lucky 10,000 100 1
 
JRL
==5439== HEAP SUMMARY:
==5439== in use at exit: 19,100 bytes in 7 blocks
==5439== total heap usage: 38,794 allocs, 38,787 frees, 5,798,229 bytes allocated


==5439== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
(gdb) continue
Continuing.
[Inferior 1 (Remote target) exited with code 01]
wait wtf
This command failed the test and produced a leak that isn't a leak: /usr/bin/valgrind --tool=memcheck --leak-check=full --leak-resolution=med --show-leak-kinds=all --track-origins=yes --vgdb=yes --vgdb-error=0 /home/jordan/Projects/php-src/sapi/cli/php /home/jordan/Projects/php-src/run-tests.php -m /home/jordan/Projects/php-src/Zend/tests/operator_overloads/operator_overloaded.phpt
This command caused the tests to pass: /home/jordan/Projects/php-src/sapi/cli/php /home/jordan/Projects/php-src/run-tests.php -m /home/jordan/Projects/php-src/Zend/tests/operator_overloads/operator_overloaded.phpt
And this command fails the tests again: /home/jordan/Projects/php-src/sapi/cli/php /home/jordan/Projects/php-src/run-tests.php /home/jordan/Projects/php-src/Zend/tests/operator_overloads/operator_overloaded.phpt
this makes no sense, it only hits that line to create the zend_object once during the constructor
which has nothign to do with the += operator at all. in fact, that code gets executed long before the line for the += operator. however, if i comment the line with the += operator, it no longer produces a failure or memory error.
 
11:30 PM
> ...and produced a leak that isn't a leak
that is bad error messaging, sorry :-P
E_NOT_REALLY
throw new NotReallyALeakException('lol');
 
JRL
lol
well i dunno. im very confused about what the actual problem here is.
near as i can tell, this is just the normal way that objects are handled with $var = new Class(), and there's no dangling pointers.
 
@JRL this suggests a leak somewhere in the way that var assignments are computer maybe? especially would be interested to know whether $a = $a + b results in the same error as $a += $b
ftr I am going to bed, just to not appear rude :-P got shit to do tomorrow x
 
JRL
no worries, i do appreciate the feedback/help
have a good night
 
nn :-)
 
Wes
what was the syntax on 3v4l to include another paste on 3v4l?
require "/in/....."; doesn't seem to work
 
11:38 PM
pretty sure that's impossible, it's a pastebin not an app runner
/me actually sleeps
 
Wes
it used to work, 100%
gn \o
 
JRL
$a = $a + 1; does not produce the same memory error
 
Wes
@DaveRandom fyi :D 3v4l.org/eVtXJ
not quite the same as including another paste, but still... that's what i had in mind
 

« first day (4067 days earlier)      last day (864 days later) »