« first day (4267 days earlier)      last day (696 days later) » 

12:34 AM
Is there a way to intercept the headers function? Because I'm tearing my hair out with a bunch of libraries that think it's good design to mandate sending them within their own functions (I need to wrap them in a response class)
 
You can use disable_functions and redefine a userland implementation for it as of PHP 8.
 
An interesting idea, although unfortunately not on 8 yet
 
12:52 AM
Hmm
 
1:05 AM
The php.net favicon updated. How late am I to notice?
It seems 12 days. Not bad, given that I was traveling all last week and yesterday was holiday for me.
 
 
2 hours later…
2:55 AM
@LeviMorrison i relalized today as well, the new one is rally great modern take
@MarkR use github.com/krakjoe/uopz or if you need production, write your own litte extension overwriting the header internal pointer
 
 
5 hours later…
8:04 AM
@LeviMorrison Indeed, I haven't even notice that.
 
 
4 hours later…
12:18 PM
o/
 
\o
 
12:53 PM
\o
 
1:13 PM
@IMSoP No doubt a terrible design flaw which I want to erradicate, instead of using proper db relations they just serialize a bunch of things in DB
RFC: Remove serialize and unserialze xD
 
hi
 
2:01 PM
How convert 91 (minutes) to 1h 31m ?
 
% 60
 
2:25 PM
3v4l.org/m3PU6 good enough ?
 
Morgens
 
2:41 PM
moin moin
 
TIL Stringable passes string type checks when not using strict types, and I feel cheated now for using strict types all the time.
 
Jesus christ PhpStorm is destroying my 12 cores
May go back to straight vi
 
cmb
@ramsey Yeah, but the object is coerced to string in coercive mode; that may not be desired.
 
@cmb Right. I noticed this because of Nicolas's RFC, which sounds reasonable to me, but I'd like to hear more about "that may not be desired"
 
cmb
 
@cmb That seems to be making the case for the RFC. I thought by "that may not be desired," you were saying the coercion might not be desired
What comes to mind when I think about it is that they're using enums in a way they weren't designed to be used. Basically, they're using them as constants and not even getting the type-safety benefits of them, since that string parameter can accept anything--not just the enum.
 
cmb
"but with the added typehinting in Symfony 4, these markup objects are rendered into strings at the time of the violation creation". Symfony 4 added a string type declaration, and so coercion happened in coercive mode. The PR removed that type declaration.
 
Oh, I see. I skimmed it and misunderstood
 
> the violation creation
 
I was focused on this follow-up PR: github.com/symfony/symfony/pull/36057
 
3:08 PM
well there's the name of my new death metal band.
 
YAS
\m/
Does anyone know anyone who maintains asdf? They're already showing PHP 8.1.8RC1 and 8.2.0alpha2 in their list of installable PHP versions. I assume they're using some automated process to show them, but since we haven't announced them yet, I'm not even sure where they're grabbing the info from. twitter.com/ramsey/status/1539622104869617669
 
@Danack I thought this was the band... but just the name of their song... which is close. Looks like you're good to move forward with trademarking. youtube.com/watch?v=mKAjpHAqPG4
Relevant and funny... youtube.com/watch?v=avrCpYrdkxk
 
ah ha! They're listing tags: github.com/asdf-community/asdf-php/blob/…
 
cmb
@ramsey They may simply watch GH releases. Guess it's similar with several other distros (you often find that the versions have been build between tag and official release announcement).
 
yep... they're installing it based on the tags and not on the source packages, so that's probably okay
 
cmb
3:20 PM
Well, it's not really okay, because we have that time lag (2 days) in case something goes terribly wrong, and we want to re-tag (yeah, I know that is bad, but happened occassionally). But on the other hand, you can't disallow building from the tags.
 
I meant they're not downloading and caching a source package somewhere
 
cmb
Ah, okay, don't know about asdf; but other distros (sometimes) distribute binaries before Thursday.
 
so, each time it grabs it, it's getting the current code from the tag, but yeah, if someone happens to build from the tag during that lag time, and it gets changed, then they have a bad build
asdf builds from source each time
I don't really like asdf, but it's what we use at work
it's caused too many headaches with developers who upgrade their homebrew dependencies and then PHP won't work anymore because some dynamic object is no longer present or PHP wasn't built against the new one
So, they have to tell asdf to reinstall PHP
 
@ln-s I think Nikita already laid the groundwork for removing serialize/unserialize: wiki.php.net/rfc/custom_object_serialization. Of course, the new thing needs time to get adopted and removing older serialization methods would only be doable in a major release.
 
3:40 PM
@bwoebi @JoeWatkins @NikiC Did any of you guys play around with default implementations for interface methods? I'm thinking about proposing it for 8.3. I haven't found any prior work in PHP while searching around, so just checking with the most likely guys to have experimented with it.
 
Isn't that called an abstract class?
 
@Crell it's multiple inheritance light
 
Traits? :-)
 
@Crell interfaces are also just abstract classes, but for now without code
 
It's what traits ought to have been, probably ^_^ Nearly all "legitimate" uses of traits I've seen are default implementations of interfaces, but I know I disagree about what's use and what's abuse with some major users of traits.
 
3:44 PM
I have used them for utility code from time to time, but mostly yes, interface boilerplate is the main use.
 
@LeviMorrison I think … it would make sense to propose a default trait for an interface implementation, which is simply not applied when there's any conflict for a method.
i.e. you'd write your interface, write a trait implementing it and then add use thatTrait; in the interface code
 
I like that better, I think.
 
@cmb Except that I'd propose the other way round :-D
 
Why would that be better than putting the implementation in the interface? I think it would be much better to do it that way than force two type signatures. Even aside from the signature duplication, I don't think interfaces should have properties, so putting the implementation in the interface seems better from that point of view too.
 
3:50 PM
If property accessors go through, that includes properties on interfaces (because properties could be virtual, backed by a method).
 
cmb
@bwoebi yeah, but the other RFC is still under discussion :p
 
Yes, but until we have that I'd really like to keep them out.
As a basic but not particularly helpful example in our own stdlib, OuterIterator could have default implementations of all those methods except getInnerIterator().
interface OuterIterator extends Iterator {
    public getInnerIterator(): ?Iterator;

    public Iterator::current(): mixed {
        return $this->getInnerIterator()->current();
    }

    public Iterator::key(): mixed {
        return $this->getInnerIterator()->key();
    }

    public Iterator::next(): void {
        $this->getInnerIterator()->next();
    }

    public Iterator::rewind(): void {
        $this->getInnerIterator()->rewind();
    }

    public Iterator::valid(): bool {
        return $this->getInnerIterator()->valid();
 
Doesn't that basically render abstract classes useless?
 
Although I'm not sure when that getInnerIterator became nullable, I don't think it was... or maybe it's just in rough edges I never used...
@Crell I wouldn't say useless, but probably used less.
You cannot extend from multiple classes, but you can implement multiple interfaces. Also, interfaces don't have properties (at least yet).
Honestly, I want to make a Sequence interface that can grow organically without causing a BC break when a new method gets added, at least when that method can have a default implementation. At least with Rust's Iterator trait, nearly all can, so it seems like in practice it would be highly beneficial.
 
@LeviMorrison Is there any specific reason, why abstract classes and interfaces should not just simply be merged, and we allow multiple inheritance?
(or basically: why interfaces should not have properties?)
 
4:01 PM
I am skeptical about going full Python with inheritance... :-)
 
You cannot restrict property access. With readonly properties and such, the last piece we are missing is probably getters/setters. But until then, properties can break the abstractions quite easily.
 
@Crell Python is … python, yes. But I'd like to have a proper discussion of the practical problems with multiple inheritance here.
 
/me goes to make popcorn.
 
I'm not really after multiple inheritance, though. As stated, I want to be able to grow an interface like Sequence (basically a different kind of Iterator) and minimize the risk.
 
@LeviMorrison That may be so, but what you're describing is close enough to multiple inheritance that it becomes that discussion anyway.
 
4:04 PM
There is still risk (someone could have a method of the same name already), but at least it doesn't require every implementor to do work, only those with actual conflicts.
 
Who is going to be the "inheritance is wrong and we should all be composing things instead" advocate for this discussion? Let's get the casting sorted out in advance...
 
@Crell yes, that's the point sort of. Why "half-ass" it, when you could do proper multiple inheritance?
 
No half-assing. Only full-assing.
 
@Crell I think that composing is underused, but that's an orthogonal discussion :-P
 
@bwoebi Is it, though? Go's approach, for instance, uses composition in a way that simulates inheritance pretty well. (Not that we should adopt Go's approach verbatim, of course, but just noting that the discussions are not orthogonal.)
 
4:06 PM
I think default methods for interfaces is much less controversial than additional multiple inheritance.
Also, it has a few languages that have already done it, either directly like Java, or basically the same thing like Rust's Traits having default implementations.
 
How is default methods for interfaces and then implementing multiple interfaces not multiple inheritance?
The keywords may be different, but you end up in the same place.
 
@Crell (yes, but we already have inheritance - and I think getting rid of inheritance is definitely not on the table. We should improve inheritance orthogonally from the improvements we do to composition)
 
My concern is we end up with "I have 5 mechanisms for doing almost the same thing, with subtle differences, none of which is quite what I want but all are kinda close."
Like, when should I be using an implemented-interface vs a trait vs abstract class? If we also in the future add some "composes SomeClass" keyword or "delegatesTo SomeClass" (or whatever), when should I use that vs using an implemented-interface?
Off hand, I couldn't tell you. Just that I could write a very long article teasing out the differences, which is probably a bad sign. :-)
 
@cmb Should I be able to build against 8.2 yet with your GHA/setup-php tools?
 
cmb
@Derick I think at least 8.2 => vs16 would need to be added. I'm going to check.
 
4:22 PM
yeah, sure...
 
4:40 PM
@cmb Nope: github.com/xdebug/xdebug/runs/… — it says "unsupported version"
 
cmb
Yeah, like I said, there needs to be an 8.2 => vs16 entry. dbase basically works with that; no I need something with dependencies.
Oh, and of course you can try with cmb69/setup-php-sdk@679db664987b6f5de6ecc4732e9ce649a689e4e5.
 
Let me try that - I did add that 8.2 => vs16 entry in my setup: github.com/xdebug/xdebug/pull/843/commits/…
 
cmb
@Derick That won't help; you pass the desired PHP version to setup-php-sdk, and that needs to figure out which VS version to use, but since there is no mapping yet (in v0.5), it fails. cmb69/setup-php-sdk@679db664987b6f5de6ecc4732e9ce649a689e4e5 has that mapping.
 
4:57 PM
@Crell Probably always an interface with default methods ^_^
If we do get property accessors some day then Bob is right, I can't think of any significant difference between an interface with default methods and extending multiple abstract classes.
 
@LeviMorrison I have to disagree. :-)
 
@cmb Yeah, I changed that too
Now the same tests are failing as on Linux... because I just fixed PHP this morning
@cmb Btw, is there a way to not abort all the other version's tests if any single one fails?
 
ta
@cmb Do I need to wait until alpha3 before you PHP version updates, or is it nightly?
 
cmb
@Derick hm, don't understand? I'll update setup-php-sdk as soon as I have checked that it works; there are no more nightly builds for PHP on Windows for years.
 
5:12 PM
Oh OK. So I do need to wait for alpha3 then to get these tests to pass.
 
cmb
Ah, I see. Yeah, you'd have to wait. :(
No, I still don't understand. Where is the problem with PHP 8.2.0alpha2 on Windows?
 
cmb
@Derick ah, right! Then you'll have to wait.
 
@cmb I am also not proud of this: github.com/xdebug/xdebug/pull/843/commits/… (basically I switch dynamic props back on for exceptions)
 
cmb
@Derick ugh, not nice. Can't you use a WeakMap instead?
 
5:22 PM
a what?
I can probably come up with a better hack, but this does the job for now
(the original 'feature' was a hack already anyway)
 
yeah, but I thought that to be a userland feature...
@cmb When do you think v6 will be ready? There is no rush of course
 
(at least for PHP 8.1+, on PHP 8.0 you can polyfill it: github.com/DataDog/dd-trace-php/blob/…)
 
5:39 PM
I only see weak_hash_Add and _del, but no _find ?
 
@Derick use the normal zend_hash_find api for that
 
oh, of course
@Crell FWIW, your reply to Nicolas was the same as my brain dump, but better worded :-)
 
@Derick It will probably come off extra harsh in some people's mind, but honestly I don't care.
I'm really sick of any "that's a bad idea" feedback being met with "you're not the boss of me!", but I've gotten it several times in the last 2 days.
 
aye - enums are not strings; it's really not that hard
 
Really, I can sympathize with Symfony's position of being the ones people misusing enums whine to, but... that doesn't mean we should change enums to fit people's misuse. It means we need to do better education/outreach so that people stop harassing Symfony to do the wrong thing.
 
5:54 PM
yeah
I see the backed value of enums like timezone abbreviations (like PDT) — they're good for visualizing information, but shouldn't be part of any API.
 
I think I'd be fine with the suggestion to explicitly implement Stringable, autoimplementing a __toString() returning the backed value casted to string (or a predefined trait StringableEnum or such). But it shouldn't be a default.
 
@Crell explained in his reply that this not going to help/be any better than using class constants
 
cmb
6:24 PM
@Derick v6 likely takes years, but v0.6 is available ;)
 
For those who have legacy gmail accounts, and have been getting various notices about account changes, you probably want to click something:
> For individuals and families using your account for non-commercial purposes, you can continue using the G Suite legacy free edition by opting out of the transition to Google Workspace in the Google Workspace Admin console, before 27 June 2022.
 
Wes
7:45 PM
buzzfeednews.com/article/emilybakerwhite/… wait why are people surprised about this
 
Can I pass a variable name as a parameter to a function in order to call it? Like $foo->$param where $param would be 'test' or something? It's for internal use only, no risk of user provided data getting in there
 
Wes
@icecub yes, i think the preferred syntax is $foo->{$param}
 
@Wes Awesome! Thanks :)
 
Wes
it is better not to do that kind of things though, as that makes static analysis impossible
 
@Wes My use case is a websocket booting up, loading a lot of data from a database into its memory. The queries are all the same, just the table and the variable where the data has to end up in is different. Thought it would be easier to do it this way than having to write a bunch of if / else statements for each variable the data goes to
private function loadFromDatabase($table, $dataholder)
{
	$this->database->query('SELECT * FROM '.$table);

	try
	{
		$result = $this->database->resultset();
	}
	catch(PDOException $e)
	{
		array_push($this->sqlErrors, "Error fetching ".$table.": ".$e->getMessage());
		return false;
	}

	$this->{$dataholder} = $result;
	return true;
}
Might make it easier to understand
 
Wes
7:56 PM
$this->resultSets[$dataholder] = $result; ?
 
I hadn't thought of that.. Ye, I should definitely use that approach xD
 
Wes
is $this->{$dataholder} declared dynamically?
 
No. The variables already exist of course
 
Wes
that's not too bad then
 
Ah, good to know. Think it might be a bit easier for reading if every table has its own variable instead of having everything inside a single array / object
 

« first day (4267 days earlier)      last day (696 days later) »