« first day (3548 days earlier)      last day (1386 days later) » 
00:00 - 17:0017:00 - 00:00

5:00 PM
redraft the RFC, the simple question you want to ask is "should constructors implicitly be void ?"
defer to policy for when that change happens ...
 
cmb
Frankly, I don't understand why anybody would vote "8.1" on the 2nd vote.
 
@JoeWatkins yeah, all I need is a single button press and the RFC is updated
i'm not sure though if we need to reset the vote, that's the problem
 
@moliata changing the star pin for RFCs that shows up in the right --->
only a room owner is able to pin a message
 
the proposal bit of the rfc reads strange
 
if it's okay to remove the secondary vote right now, let me know, I will remove it
 
5:03 PM
@cmb It's a rather small BC break, isn't it?
 
@IluTov 95 out of 1000 top Composer packages have a BC break
 
@moliata Wow, how?? What the hell do they use it for?
 
@JoeWatkins which part? Most of the internals said the RFC was clear, so I didn't change anything.
 
I would've thought this is more of a theoretical BC break.
 
@IluTov early returns or for no reason.
 
5:04 PM
But early returns are fine, no? If you don't return a value.
 
cmb
Doesn't really matter whether it's small or not, 1 year is short, and there is no urgent need to enforce the void (whoever wants to can declare :void).
 
Yeah
 
@cmb Yeah I would have to agree.
 
@moliata I think you mentioned it on the ML … but this is really information I expect to read in the RFC text as well.
 
@bwoebi will add.
some projects use return false; instead of return;, not sure why and others just add return $variable;at the end of __construct method but don't catch the value it returns anywhere.
@cmb is it okay to drop the secondary vote?
 
5:08 PM
@IluTov Woo, congrats!
 
cmb
@moliata note sure. If in doubt, close the voting, send a mail to internals, and start the voting again tomorrow. :)
 
@cmb yeah I think that's the better approach ;), will do
 
@Crell Thanks Larry!
 
@IluTov Yes, congrats on the match RFC! I've wanted something like this for a long time.
 
@TheodoreBrown Thanks :)
 
5:16 PM
Combined with short lambdas there's some really funky possibilities there... ;-)
Now, if we can also get short named functions (shouldn't be absurdly hard), that goes even further.
 
@Crell What are short named functions?
 
The thing I asked Nikita about the other day.
 
Sorry, didn't follow that conversation.
 
function volume(int $x, int $y, int $z): int => $x * $y * $z;
Let single-expression functions have the same short-form as short-lambdas (and now match).
 
@Crell Oh I see. Yeah should be fairly simple.
 
5:19 PM
Just to make simple stuff easier.
Yeah, it should be just an AST expansion. I started looking at it the other day and found where the function AST was defined but its body definition confused me.
 
@Crell You could probably do the same thing arrow functions do, just create a normal function and then wrap the body in a return AST node. github.com/php/php-src/blob/master/Zend/…
 
Hm, maybe. That seems like it might trigger a lot of extra behavior around autocapture, though, wouldn't it?
My first thought was modifying the function block on 1103, but I don't know what CG(zend_lineno); is all about. :-)
 
@Crell So, what I mean is not to use a closure, but instead copy the normal function definition and then also wrap the body in a return node.
@Crell CG(zend_lineno) just tracks the line number for error messages.
 
Ah. Gross. :-) So... how does function even work if its definition is just declaring a line number?
 
@Crell Not sure I understand the question ^^
 
5:28 PM
can someone remind me, is it CREATE DATABASE `test`; or CREATE DATABASE 'test'; I don't remember if it's tick marks, or single quotes... and I'm being lazy... in MySQL
 
@Crell You'll most likely have to copy this block, make the separator the => token and then wrap the body in a return ast node.
 
@Tiffany Single quotes, I think.
 
thanks
 
Backtick has to do with reserved words, IIRC. I don't remember the details.
 
@cmb closed the vote, will reopen it tomorrow, thanks for the advice.
might take this opportunity to also improve the RFC (i. e. provide more arguments)
@Crell aren't backticks used for shell commands or something?
 
5:31 PM
@moliata If you make lots of adjustments, wait a day or two to reopen or there will be drama. (I'm speaking from personal experience :P)
 
@IluTov will take into consideration :)
 
@NikiC Do I need to make any changes to the Shorter Attribute Syntax pull request?
 
actually, if I make the "allow explicit void return type on ctors/dtors" as a secondary vote, will we need to move the RFC to under discussion status for 2 weeks again? Or the weekend will be enough for the internals.
 
@TheodoreBrown I think once his PR is merged the special @@ whitespace lexer rule will be unnecessary.
 
This change might make more internals like Theodore happy ;p
 
5:37 PM
@moliata Yes, I'd like to see a secondary vote for that. :)
 
@moliata @TheodoreBrown Initially I was thinking the same but someone mentioning that __toString and other magic methods also allow return types made me change my mind.
So, for consistency I think it makes sense that : void is allowed
 
@IluTov yup, agreed. It also doesn't make much sense to allow __clone to have an explicit return type but not __construct which behaves in a similar fashion..
 
I didn't follow the conversation closely, so that was probably already discussed, but technically, the constructor returns static when used properly. I wanted to just forbid dynamic calls to the constructor at some point, but I gave up on that. The return only makes sense when used like $foo->__construct() which doesn't make sense itself
 
constructor doesn't return static
 
It's a subtle but important distinction. A constructor doesn't return a new object. It's called on a just-created object.
$f = new Foo;
$f->__construct($a, $b, $c);

^^ That's what technically happens.
 
5:44 PM
same with destructor, the code looks something like:

$object->__destruct();
remove_object($object);
 
@Crell Shell/terminal will give you error for s/d quotes. Although backticks will do the job docs do that w/o.
 
yeah, but to someone new to the language it is confusing that the method that is called when they do $foo = new Foo(); would have an explicit void return
 
cmb
Do they even call __construct() in that case?
 
@pmmaga well it would be even more confusing when the documentation states that __construct() is void but when you try to declare the explicit type, you get an error.
@cmb
appearently Bob said he does
 
cmb
@Tiffany CREATE DATABASE test, i.e. without any quotes. :)
 
5:46 PM
^Yup.
 
blah
thanks
 
but that would break immutability since we could basically reset object values
 
that's why I wanted to disallow it :) but you can always break it in other ways, reflection, etc..
 
@cmb done
 
This was the PR I did for that: github.com/php/php-src/pull/5405
 
5:48 PM
@moliata One could argue that __clone shouldn't allow a return type either (in fact it doesn't through PHP 7.4). But regardless, I think it's okay for constructors to be different since they are already unique in other ways (e.g. property promotion).
 
but from PHP 8.0 it will now be allowed ;)
as for "being unique", I don't think that makes them a whole lot different
...and unlike in other languages, ctors/dtors are still normal methods.
(in PHP(
 
@moliata Yes, but even in that RFC it says "Note: The __construct() and __destruct() methods won't suffer any changes. They won't allow void as a return type given the fact that (almost) all languages, including PHP, don't have the concept of Constructors and Destructors “returning” something after their execution." wiki.php.net/rfc/magic-methods-signature
 
void is used for stating that a function DOES NOT return a value
 
Yes, but this is implicit in every other language I'm familiar with.
 
No, it's not implicit, it's just that constructors/destructors aren't actual functions in other languages
like they are in PHP
 
5:52 PM
They are actual functions
 
@IluTov I'm afraid I'm still in don't know what I don't know stage here. I understand half of your words. :-(
 
They just can't be directly invoked (or rather, require special syntax to directly invoke)
 
Well they are functions, but you can't interact with them like normal functions
yeah
 
@Crell Well, the parser/compiler part was fairly easy for me to get into because I've implemented various toy languages over the years. I always thought the field is incredibly interesting. If you're serious about it that's something you could try :) Also, not starting with C could help :P
Note I'm not talking about anything huge, something you can do in weeks, not months. But it will help you understand the various compiler stages.
 
Heh. I understand the basic theory of an interpreter; it's all of the bits of knowledge about php-src specifically that I don't grok, and the code base is very meager in signposts.
I wrote a simple lexer for the book, for instance.
 
5:58 PM
yeah, the parser/compiler makes sense for the most part but as soon as I look into the VM
 
@Crell Well, yacc is not PHP specific. Then start with that :)
 
even with Nikita's blog post, most of the things make no sense to me
 
Does yacc have any good starter documentation?
 
what about constructors that return $this? It's "wrong" but it doesn't hurt :P
 
@moliata Same. I mean, most handlers make sense to me but there are so many details, so many macros (+ the vm_gen.php thing) that make it hard to navigate/understand.
 
6:04 PM
@pmmaga what's the point of doing that?
 
@pmmaga You should never call __construct directly anyway.
 
@moliata none, I'm just thinking it's hard to justify the BC break.
 
@IluTov ...except if you're doing parent::__construct();
 
@moliata Yeah sure, what I mean is $object->__construct()
 
18 mins ago, by pmmaga
This was the PR I did for that: https://github.com/php/php-src/pull/5405
 
6:06 PM
@pmmaga well most of the BC breaks can be solved in 10 seconds.
(regarding this RFC)
 
If someone has $foo->__construct() in their code already, I don't care if that breaks. :-)
 
@moliata If I could go back in time I would actually prefer if there was special syntax (e.g. super()) and completely forbidding the calling of __construct.
 
they may not have it and it will break anyway AFAIK
 
@IluTov agreed; probably implementing parent::__construct()was easier than creating a new construct
 
@moliata For sure, constructors are just normal functions that get called automatically after object instantiation.
 
6:09 PM
I don't mind static calls to the constructor as you are modifying the current scope anyway.
 
@IluTov Say that to PDO lol
 
@Girgias I've never used PDO directly so I'm blissfully ignorant :P
 
@pmmaga what do you mean static calls? __construct cannot be static, right? I'm confused
 
@Girgias you call __construct directly in PDO? wat
 
@moliata parent:: static:: self::
 
6:10 PM
I have a lot of not polite things to say to PDO, but that's another story.
 
@Tiffany PDO Will populate the properties and then call the constructor
 
@Crell I just read @Ocramius' weekly rants on PDO on Twitter :P
 
Actually I'm not even sure it calls it anymore and if that is not a flag
 
There's a flag to control if the properties are set before or after the constructor is called, I believe.
 
I did a fun Object hydration thing by abusing PDO lol
@Crell Ah yes that's it, and by default it's after
 
6:12 PM
@pmmaga yeah but internally I don't think (not sure) it works like a static call, I think parent::__construct internally looks like $parent->__construct.
if it works*
 
Like most of PHP pre-2007, it was a clever idea to get some bit of app level functionality in the language that failed miserably because it wasn't thought through enough.
 
Correct me if I'm wrong though
 
@Crell IIRC, PDO was sponsored by a vendor to try and chip away at a competitor's majority
May 19 at 11:27, by Danack
user image
 
You'd think they would have done a better job.
 
@IluTov btw, I saw that you're working on methods on primitives (like Nikita's extension)
how's that going?
 
6:16 PM
@moliata I was, until I discovered that most internals wouldn't want extension but a fixed scalar api :)
And that was something that couldn't make the 8.0 deadline.
 
Oh no, please no
 
I've been experimenting with an extended iterator api but I'm not sure that it practicable performance wise.
 
@moliata Hmmm.. I had the impression they were actually static. But I also don't remember
 
Quite honestly, I think extensibility would be one of the cooler parts about primitives
 
@moliata The fear is that if we don't provide an API and leave it up to userland there will be 1. fragmentation 2. many crappy implementations. If we do provide an api the need for extensions is much much smaller.
I'm personally not convinced userland couldn't come up with good solutions but hey. I'm also ok with a fixed api.
 
6:20 PM
@IluTov yeah, I'm okay with a standard AP but we should also allow to override the defaults for those that want to
API*
 
I'm really not a fan of overloading stuff
 
Welp, I'm actually quite a huge fan of overloading.
 
php-fpm pool access log not shows client IP Address even if it is configurated ・ *Configuration Issues ・ #79776
 
6:37 PM
I see no benefit in it other than conflating multiple APIs into one because someone doesn't want to separate them into multiple ones
 
it's that time of year, where I hear random explosions and I have to contemplate if they're fireworks or something else potentially more insidious
 
6:57 PM
@Girgias it is like we discussed on object-initializer if it should populate properties before or after ctor, good to know
 
@brzuchal You wouldn't be the first to do it :p
 
It makes no sense, basically everybody hates @@ yet just about everyone picked that syntax
voted for that syntax*
 
@moliata … there do exist people who are attracted to pain…
 
@moliata barely above 50% within the votes
I wouldn't say that everyone picked that syntax
 
7:05 PM
well yeah, for PHP RFC votes
but fun fact, if we go onto reddit and look at the people who voted for @@ during a community poll
now are asking to change the syntax back
 
@moliata Don't confuse what loud people say with what is actually the general consensus view.
A poll of "people who talk a lot on the list" and a poll of "people who use PHP day to day" is rarely going to be the same thing.
 
@Crell yeah, I understand. It's just that people are bashing the new syntax while they asked for that change in the first place.
 
Is it the same "they"?
 
yeah
 
It's really easy to talk about "people" and mean six entirely different groups of humans.
 
7:09 PM
I'm talking about our r/php redditors ;)
 
I never liked @@, not on ML, here nor on Reddit
 
I saw a few posters on Reddit who preferred #[], but almost no one who wanted to change it back to <<>>. Overall the reception for @@ was positive compared to other possible alternatives.
 
Same. I didn't really care what syntax will be picked, just that it wasn't @@. But again, that is rather subjective
IMHO even the rejected @: looks better than @@.
I think (somebody else mentioned that as well) a lot of people believed that we will be able to reduce from @@ to @
 
For me #[] preferred cause at least one other language uses the same syntax. Which cannot say about <<>>, nor @@, nor @:
 
Yup, same. #[...] was the best case scenario for me but <<...>> also made sense since it was used by Hack (which yes, currently is transitioning to @)
 
7:18 PM
@moliata I think that's why so many voted on @@
@moliata Since Hask migrates from it for me that fact disqualifies <<>>
But it looks like it's not that hard to amend @@ if all who voted on #[] and <<>> on first choice will vote no for RFC which saves @@ from ambiguity.
I'm not saying it's nice and we should though...
 
Yeah but at least some language used it. Meanwhile @@ is a unique syntax not used by any other language, not that aesthetically good looking when not viewing in monospace font and well, ambiguous (with silence operator).
@brzuchal I would really love to make a second amendment and also try to deliberately explain that @@ won't help us to transition to @. But I'm not sure if doing amendment to an amendment is possible :D
 
I'm a fan of #[] since I saw it can save library authors from separating code of 7 and 8 and can play well if kept in one line, also since in most editors currently, it'd be coloured as a comment, which doesn't hurt eyes so much.
 
If using #[ I think we can reasonably expect a backport for support in PHP7 provided it's one-per-line
 
The only downside to #[...] is that it has a practical BC break.
I personally use Metasploit quite a lot
and that tool's exploit db has quite a few
PHP scripts with '#[' at the start
but I could probably do a recursive sed and make a PR to fix that.
So just by doing that, I think we would reduce the amount of BC breaks by 90% (since exploit db is the only place where I have seen #[ being used)
 
I've seen it first on Rust lang docs
 
7:25 PM
Personally I'm not hugely fond of making #[ not a comment anymore, but considering the choices i'll take that over @@ without a closing tag any day of the week
 
@MarkR any good IDE will add that closing tag for you
PhpStorm automatically adds closing tag for everything
 
@@ syntax doesn't have a closing tag
 
void zend_throw_unwind_exit(): Assertion `!(executor_globals.exception)' failed ・ Scripting Engine problem ・ #79777
 
Yeah but I don't see any difference given that an IDE
 
> i'll take that over @@ (without a closing tag) any day of the week
 
7:27 PM
automatically the closing tag
adds*
 
But it's @@example not @@example@@ right?
 
yeah
 
Contrasting to #[ ] where ] is explicit closing and << >> with >> explicit closing both of which IMO provide much more long term flexibility and clearer representations for the user
 
It doesn't affect flexibility at all
and the "clear" representation part is rather subjective
I rather like to close things ;p
 
You've lost me now... you keep mentioning close but @@ doesn't have an explicit close other than the end of the constructor
 
7:33 PM
@@ does not have a closing tag but you're saying that #[] does and that makes things less clear for the user
 
Stop arguing, better let's bikeshed on tw :P
 
No, I'm saying that #[] having a closing tag DOES make it clearer for the user
 
\o/ i'm bad at understanding people, sorry
 
So closing things is first an argument in favour :)
 
@@ does not mean that we will be able to move to a single @
that is also a key point to mention
 
7:35 PM
@MarkR I think if you'd get the "without a closing tag" more explicitly expressed as pinned to @@ it'd be easier to understand for me at first reading it was ambigous
 
Anyone watched the Mandalorian? So far I like it.
 
@brzuchal Meh, for the time being it all depends on if the powers that be, whoever they be, decide to officially void the result.
 
@StatikStasis not sure if you have watched Mr. Robot, but do it
 
@moliata I think it should be expressed in different way
 
one of the best tv shows I have seen
@brzuchal you mean that point needs better wording?
...or what
 
7:38 PM
It's rather subjective whether a closing symbol is better. If the attribute takes an array argument you end up with ])] stacked together which IMO worsens readability. Most languages don't have a closing tag for attributes.
 
Anything related to code styles is subjective
But based on your RFC, 3 out of 8 languages have a closing tag
and the other 5 don't
so not most
 
s/most/the majority
 
and again, if we're talking subjective, ])] worsens the readability much less than @(@@ ;)
 
How many other languages allow attributes attached to non-block-level elements?
 
but let's not get into a debate
 
7:42 PM
@moliata Is it on a streaming service?
 
@StatikStasis Amazon Prime
...or through Apple or Google Play
 
ah- cool. I will check it out then.
 
likewise with Mandalorian ;)
@brzuchal out of curiosity, will you be putting a second amendment or those are lost dreams?
 
@TheodoreBrown well C# has always ] after [, Rust has always ] after #[ or after #![, Hack had >> after <<, the only languages which don't have end are the ones for which @ has the only one use in attributes/annotations
@moliata I'm not convinced to write a good RFC for that
 
:(
 
7:48 PM
I suck in English
 
same
 
And I'm not the only one who don't like @@
(@@Foo (function () {}))();
(@@Foo function () {})();
very similar and very different
 
wait, both of these cases will be legal?
aren't they removing two @@
error supression
 
@StatikStasis yes, watched it back when it first came out, I really liked it
 
1st valid in PHP7, not valid in PHP8
2nd valid in PHP8, not valid in PHP7
 
7:55 PM
ah, I see
 
So if you want to prevent your code to run in PHP8 add more monkeys @@@@@
 
@brzuchal lolwat
 
That could prevent code execution in lots of languages. :D
 
Fifth world problem: break your code, just add monkeys!
 
Prefer "hash" # over "monkey monkey" @@ sign
Helping my teammate: now write two monkeys and JIT... voillea :D
 
8:17 PM
@@ is like TOML :P it's better than INI (<<>>) but still terrible
 
8:29 PM
Hello
I dont think my doubt deserve a former question, so thats why im here
Can I put 2 or more rows of my database inside a single $_session variable?
eg. $_SESSION['fullname'] = $row['fname'] + $row['sname'] + $row['lname'];
 
@UlisesOntiveros store those rows as an array? i. e. $_SESSION['fullname'] = [$row['fname'], $row['sname'], $row['lname']];
@bwoebi what's the point of setting ZEND_ACC_HAS_TYPE_HINTS? That is, what changes if you set it or not
You have set that in typed properties PR, that's why I'm pinging you
 
Yes, I need to display the full name later on, i´ll try your solution
 
@UlisesOntiveros if you want to join strings use concatenation operator which is a dot: $var. "some string" or use php.net/sprintf
 
Let me read the article and then tryed it
 
I'm not sure if I need to set ZEND_ACC_HAS_TYPE_HINTS when declaring typed class constants.
 
8:38 PM
@moliata it skips some checks for typed props
the flag name is a bit confusing, because it's reused between classes and functions
it shouldn't be relevant for typed constants
 
@NikiC okay, thanks
 
8:52 PM
@cmb not sure who I should ping regarding getting github.com/php/php-src/pull/5804 merged, or if there's anything else I need to do
 
9:10 PM
hey i have some error while i'm trying to use findAll() but it is returning no data but making the objects ? can you tell me where i'm doing wrong?
 
@Atulkumar first, don't ask to ask, just ask, and you need a short, self-contained, correct/compilable example (basically a paste of enough of your code that it can be figured out what's going on, without being your entire code-base)
 
i have created my controller for retrieving records from the database and code something like this $repository=$this->getDoctrine()->getRepository(Category::class);
$result=$repository->findAll();
return $this->json([
'category'=>$result
]);
but i'm getting results like {
"category": [
{},
{},
{},
{},
{},
{},
{}
]
}
can you tell me where i'm going wrong?
 
I would recommend using a debugger
asdasdfsddf what's the bloody command to paste the debugger video...
 
i have debug the routes
 
@Atulkumar I mean, using a debugger to see what's going on with your data, because it's almost impossible for me to figure it out with just that sample of code
@Atulkumar something like xdebug which allows you to step through your code so you can see how things are being set
 
9:25 PM
thank you so much
 
I have a question which is rather long, so I pasted it into a gist. I believe it's a general architecture question, but it may be an Amp question.
 
9:47 PM
@Atulkumar try to normalize your objects before adding them to array u pass to json method. Take a look at Symfony Nornalizer docs
 
thanks
 
Wes
10:56 PM
\o
 
11:52 PM
Would there be a way to drop support for MySQL versions which are old AF?
There is so much boilerplate code to handle version prior to MySQL 5.2
Okay tbh it's or prior to MySQL 5.1.7 or 5.6.5
 
00:00 - 17:0017:00 - 00:00

« first day (3548 days earlier)      last day (1386 days later) »