« first day (4323 days earlier)      last day (618 days later) » 

9:24 AM
@FĆ©lixAdriyelGagnon-Grenier Spot on joke, I like it šŸ˜‚
@cmb @RemiCollet I'll start the tagging, sorry for the delay
 
 
3 hours later…
12:18 PM
Morning Room!
 
12:30 PM
@cmb I've just released a new version of ext/scrypt. How does the DLLs get generated? Are they build automatically, right? My other question is whether package.xml should list all non-C source files like stubs and tests? E.G. ext/mcrypt doesn't include stubs, while ext/redis does. They both do include tests.
 
cmb
@MateKocsis The DLLs are supposed to be built automatically, but the build machine died and there is no alternative yet. Regarding the file: all files that are supposed to be distributed should be listed in package.xml. Test should definitely be; stubs are debatable, but may serve as some documentation.
 
@cmb Thank you!
 
@cmb I think stub should be part of the archive
(at least this is really sources, and may help dev if some patch needed)
hmmm.... pecl download scrypt don't find 1.4.3
 
 
2 hours later…
2:28 PM
I have an associated array which is sorted correctly. Now I just want to move key "x" after key "m" without changing anything anything else. Is their a clever trick to do so?
 
2:45 PM
@CodePanda you could use one of the array sorting functions, probably uksort and reorder the whole thing Really Correctlyā„¢.
or, maybe order the whole thing correctly in the first place
 
@CodePanda clever trick = writing some dumb code: gist.github.com/Danack/e60e18c76ae5216618760fedaf8389d3
that has edge-cases that are untested for btw.
 
@FélixAdriyelGagnon-Grenier It's coming from the MySQL database. I can edit the query but I don't think it's doable there
 
...dunno why I used a gist there. 3v4l.org/d5Iek
 
@Danack Thanks, I will try it. I am mostly for 1-liner hacks :D
I don't think they exist for this case I guess
 
@CodePanda I'm on a journey to try and understand what folks like in one-liners; purely by curiosity, what's the positive aspects of one-liners for you?
 
2:59 PM
@FélixAdriyelGagnon-Grenier They make you look smart. Even though it's the opposite šŸ˜†
 
hah! fair enough :P
 
But tbh, I feel less code is better code. I would rather use a one-liner and add a comment describing what it does.
 
> I feel less code is better code.
It's actually harder (by a huge amount) to maintain dense code.
 
I know. Just force of habit
 
You might be confusing people writing too much stuff into single functions (instead of splitting different concerns into separate functions), but here you want a single operation....write a single function, that can be easily read.
People can't make you make better choices. But we can take the piss out of you for making choices even you acknowledge are probably bad.
 
3:11 PM
unrelatingly, I can't stop laughing at Mark's comment of making the engine throw a random exception when using RandomException
can you imagine the mayhem? glorious
 
3:27 PM
Ehm, how come false = 0 in array access? $b = ["moo"]; $a = $b[false];, then $a === "moo".
 
@OlleHƤrstedt Because array keys are just string and integers, so false gets coerced to 0
 
@Girgias Implicitly? Weird.
 
@OlleHƤrstedt yes.
 
@OlleHƤrstedt yes? Have you just discoverd PHP or what lol
 
And null to "", it seems
 
3:30 PM
Also an integer string like "7" gets converted to an int key but not float strings like "15.25"
But 15.25 gets truncated to 15
 
@OlleHƤrstedt this is firmly in the "unsollicited advice" category, but yeah, being fluent with type coercion in php is helpful to php endeavours, generally
 
@FĆ©lixAdriyelGagnon-Grenier I'll just slap Psalm on it
 
Which isn't going to help you with the string to int implicit coercions but whatever
Strict type was a mistake due to a bunch of PHP internals shenanigans
 
@Girgias you mean the declare(strict_types=1) thing? could you elaborate? for me it helps more than it hurts, I think?
or would you rather it be an actual engine-enforced thing?
 
3:36 PM
why do I get an ominous feeling there's ample context in the internals mailling list somewhere...
 
@FĆ©lixAdriyelGagnon-Grenier github.com/Girgias/unify-typing-modes-rfc, is something I wrote years ago, I should go back to it as I've got some more examples of where strict types goes wrong
 
@OlleHƤrstedt psalm.dev/r/81995c6918 :)
 
@Girgias It's the same code?
 
@OlleHƤrstedt psalm.dev/r/3f13ec83ab
Didn't click the "get link"
 
3:39 PM
Sure, 5 to "5"
 
Nope it's "5" to 5
 
Still, better than before
 
Sure, but psalm cannot catch those
As you'd need to do value analysis
And if you assume every string key you get for an array will be returned as a string key then you are wrong
And people assume that and slap strict_types and then complain about the TypeError violation
 
That's why I'm inventing a new language - Pholly :D
 
gl
 
3:43 PM
that is folly
 
I've tried and failed before, with a subset of PHP
 
 
1 hour later…
4:49 PM
psalm seems to support this behavior more than I expected. psalm.dev/r/aa68f23361
 
5:02 PM
Maybe we need a type annotation like non-integer-string though psalm.dev/r/236cf49543
 
Who's up for investigating a 9+ year old php bug / anomaly?
I was almost done with some task when I got hit with this: https://bugs.php.net/bug.php?id=57378 (also check the comment in the end)
Ideas anyone? :|
 
Has anyone who has used both something like phinx for managing DB changes, and also just applying changes via normal SQL queries got something inspiring to say to me about not just giving up on managed migrations, and just doing it all myself...
Feb 25, 2021 at 15:00, by NikiC
And for SPL in particular, the solution is of course to create a new library and burn SPL with fire
But I do like your optimism.
@Christian Before even looking at the internals of it, I really would not be sure about what guarantees can be made about iterating over directores.
I saw a similar issue, where cloning a directory iterator "cloned" (aka copied) the internal directory information. But there is zero guarantee that a filesystem would return the same entries in the same order. If I recall correctly, there are some secure filesystems that explicitly randomise the order of things, to prevent people from being able to pass information through manipulating file names.....
 
@Christian That's not a bug AFAIK, the iterator doesn't know it's at the beginning, so when you try to convert it to the beginning it needs to rewind to the beginning, which can't really do on such a stream
But you could also use PHP's FTP extension by opening a secure connection and then php.net/manual/en/function.ftp-rawlist.php
Gives you a recursive array I think
 
5:18 PM
Thanks for the replies, however I still don't fully understand the problem.
My assumption is that the iterators are using opendir and so on internally, right?
@Girgias Thanks, I was trying to avoid that to cleanly use PHP's streamwrapper stuff to handle other scenarios (this same code should theoretically work with other wrappers like s3 and so on).
 
You are trying to rewind a network (key network) stream
Most streams are not rewindable
Then.. don't use SPL if you want to cleanly use PHP's stream wrapper....
SPL is hot garbage
 
super confused right now
so, I get the idea behind a network stream, but in this case, isn't it just a LIST dirs FTP command?
 
How can the iterator know that?
It can't
You are making an assumption on the type of stream, if you are going to do that, then just use the dedicated tools
 
Presumably because the iterator has received a fixed array?
 
> because the iterator has received a fixed array
 
5:24 PM
Why on earth are you assuming that
 
hilariously, no. or at least the normal filesystem iterator doesn't.
 
Because....ftp? :D
 
10 mins ago, by Danack
I saw a similar issue, where cloning a directory iterator "cloned" (aka copied) the internal directory information. But there is zero guarantee that a filesystem would return the same entries in the same order. If I recall correctly, there are some secure filesystems that explicitly randomise the order of things, to prevent people from being able to pass information through manipulating file names.....
by "the internal directory information." I meant the filehandle that opened the directory, not an array of what was read.
 
@Christian AGAIN, you are assuming the underlying stream and some fantasy implementation behaviour
The iterator is generic, and thus doesn't know what it gets, and I would assume it's just a streaming iterator that doesn't even do an FTP list command
 
And then the SPL code advanced the count of which entry was being read, with the assumption that the file entries would be returned in the same order for the directory filehandle. It didn't read it all and store an array.
I've never tried this - but I think you reading the directories yourself, and then creating a array based iterator is more likely to get your code working how you want rather than waiting for spl iterators over sftp to be reliable.
 
5:27 PM
morning all
 
I think that's also what @Girgias suggested.

I'll go for that approach, feels like it has a higher chance to work.
 
<?php
var_dump(Closure::fromcallable(function (): void {})->call());
Fatal error: Uncaught ArgumentCountError: Closure::call() expects at least 1 argument, 0 given in /in/iij8Y:3
What am I doing wrong? There is no reason to pass $newThis
 
I don't think it's optional.
 
@brzuchal "Temporarily binds the closure to newThis, and calls it with any given parameters." - so you don't need to call call() ?
 
... why are you even calling fromCallable?
 
5:30 PM
Callable, hmmm
 
@Girgias I guess it's just a quick example..
@brzuchal in that case just invoke it directly, no need for call().
 
I wanted to check if calling an unknown closure that has void return won't crash on asignment
 
var_dump(Closure::fromcallable(function (): void {})());
 
@Girgias 3v4l.org/K54TH OK I think that explains
even if it's void the result is null
 
5:32 PM
that is correct
 
Yes, because PHP functions always return a value
 
Ok, then I'm safe, thx
 
Anyway, @Girgias @Danack thanks for the help.
 
A ctor cannot be a closure, right?
 
People on Reddit are saying that they can't subscribe to the mailing list.
Can someone with admin privileges check if there's an error logged?
 
5:33 PM
No worries, and remember stay away from SPL if you can :p
 
:D
 
@Dharman If they are using this form php.net/mailing-lists.php then it's been broken for ages
 
@brzuchal it's a normal function with some magic, so yes
 
@Girgias Can you point me to the actual error, so that I can fix it?
 
5:35 PM
 
@Dharman I don't know php-web as well as you do, so no idea, but signing up by email (towards the bottom of the page) works fine normally
 
@Trowski Indeed, did the same, but you always have to have the object created first 3v4l.org/Mh5MZ
 
aha, but it does not create new instances: 3v4l.org/hqi3M
 
no it doesn't
just runs the ctor statements again
 
exactly
it's also non-static, so yes, you need an instance first
However, for more fun times, you can create an instance without calling the constructor (using Reflection) and then call the constructor later. :D :D
 
5:40 PM
It looks like in Java's reflection a Method and Constructor extends Executable directly and Method has invoke method but Constructor has newInstance method
Doing some port and was wondering how to translate that to PHP reflection
 
Perhaps you are looking for this? php.net/manual/en/reflectionclass.newinstance.php
 
@sj-i Thank I already new that. The only thing was concern about nuances
 
cmb
6:00 PM
@Christian Note that the ftp and ssh2 stream wrappers are maintained separately, and as such this might have totally different reasons. However, I think it is an issue with the iterators; IIRC, they try to rewind twice, and that triggers the warning. I think there is a bug report about that, but can't find it.
 
@Girgias I think this has been fixed in the past six months
Six to twelve months
There was an issue someone encountered in the past couple months where their email was considered spam and they had trouble subscribing. But, it eventually went through fine.
cc @Dharman ^
 
 
1 hour later…
7:32 PM
@cmb šŸ‘
on a side note, is that doing what I think it does? a persistent connection across stream wrapper calls? (with a preset context)
 
 
2 hours later…
9:30 PM
@Danack A man after my own heart. Honestly, I try to keep it short, but if I have to spend too much time trying to figure out how to make it simpler, I've already typed up something that will work and I can shore it up later when I refactor... in 2-3 years...
 

« first day (4323 days earlier)      last day (618 days later) »