« first day (3859 days earlier)      last day (1089 days later) » 
02:00 - 19:0019:00 - 00:00

7:10 PM
@Derick ok
@BenMorss The proper interactive mode requires the readline extension to be enabled. Though of course, it shouldn't be segfaulting without :/
@BenMorss Oh wow, I can repro
Looks like nobody tested the without-readline case in a while
 
touch() with wrappers ・ Documentation problem ・ #81028
 
7:45 PM
@cmb Gift for you: github.com/php/doc-en/pull/594 - One more mostly-comment-less page.
 
8:14 PM
@Danack @CharlesSprayberry Any idea what to do with variadics in injector?
 
Don't support them...
 
8:34 PM
@kelunik I spent some time looking through the changes you made and I like what I'm seeing so far. I'd need some more time to think about variadics... on the surface I agree with Danack. Seems like the complexity of supporting them would wind up rippling through everything
Though not supporting them seems like a tough pill to swallow... ultimately it wouldn't be a big deal for me but the library limiting language constructs that seem reasonable doesn't feel great.
 
@Crell great contribution! :)
 
@FlávioHeleno Deleting comments is theraputic. :-)
 
8:52 PM
@Crell I'm not sure I follow the part where constructors are excluded from interfaces. Don't they work just like any other method on an interface?
 
constructors never belong in interfaces
 
I'm not talking about whether or not constructors belong in interfaces
But you can certainly define them in an interface and implementations must have a constructor that matches that signature
 
oh well in that case E_LAZY :-P
@CharlesSprayberry I'm really very sure that LSP is not checked for ctors any further than visibility
I may be about to be proved wrong though
 
I am pretty sure that constructors defined in interfaces just get ignored.
 
8:57 PM
they certainly should be
@CharlesSprayberry god damn it.
can we let @Crell's commit go through, leave it a bit, then claim that it's PHP that doesn't match the docs rather than the other way round?
jk obv :-P
 
Well shit. Maybe it's just inheritance where constructors ignore the rules?
 
that is definitely true
 
That's my understanding.
 
Huzzah, stupid inconsistencies! Think it's worth mentioning on the list?
Meanwhile I'll update the doc PR to say you really shouldn't put a constructor in an interface.
 
@Crell I think if a construct is present in an interface, the signature should be enforced.
ugh 3v4l.org/AkuLN
 
9:03 PM
Right now they are; but they're not enforced in extends. Which is... weird and inconsistent.
 
consistent construct should be the default IMHO, but BC ...
 
I probably wouldn't want parent classes to be controlling the structure of my constructor anyway
 
Apparently the interface wins, in this case: 3v4l.org/sTuvX
 
9:06 PM
@Crell Having a constructor on an interface doesn't make sense if it's not enforced. Constructors on classes aren't part of LSP, so they're not checked there.
 
@Crell do interfaces are the one way to enforce consistent construct ...
 
@Crell The interface is the only thing that's checked, so it obviously wins. :P
 
Me: Feeling particularly grumpy today.
The Internet: Let me give you something else to be pissed off about.
PHP Internals: HOLD MY BEER
 
what happened?
 
Maybe she really really hates empty constructors?
 
9:16 PM
Oh nothing in particular. I just generally assume internals will help calibrate the rest of reality for me
@Crell I am surprised you aren't eager to bring the constructor thing into the FIG space though.
Of course, now I'm thinking about proposing public function __construct(private $foo) = default; just to troll.
 
= default;?
 
Something you'd see in C++
As an alternative to the empty body constructor thing being discussed.
NOT a serious suggestion, ftr
 
@SaifEddinGmati that doesn't make sense though, interfaces describe the way that object instances behave in an abstract manner, any code which is calling a constructor is hard-coupled to that specific constructor because it reference the concrete implementations. __construct() should not be permitted in interfaces, if it appears it should be an error or ignored. imho.
 
public function __construct( ... ): default empty;
 
.... as default empty;
 
9:20 PM
public function __construct() NOTHING_TO_SEE_HERE_FOLKS
 
Let's pack as many already-reserved keywords into this as we can.
 
@CharlesSprayberry nuh, you now introduced a new keyword, unacceptable!
public function __construct( ... ): as default empty class function;
 
@Sara public callable function for class ClassName __construct()
 
@Sara Eh, until FIG actually has a process for "living specs", having another PSR on coding standards is a stupid idea. I already filed this exact issue with PHP-CS-Fixer like a week ago.
 
@DaveRandom I'm about 90% sure someone has posted an example where having the constructor defined for an interface is useful. Absolutely no idea what it was.
 
9:23 PM
@DaveRandom it turned out to be already enforced :D an it make sense sense you can do new ($a::class)('foo')
 
@Danack I feel like I had come across a use case that made sense for this but it was so long ago and I think it wound up being a bad design anyway.
 
public function __construct(private $foo) => null;
There, we've got Larry's one-line functions now.
 
woohoo!
 
I'm sorry, I feel like I have gone insane
 
@Sara public function __construct( ... ): as default empty class function => null;
 
9:24 PM
@DaveRandom We know.
In unrelated news, more than half of PHP installations are now running 7.4 or later. That's... pretty damned impressive.
 
it seems so obvious to me that I do not understand why everyone else does not see how defining the ctor in an interface is a terrible terrible terrible design and you definitely, 100% of the time want a factory interface
the only way it makes sense is if you are dynamically invoking stuff, and that's not how type checking works
 
@DaveRandom FWIW I agree with you. You really shouldn't be defining constructors in the interface because of design problems.
Should PHP prevent you from doing it though? Ehhh
 
yes, it should emit an error message saying "your code is bad and you need a factory interface if you are doing this" :-P
 
I am not about overly prescriptive languages btw, I don't really mean that
I do feel like maybe there should be some sort of pointer than you are doing something silly though, it seems unambiguous and suppressable with an attribute
 
9:29 PM
@DaveRandom a ... static analysis checker?
there's a bunch
 
yeh but atm if is possible for someone who doesn't understand these issues who wrote a lib I want to screw up a lot of stuff with far reaching impact
or worse, for some sub-dependency to introduce a ctor to an interface a break overrides 2+ library boundaries away
that shit is hard to debug, and the use case niche enough that a gentle (suppressable) hint doesn't seem unreasonable
I don't like languages that arbitrarily stop me from doing things, but I don't mind a requirement to explicitly suppress compiler warnings about the crazier parts of the program
 
hmm, i just remember that we used @psalm-consistent-construct somewhere because we were invoking the constructor dynamically somewhere, and didn't want people to mess up the signature, but now i think a factory would be a better fit
found it! https://github.com/thephpleague/oauth2-server-bundle/blob/master/src/Model/AbstractClient.php#L8-L57

will add a factory tomorrow :p
 
I can't think of a case where there is a practical difference between specifying a ctor, and specifying a factory interface with a single factory function
that doesn't mean there aren't any, of course :-)
I'm really quite confident about this one though, more so than average :-P
 
because PHP doesn't enforce ctor signature downstream
currently it's enforced via psalm only, but i think a factory method is a better way to enforce this.
 
yeh but it does enforce interface signature downstream
so it enforces interface-ctor downstream
unless it has changed, it was like sort of 7.0 the last time I went spelunking in that bit of src
 
9:37 PM
yea, maybe replacing the abstract class with an interface 🤔
 
Yes, we just tested it. Like, 50 lines above. :-)
interface ctors are enforced. Parent class ctors are not.
 
@Crell we went live on 7.4 on production about 2-3 weeks ago :)
 
@Tiffany woohoo!
 
you can bet I made a happy exclamation in one of our dev chats
"I CAN USE TYPED PROPERTIES NOW"
 
interface Foo
{
    function bar(int $a): string;
    function baz(): bool;
}
interface FooFactory
{
    function createFoo(string $v): Foo;
}
// and now instead of
$foo = new ($a::class)('hi');
// ..
$foo = (new ($factory::class)())->createFoo('hi');
@SaifEddinGmati ^ to be clear what I mean
I think you prob know but just for 100%
 
9:43 PM
> new ($factory::class)())

who says the constructor doesn't accept arguments? :p
 
the constructor of the factory class does not accept arguments
the factory class is a proxy for the ctor of the real class
 
well, it's an interface, you never know, it might need FactoryConfiguration $config _o.o_/
 
right I have not explained this correctly, give me a minute
also @Danack halp
 
FooFactoryFactory? :p
 
no :-P
oh wait I just realised you are basically creating instances from other instances??
new ($a::class); is surely the same as new $a; if $a is an object?
if you are doing that then surely clone is the way to specify how to make a copy?
or just a ->createOther() instance method in the interface
 
9:50 PM
May 13 '15 at 23:13, by rightfold
Decorators often look like this: class Decorator implements I { public function __construct(I $decoratee) { … } }; they implement an interface of which they take an instance as a constructor argument.
 
/dies
 
cmb
I love the PHP manual:
XMLReader::WHITESPACE
Whitespace node

XMLReader::SIGNIFICANT_WHITESPACE
Significant Whitespace node
thanks, that's helpful
 
/**
 * Count
 * @public
 * @var int
 */
public int $count;
 
10:10 PM
@DaveRandom /s/Count/The count./
 
@cmb, I've been battling to extend the build process to include libavif for an hour or two, and finally I thought I might ask for a bit of your wisdom here...
 
@cmb that is XML nomenclature, xml.silmaril.ie/whitespace.html
 
cmb
@hakre thanks, didn't know that (but will read up); anyway, the description is pretty much useless as is
 
does anyone know about a PHP tools that takes 7.4 code and strips it down to be PHP 5.3 compatible?
(given not using language features that aren't down-port able, e.g. traits)
@cmb as so often it depends. Perhaps the preface of the XML extension should have a link to the XML standard (if it does not yet).
 
10:18 PM
@hakre there's one, let me look it up
 
@SaifEddinGmati wonderful, thanks a lot.
can't search it with engines.
 
yea, it's github.com/rectorphp/rector, not sure which rule set exactly, but you can find it in the documentations ( example of 8 to 7 blog.logrocket.com/… )
 
@SaifEddinGmati I fear that rector won't go much downwards, but I'll take a look.
7.1 is lowest. but this should give me some search terms.
 
@hakre that's the only tool I'm aware of which is capable of downward code migration 🤷‍♂️🤷
i think it's still WIP :)
but not sure about 5.3 tho :D
 
well 5.6 is lower than 7.1.
as I only need to downgrade my own code, I might not run into issues. I should give it a try.
in phpstorm it's not possible to use different PHP versions per directory so I'm looking for some options.
 
10:24 PM
do you have a project that uses 5.3? maybe upgrade that to 5.6 first ..
 
nah, the aim is to support PHP 5.3.
upgrading normally is not a problem in PHP.
 
and why is the question :D
 
just the baseline.
 
cmb
@hakre I use PHPCompatInfo to verify that I dont't accidentially use newer features.
 
Or, perhaps someone else on the line has experience building with bundled gd?
 
10:28 PM
are you stuck in 5.3 somewhere? i have been burning 5.x projects for the last couple of weeks :P
 
cmb
my knowledge of M4 and pkg-config is that these are things …
Do you have a branch available publicly?
 
I do! I could push out my latest
 
Wow. The get_object_properties() docs page has comments that are 19 years old.
Or, it did until I got there... :-)
 
My knowledge of autoconf/libtool isn't superb... and when I add my brand new --with-libavif option, /usr/local/lib gets included, and then the wrong gd.h gets found.
As in, it finds /usr/local/lib/gd.h instead of ext/gd/libgd/gd.h
 
cmb
if you can use pkg-config, woukdn't something like this work?
 
10:32 PM
@cmb Another gift for you. Happy mother's day: github.com/php/doc-en/pull/595
 
yeah, i copied that exactly!
It's possible I've just not installed libavif properly
 
@SaifEddinGmati not stuck, this is for having the code runtime portable 5.3 - 8.1
 
@hakre i meant why would you wanna support 5.3 is the question if you don't need it for a project that is in 5.3, you are just making your life harder ... but again, you probably have your reasons, good luck tho :p
 
@cmb nice +thx.
 
cmb
10:42 PM
@BenMorss is it possible that this is can happen with other libs as well?
 
yeah, I just hacked around this one to see if I could keep on working for now, but now I'm getting errors from /usr/local/include/gdfontt.h and the like
Maybe I need to reinstall libgd and libavif
 
@Trowski I've no ideas what the colours mean. I don't think I ever noticed colours?
 
10:57 PM
Thinking about it more, since the problem is that /usr/local/include has gd header files that interfere with the ones that come bundled with libgd, I have to make sure libavif header files are found elsewhere, so that /usr/local/include doesn't enter into the picture.
Previously I was using CMake, so I never tried this with autotools!
 
cmb
What would happen if libjpeg headers were in /usr/local/include?
 
@SaifEddinGmati this is about the runtime for having a portable utility written in php, so that it runs and has low runtime requirements. this is not a normal requirement, e.g. for a web application.
 
I do have jpeglib.h in there.
 
11:13 PM
Is there somebody smarter than me online (always) that knows how to turn my flat list into a tree (in JS) without using recursion. I have been trying to dick around with a trampoline function, but I just cannot wrap my head around the building the tree part :(
My data looks like this jsbin.com/jurepoziru/edit?js,console
Seems like the kind of thing maybe @bwoebi understands, but all help from anybodyt (it came to plox write my codez for me :-( ) is much appreciated I am picking of pieces of my brain from the walls here
 
11:45 PM
let nested = [];
for (let k in data) {
  children = data[k].children;
  data[k].children = {};
  for (let c in children) {
    data[k].children[children[c]] = data[k] === undefined ? [] : data[k];
    nested.push(children[c]);
  }
}

for (let n in nested) {
  delete data[nested[n]];
}
Something like that @PeeHaa ?
@PeeHaa … but why did you pick me? :-D
 
02:00 - 19:0019:00 - 00:00

« first day (3859 days earlier)      last day (1089 days later) »