« first day (3757 days earlier)      last day (1174 days later) » 

12:00 AM
@Machavity you were waiting until you became a moderator to fix this, weren't you? stackoverflow.com/posts/1732454/revisions :P
 
Actually, that was asked of Machavity by another user
A friendly mod favor
 
ahhh
 
DGF
12:12 AM
@DaveRandom Finnaly done with the work, can asnwer now... "but it's not obvious (to me) how it works and that worries me I always prefer code that explicitly states what it is doing". In what way the query is not explicity saying what is doing?
 
12:33 AM
@Tiffany Someone has to keep the pony at bay :P
 
Hello, it is me Tony the Pony
 
And that's why you never use regex to parse HTML. You'll be forced to watch that on a loop
 
 
2 hours later…
2:35 AM
This is time taken to just make the object, no other operations. Shows that ArrayIterator is bad, but also shows it's not going to bottleneck any apps. Still, I'd like to land this improvement.
@NikiC Any additional tests you think I should add to that before I make the ReverseArrayIterator too?
(or anything else amiss in general)
 
2:47 AM
1 message moved to Trash can
2 messages moved to Trash can
Correct times with production build:
------------------------------------------------------------------------------
Class                      Scale                      Time (nanoseconds)
------------------------------------------------------------------------------
ArrayIterator                                     1                        790
Spl\ForwardArrayIterator                          1                        196
ArrayIterator                                    10                        216
Spl\ForwardArrayIterator                         10                        122
 
 
1 hour later…
4:13 AM
session.cookie_samesite missing from INI list ・ *Configuration Issues ・ #80677
Incident on 2021-01-28 04:21 UTC
Incident on 2021-01-28 04:21 UTC ・ GitHub Pages has Major Outage
 
Also, if anyone has any clues as to why this test might fail in CI but not locally, I'm all ears: ci.appveyor.com/project/php/php-src/builds/37483475/job/…
I fixed the problem locally, but the commit still fails in CI. Tried in both debug and non-debug versions.
 
5:05 AM
Ah, may have fixed that one
 
 
2 hours later…
7:11 AM
Incident on 2021-01-28 04:21 UTC ・ GitHub Pages has Partial Outage
 
morns
 
7:40 AM
hey guys i have a query about jquery datatables and ajax. my code is in php is this room alright to ask in ? have no problem just a query im curious on which is the better option
i need to show a selected row in datatable so is it better to use the row row().select() attribute in jquery or shall i just send the id by ajax to get selected row
from database*
 
choose whichever is better for you, seems like an opinion based question.
 
i know both will give same results just wanted to know if one method was better than the other
 
8:14 AM
Minor Service Outage ・ GitHub Pages has Partial Outage
All issues have been resolved!
 
8:28 AM
@KhwajaHussamQuasmi it depends on your usecase, you will have to determine which is best for you.
 
8:49 AM
morning
what means `@'
>new DateTimeImmutable('@' . $value);
 
@BruceOverflow its telling the DateTimeImmutable parser that the value should be treated as a unix timestamp
so $value should be an integer
 
ah, thanks
 
 
1 hour later…
10:05 AM
@KhwajaHussamQuasmi Use links (gist, pastebin) to show the code. Chat platform is not appropriate for code bigger than few lines.
'Morning.
 
sorry, i posted the code for reference problem is in this part
"ajax":{
            data:{ses_id:$("#ses_id").val()}, <--- this part i think
            url:"accountfetch.php",
            type:"POST"
        },
 
That's the question for SO or JavaScript room but most likely for DataTables forums. Have you debugged it in line before? Like: console.log($('#ses_id').val()); return false; var udataTable = ... to confirm what you have there?
 
no flags though please :-) it was poor etiquette and a little spammy but it does not look malicious
a simple friendly link to the chat guidelines is all that's needed :-)
 
Probably'd be better. Every day one learns something. Sort of.
Didn't read it'd be "flagged" flagged. I should use another one.
 
10:21 AM
ah yeh, flags are system-wide moderator-level
just a gentle prod is usually sufficient, anyway (it is the purpose of the chat guidelines doc, which is also linked in the room description)
 
10:38 AM
1 message moved to friendly bin
@Tpojka yeah, avoid flags as much as possible, they bring unwanted attention to the room.
 
json_decode fails on numbers with explizit "+" sign ・ JSON related ・ #80678
 
update. code worked. rather than sending data by ajax i sent it through session. earlier i was trying to send through ajax in jquery datatable via post method but the label id i was trying to send wasnt in a form. so i think it was not working because the label wasnt in a form of post method
 
Noted already.
https://i.imgur.com/jcren9D.gif
 
if loaded document starts with text, some nodes will be lost ・ DOM XML related ・ #80679
 
11:31 AM
DOMNode::getNodePath() returns XPath that is invalid for DOMXPath::query() ・ DOM XML related ・ #80680
 
11:49 AM
 
 
1 hour later…
1:07 PM
@Tpojka That's hilarious.
I seriously cannot stop laughing at that. Probably my code.
And Good Morning, all
 
Anyone want to discuss property accessors? I've written a first draft proposal: wiki.php.net/rfc/property_accessors
9
There's a lot of things I'm not sure about though, and I wonder whether this might not be best split into a few different features
 
SVN mentions in manual and dochowto ・ Documentation problem ・ #80681
 
DGF
1:23 PM
Is Jeeves some kinda of chat bot or it's really a user?
 
For example, it might make sense to split out the "asymmetric visibility" part entirely, and make it something swift-style public private(set) rather than the C# notation
cc @IluTov
 
@DGF room bot
 
DGF
Hmm, that's why it's always postings "Documentation problems"
 
@DGF if you ever want to contribute: github.com/async-bot
We're trying to mirror the features from the old bot: github.com/room-11/jeeves but it's a slow rewrite
@DGF it scrapes bugs.php.net site and checks for new bugs. If there's a new bug, it'll send a message to chat.
 
class Test {
public string $_prop;
public string $prop {
get { return $this->_prop; }
set { $this->_prop = $value; }
}
}

Shouldn't $_prop be private?
Or am I missing something
 
1:32 PM
@Girgias yes it should, fixed
 
I actually quite like the usage of the var keyword
 
DGF
@Tiffany Probably not much I can do with my knowlegde right now ahahah, but thanks
 
@NikiC "many disadvantes."
 
@NikiC am I missing something with the setter guard, but isn't this achieved by using an implicit get accessor and using an explicit set one? Why add an extra guard one?
Another question, is it possible to have an lazy/init accessor when declaring an explicit set accessor?
 
@Girgias The answer two both of those question would come down to the "backing property"
Which is only used if both get/set are implicit
The guard is there so you can add a guard while still otherwise using implicit get/set and not managing your own storage
For lazy/init, I guess it depends
Or not. I think those also only make sense to initialize an automatic backing property
If you allow combining them with manually-implemented get/set the behavior becomes unclear
I guess you could say that the first time the property is read the return value of init is passed to set?
 
1:45 PM
> This default value is the default value of the backing property. If there is an explicit get or set implementation, then specifying a default value is illegal.
Can we, in this case instead of disallowing, add a private property with that name, which can be accessed according to get/set recursion?
just that it's declared … that's for me a shortcoming of c#
 
TBH the whole backing property part and where it is applied and not applied is one of the areas I'm really unsure about
 
i.e. specifying a default automatically generates an usable backing property in all cases
 
@bwoebi That does make some sense
 
So basically the guard function must only throw and not touch the variable, correct? What happens if the variable is a reference and the guard touches that variable for some ungodly reason? Is that an implementation detail in which the guard must prevent variable modification?
@NikiC Seems to be sensible without further thoughts, but you'd need to pass a guard check as well before initializing it too
 
@Girgias I think it something that the guard shouldn't do, but isn't prohibited from doing
Similar to how a getter could also perform a modification, if it really likes to
 
1:52 PM
But how is that different from set accessor then? That's the trouble I'm currently having, making the distinction between both other than one is backed and the other one isn't
 
@NikiC Do you have a minute to have your brain picked? For $CONTRACT I have written a flamegraph like profiler that uses SIGVTALARM at every $X ms to check what the current stack looks like. This works fine, but it seems that the timer signal is liable to interrupt MySQL's connect syscall. It doesn't seem that MySQL ('s client lib?) handles the interuption and restarts the connect syscall. Would you have any idea on how to work around this?

The relevant strace portion is at https://pastebin.com/GpCHirrW
 
@NikiC re: lazy/get - I think, if we have a getter, then we should do the init as part of the getter - so I'd vote for forbidding having both at once unless there's a big advanatage I cannot think of yet
 
@bwoebi If you have a clever idea btw, I'm happy to hear too
 
@Derick in C code? use a thread with sleep instead?
 
@Derick SA_RESTART doesn't help?
 
2:03 PM
@NikiC What do you mean? I can't control the mysql library?
 
@Derick I mean, do you set that flag when registering your sigaction handler?
 
I'm using "signal" and not "sigaction (2)"
So yeah, let me read up on that... but that could be the fix.
 
@bwoebi Agreed on this, also it's easier to lift a ban than restricting it after the fact
 
@Girgias I think that's really the whole distinction. (Based on docs.swift.org/swift-book/LanguageGuide/Properties.html => "Property Observers" one could also use this to add an "observer" in a subclass -- though in that case it probably shouldn't be called "guard", it's a more general concept)
 
@NikiC What exactly is the fundamental problem for allowing var $prop { &set; } (essentially equivalent to var $prop { function set(&$value) { $this->prop = &$value; } })?
but without requiring the input value to actually be a variable-value (i.e. referencable)
thus, $foo->prop = $var; and $foo->prop = &$var; would function similarly to what we currently have
thus, public $prop { &get; &set; } would be effectively fully equivalent to public $prop;?
@NikiC did you already have any thoughts about reflection?
 
2:25 PM
@bwoebi nope
@bwoebi I don't think that's sufficient, you would actually need separate handlers for by-value and by-ref assignment
Otherwise you don't know if you should be doing = or =& in your implementation
 
@NikiC you're right. I wouldn't be opposed to allow overloading set depending on & or no &.
 
Also, if unset() on accessor props is forbidden, then I guess full compatibility is not possible anyway. But in a pretty harmless way, in that it's only things you probably don't want to allow anyway :)
 
@NikiC you are inconsistent in your RFC with the $value argument… does set require to be followed by an arg, or is $value automatically present?
sometimes you write set($value) { … }, sometimes just set { … } and use $value within
 
@bwoebi It's optional, with $value by default
I'll drop the set($value) examples, as that's just pointless
 
Ah okay, missed that
@NikiC can we, for parent get()/set() calls, not simply rely on getter/setter recursion? i.e. we first search for a parent property of that name…?
 
2:33 PM
@bwoebi Interesting idea
But not sure it's also a good idea :D
 
@NikiC me neither yet … but haven't been able to think about a scenario where it'd be an issue yet
 
@bwoebi I'm not even sure when there would be a need for it in the first place...
 
@NikiC e.g. adding an additional guard in a child
 
@bwoebi I guess that would be an example where just using the recursion won't work
 
@NikiC why?
 
2:39 PM
It wouldn't work for the lazy/init or guard accessors
As those don't have a meaningful concept of property recursion
 
that's anyway an open question … what happens when parent has a guard, but child doesn't?
is it inherited?
 
@bwoebi probably...
 
what happens if both child and parent have a guard? is the result OR'ed?
it it overwritten?
 
I'd say overwritten, and you have to call parent::
 
agree
to override a parent guard, we'd have to do explicitly add an empty guard guard {} right?
 
2:44 PM
@bwoebi yeah
 
I would not inherit a parent lazy though, if a getter is present on child
@NikiC I would say that accessing a parent property would obviously execute the parents guards and lazy
so you basically: either want to fully override the parents behavior … or you access the parent property and store your value there
and just add some extra guards
 
Ah okay, I think I've understood it, I think reusing Swifts terminology about computed properties might be a good idea. As I did not grasp that immediately.
But then also `guard` might be better called `observe` or something like that, as it's purpose isn't *just* to guard, wdyt?
 
@Girgias I think guard is not supposed to be applied to the retval of get()?
 
Ugh, why has every proposal for properties gone with C# style? I much prefer Dart's style...
C# style doesn't look like writing methods at all.
 
@bwoebi I mean yeah, but IMHO guard only means checking that X statifies Y condition and not do anything else with the variable value for example
@LeviMorrison Got a link?
 
2:54 PM
class Car {
    int _doors = 4;
    int get doors => _doors;
    set doors(int numberOfDoors) {
      if(numberOfDoors >= 2 && numberOfDoors <= 6) {
        _doors = numberOfDoors;
      }
    }
}
 
@Girgias It does not?
 
PHPized, might look like:
 
1 hour ago, by Girgias
So basically the guard function must only throw and not touch the variable, correct? What happens if the variable is a reference and the guard touches that variable for some ungodly reason? Is that an implementation detail in which the guard must prevent variable modification?
Or am I missunderstanding something?
 
class Car {
    private int $_doors = 4;
    public int get doors() => $this->_doors;
    public set doors(int $numberOfDoors) {
      if($numberOfDoors >= 2 && $numberOfDoors <= 6) {
        $this->_doors = $numberOfDoors;
      }
    }
}
 
@LeviMorrison NGL, not sure I actually prefer that
 
2:56 PM
@Girgias you are not passed a reference… though you could technically change state of objects passed … but yeah
 
@bwoebi Well yeah the changing object state part is what bugs me lol
 
@Girgias They still look like methods. C# is just... a mess. It doesn't look like much of anything that already exists in the language.
 
@Girgias well, but that applies to everything … nothing we can do about that or really prevent. The main task is describing what's intended, and guard does that
 
@Girgias Apparently I'm the weird one; all proposals have picked C# style, Swift went with that style too, and so on. There must be some viewpoint about it that I don't understand or subconsciously agree with.
 
@bwoebi Fair point
 
2:59 PM
@LeviMorrison I guess the main advantage of c# style is the explicit grouping in code
 
@LeviMorrison Well yeah because they aren't methods per se, and needing to declare the property with the prefixed _ just seems weird to me
 
@NikiC Are you considering short-hand accessor syntax as in get => $this->foo + 1;?
@Girgias (the prefix is also present in c#, for the backing property, by convention)
 
@Girgias The _ is convention, not requirement.
 
@bwoebi Not explicitly, but if there were a general shorthand method syntax...
 
Well I know the _ is convention, but still feels weird that one would need to add it separately
@NikiC Wasn't there someone working on that like 4 months ago?
 
3:05 PM
@Girgias You have to store values somewhere if they aren't purely computed from stuff you already have.
C# is the same on that, right?
 
@NikiC I feel unsure whether we really need to allow ($value) at all as part of the setter decl. Just make $value as magic as $this within a setter and we're good.
I think it's more confusing than helpful to have both styles
 
Never done any C# so I wouldn't know :D but from what I get from Nikita's proposal is that the backed value is implicit so you don't need to write it you
But FYI my opinion on language design can probably be ignored as I've never really written in anything other than PHP :D
 
@NikiC Overall, I think your proposal is really solid, especially I like lazy and guard.
But there's yet some thoughts to be had for inheritance
 
3:19 PM
opcache doesn't honour pcre.hit option ・ PCRE related ・ #80682
 
3:32 PM
@NikiC Working on it. :-) What's the RFC we're discussing?
@LeviMorrison Javascript and Python have separate methods like you're describing in Dart.
 
drools
@NikiC Did you figure out a way to make it work without a huge performance hit?
 
I think the main feature is lazy and guard, so that a lot of common usages only have minimal overhead
esp. lazy is just called once instead having the getter called on every access
so, more like intelligent language design than miraculous speedup
 
guard and asymmetric visibility probably cover 90% of the use cases themselves.
 
yep
 
3:53 PM
I presume guard would also get called during a clone operation, like the clone-with proposal?
Hm, I was worried about promoted values. I can totally see wanting a promoted value with a guard clause, which would per this be illegal.
 
Hey everyone I got a question which has a little to do with PHP it self. I'm using PHP for crawling / scraping. Also I'm using css selectors to filter through the DOM. My question is:does `$node->filter('a')->each(function ($url) { ... }); is registered/recognized as a new request by the website in which im trying to crawl?
 
@MarinarioAgalliu No, it's not because it is only parsing the content provided to it.
but that depends on what you do with the url after that
 
can i copy paste code here?
so I can explain my self better
 
Put it in a gist
Or pastebin or whatever
 
ok thnx
Don't look at the code if is correct or not because it's just an example. I'm just trying to understand if that is recognized as a new request because I dont want to be banned for too much request on that site.
 
4:14 PM
@NikiC I do wonder what it would look like to use the Python/JS/Dart style with stand-alone methods rather than grouping them. I think it's worth experimenting at least.
 
@MarinarioAgalliu you'd need to look at the code inside the crawler class to know for sure, but my guess is 'no', as it would be incredibly slow if it worked like that.
 
@Danack I also think that is not recognized as a new request but I just wanted to be sure...
 
5:07 PM
@mega6382 Yes, that's a Maybe/Optional monad.
 
5:56 PM
cool, would be nice to have those
@MarinarioAgalliu if you are getting the content from the urls that you are getting from those a tags then yes, it will count as separate requests.
 
Oooooo property accessors <3 now we know what 8.1's headline feature will be
 
6:24 PM
The number of times I've run across top-voted answers by DaveRandom while randomly searching a question is pretty insane.
 
7:04 PM
Untrue statement about microtime() precision ・ Documentation problem ・ #80683
 
@LeviMorrison why the switch on return convention on getters? why not public get doors(): int => $this->_doors; for consistency?
 
@ircmaxell Sorry, that was just bad PHP-izing the example :0
 
Ah okay, didn't look for much context and seemed odd :)
 
Make bug "Closes" action more strict for bugs.php.net bugtrack ・ *General Issues ・ #80684
 
class Car {
    private int $_doors = 4;
    public get doors(): int => $this->_doors;
    public set doors(int $numberOfDoors): void {
        if ($numberOfDoors >= 2 && $numberOfDoors <= 6) {
            $this->_doors = $numberOfDoors;
        }
    }
}
 
7:16 PM
The better version of "Don't Be STUPID, Grasp SOLID" is no longer on YouTube :(
 
better version?
 
which... doesn't tell much, but it had the presentation of like a keynote speech
I wanted to send it to a coworker
both you, as the speaker, and the slides were visible as part of the video
 
@Tiffany I just twote them, to see if intentional...
 
@ircmaxell thanks :)
 
7:23 PM
@Danack was about to do the same. thanks! :D
 
Think that usergroup might be reforming, so may be someone doing something by mistake.
s/reforming/being a bit more active than they have been/
 
7:37 PM
I like it a lot :) Here are some initial thoughts:

* Would it make sense for guards to be able to modify the value? E.g. lets say you wanted to always trim a string when assigning it to a property. Guards are mainly here to avoid having to add a backed property, this would remove one more such case.
* Are properties in interfaces part of this RFC? Are properties without accessors allowed? That's not quite clear to me.
* If `$b->prop =& $prop;` doesn't work properly would it make more sense for it to blow up instead of behaving slightly differently?
Also, I do think $b->prop[] = 42; not working by default (without &get;) could be quite surprising. Are there any good reason for getters not returning references by default?
 
From my understanding, all properties have implicit get and set accessors, so this would apply to one which uses a lazy one.

For the guard to modify the value, it currently can, that was one of my questions to him earlier on and looks possible.

I would imagine the trivial case of accessors visibility could be amended with a follow RFC
 
@Girgias Thanks :) I didn't go through the whole discussion here to be completely honest.
 
@mega6382 To do them fully we need generics, too, but that's... Hard(tm). :-)
 
@Crell Yeah, I was thinking the same thing, but I can't even remember how many RFCs for generics there have been and they still haven't been implemented
 
I think it's really important that we ensure the syntax "degrades gracefully".
 
7:53 PM
yeah, the syntax, that's what most others worry about too
 
8:33 PM
"If $b->prop =& $prop; doesn't work properly would it make more sense for it to blow up instead of behaving slightly differently?" Yeah ... there's a bug report to properly detect this somewhere...
 
@Danack Its been some time since they deleted it, so I created an offline copy from archive, here it is if you want it, mega6382.sfo2.digitaloceanspaces.com/solid-ircmaxell.mp4 //cc @Tiffany
 
ta.
 
9:38 PM
@NikiC Are you open to considering the more JS/Python/Dart style syntax? If so, can I noodle a bit and come up with some comparison examples?
 
@mega6382 Smart.
@StatikStasis I adore second image there.
 
10:05 PM
@Crell I did experiment with that as well, but didn't like it much
First because it always needs you to explicitly manage a backing property, there's no really good way to make that automatic, and having an implicit backing property is the most common case
And kinda related to that, things like lazy/init don't integrate well with it
 
Hm. Fair. My biggest concern is that I can see guard being used stand-alone with promoted properties a lot, but that's not allowed as is. (For totally legit reasons.)
 
@Crell Hm yeah, I can see the argument for that
 
I think the biggest use would be public get, private/protected write. Perhaps a shorthand could be available to handle that case in place of the public / private / protected accessor, although I'm coming up short on possible names. In TS those are almost all readonly but that conveys the inability to write them again internally
 
I hate to be the one to say it, but would allowing both versions get shot down immediately? :-)
 
@Crell Yes ^^
 
10:12 PM
:-P
@MarkR Yeah, I think public get/private set and guard will cover the 90% use case in practice, and init/lazy/whatever another 6%.
 
private published $foo equivalent to public $foo { get, private set; } or something like that. I'm usually in favour of one-true-way but I'd expect that pattern to be used everywherreeee
would also provide an easy way of adding to the god feature that is property promotion
 
@MarkR Swift does private(set) $foo I think
Or maybe public private(set) $foo in PHP
 
Brainstorming question. Would guard make sense as its own feature? Like, independent of get/set interception, make just guard a stand-alone construct? That would avoid the promotion issue, but would separate the validation routine from the definition...
(Not sure I like it; just idiating.)
 
You mean like adding a generic function like:

class Foo {
public $bar;

guard bar($value) {
...
}
}

?
 
10:31 PM
Something like that, yes.
Or, not generic. Property specific.
public guard $bar {
if ($bar = 666) throw EvilNumberException();
}
 
Yeah, bad use of word generic on my part, but guard propName
Although I do see the benefits to keeping it all wrapped up next to the type information.
 
Yeah, there's a good argument for both.
 
Nitpick, but in the setter guard example, $value just kinda comes out of nowhere. I would expect it to either be defined guard($foo) { ... } or the same name as the property.
 
Agreed. $value as a magic name comes out of nowhere.
 
10:47 PM
@MarkR I would've honestly suggested the opposite, always call it $value. There's no way the variable can be shadowed (every function has it's own scope), making it consistently the same seems logical to me. Calling it something else doesn't seem useful to me.
enum value. When you work on an RFC too much -.-
 
@IluTov I was wondering :P
 
lol
Would set methods be required to return void?
 
I'm not 100% on the default implementation creating a $this->_name, IMO it would be better if the backing was hidden and the only access was via the getter.
 
@MarkR It doesn't actually create _name
It would work the way you said
 
Ah yes, my bad. I see you mentioned that the backing property would have the same name as the accessor. The example threw me off a bit.
 
11:13 PM
This is probably a terrible idea and I already feel bad even bringing it up for discussion, but I could potentially see a benefit to exposing a backing property as a special token.
public string $longerPropertyName {
   get { return $$; }
   set($value) { $$ = $value }
}
 
Only if it's named T_BLING. Otherwise I'm against it.
 
public string $longerPropertyName {
   get { return $this->longerPropertyName; }
   set($value) { $this->longerPropertyName  = $value }
}
The less repetition the better IMO, promoted properties cut down me writing the property name from 4 times to 1.
 
11:38 PM
@Crell T_DOLLAR_DOLLAR_BILL_YO
 

« first day (3757 days earlier)      last day (1174 days later) »