« first day (4111 days earlier)      last day (828 days later) » 

12:23 AM
a first immediate effect of vertical mouse is I don't accidentally right-click when my hand has been static for a long time
... and now for a more down-to-earth test, let's play some shooter
 
JRL
1:19 AM
thank you to everyone who helped on the operator overloads RFC
 
 
3 hours later…
3:49 AM
wow so... I'll need to think on that tomorrow, after having slept but... I am currently looking at code I wrote like, possibly 7-8 years ago? roughly around when I joined this room and started learning dependency injection through using Pimple, and like...
it is not the worse thing I've ever seen in my life. like, the naive simplicity is charming.
like, this was my first real free "let's write an oop codebase" and I hate it a lot less than shit I wrote 3 years ago. before I got tainted with mvc
maybe what makes it special is it's basically my father, having this code reside on an obscure hard drive somewhere, who kept it all this time and moments ago, as we were working on his project, got this out of nowhere like "oh btw here's this old code you wrote all those years ago" and for the life of me, I cannot remember writing it but it's without any doubt me and it's like... I feel it's better than what I wrote afterwards lol
 
 
1 hour later…
JRL
5:11 AM
@FélixAdriyelGagnon-Grenier MVC is something that i learned and then put significant effort into forgetting
it's such an anti-pattern imo most of the time
 
Hi
Ask me anything about PHP, Having three of working PHP experience now here to help
 
JRL
welcome tahir :)
at the moment, most of the people in the room are also experienced, but occasionally someone drops in looking for help if you stick around
 
 
6 hours later…
11:22 AM
Morning
 
11:59 AM
@JRL i think the problem with MVC aas a pattern is that its actually more of an architecture, so discussing the "details" becomes more a philosophy question not a technical one
 
12:22 PM
@FélixAdriyelGagnon-Grenier sup?
yeah sort of that only. Living under rocks :p
 
IGP
1:55 PM
A bit late to give my 2 cents, but I think the main problem with MVC is people getting obsessed with thin controllers to the point where they simply hide the logic instead of making it simpler.
Or alternatively, when the complete opposite happens and a single method handles about 2 to 4 different endpoints.
 
The latter shouldn't happen
 
IGP
The classic

if ( request is get ) {
// pass data to view and return
} elseif ( request is post )
// handle data submission and either return or redirect
}
 
yes
 
IGP
Add to that some way to handle fetch/xhr requests
and it quickly gets out of hand
 
I think premature optimization is the reason of all evils, for example if you have two controllers which do exactly the same, instead of copying the controller and renaming it, people would include a special case inside one, then when business logic gets more complex that logic will be in one single controller full of if crap all over the place
Not talking about the request method
 
IGP
2:08 PM
Yeah, that too.
 
having to if between post and get, is a bit the result of a shitty router
which doesn't validates the request type
or if the user sets it to "any"
 
IGP
Another case is always

if ( request expects json )
// return json
else
// return view with data
 
haha
yeah
view = adapter pattern
or that's the way I do it
 
IGP
I've seen cases where it kind of makes sense
But it can get ugly
 
not really is just part of the route configuration, you choose which view adapters are available to that route and map extensions of the url accordingly
view: {
adapters:{
".json" : "json.adapter",
"default": "html.adapter"
}
}
etc
 
2:12 PM
@Danack / @ln-s an improved version of that gist: flavioheleno.github.io/how-do-i/classes/methods.html
 
IGP
@ln-s CakePHP kind of does something like this. It's probably the one thing I don't find completely disgusting about the framework.
 
I do it with my own stuff which I haven't published yet, maybe I will in the future
 
IGP
Nice
 
@FlávioHeleno looks better :)
 
@ln-s thanks! there is still a long path ahead, but I'm glad with it :-D
 
IGP
2:19 PM
With the version of CakePHP I'm forced to work with, this is handled by passing a $_serialize variable to the view.

// html view gets access to $var1 and $var2
// same endpoint with '.json' at the end only gets $var1
set(['var1' => ..., 'var2' => ..., '_serialize' => ['var1']]);
It's a bit hacky.
 
serialize = dog vomit
Remember the yagging a dog does when he is about to vomit? Exactly what happens to me when I hear "serialize"
Back in the day I knew symfony cache would get f* hard with that "cache layer" (pure serialize) https://nvd.nist.gov/vuln/detail/CVE-2019-18889

I didn't investigate further because as soon as I saw "serialize" in the code I said NO to it
so many things can go wrong with it
 
IGP
Ironically I don't think it actually uses serialize()
 
it does, or it did, haven't checked it
(again)
for whatever input use a non executable format, period
if you are going to store it
 
IGP
No, I mean cakephp's '_serialize' thing. I don't think it uses serialize in any way. There's no point to it
 
Oh
check deep, that name ... has a wiff of s* going on
 
IGP
2:33 PM
ctrl+F "serialize(" in cake vendor folder. 61 matches across 15 files. Oh boy
 
Hmmm
tasty
Been playing a lot of candy crush lately sorry
sweet
 
IGP
2:44 PM
As far as I can tell, serialize is used for caching, but not in the part that uses the $_serialize variable.
 
3:26 PM
Can we declare a method on the fly with ReflectionClass ?
 
@Mwthreex no
but you can do so with github.com/lisachenko/z-engine, which is not portable as it needs FFI.
 
ok ty
 
(new ZEngine\Reflection\ReflectionClass(MyClass::class))->addMethod('foo', function() {
// foo method body.
});
 
I thought I can do that but it looks like I don't and don't understand why not ?!
enum Foo { case Bar, Baz; }
 
I see
thanks
 
5:52 PM
when will SO dark theme affect chat
 
6:08 PM
er... has anyone ever seen php just swallow any output from the cli when there are extension loading problems?
like, when I uncomment an extension I know I don't have, the php -v and php -m commands return nothing
whereas they perform normally when the loading happens correctly
 
cmb
check the status code of the command
 
I'm not sure I understand what that means
 
echo $?
(on *nix)
 
cmb
yep; might be a crash
 
also, try php -d error_reporting=-1 -v
 
6:14 PM
PS C:\Users\fract> php -v
PS C:\Users\fract> php -d error_reporting=-1 -v
PS C:\Users\fract>
 
cmb
and echo $??
 
PS C:\Users\fract> echo $?
False
wasn't sure if that was literal so I was shy pasting it back :P
er wait is taht supposed to be php -r "echo $?" ?
 
0
Q: How to replace strings except in some locations in PHP?

OokerProblem I have a working script to mass replace all occurrences of listed strings: function replace_content( $text_content ) { $input = file_get_contents(__DIR__ . "/strings.json"); $data = json_decode($input, true); $textlist = array(); foreach($data as $item) { $text_con...

 
PS C:\Users\fract> echo $? php -v
True
php
 
@Derick I missed twitter.com/derickr/status/1479097479433969673 - was that public? (aka do you have a link to share?)
 
cmb
6:19 PM
no, that is shell command, and should print the latest status code; you can do php -v & echo $?
I mean php -v; echo $?
 
PS C:\Users\fract> php -v
PS C:\Users\fract> $LastExitCode
-1073741819
 
cmb
Windows; I've heard of that system. ;)
 
that does not look like a regular exit status
 
cmb
You've got a segfault
 
FFFFFFFFC0000005
 
6:23 PM
progress!
 
cmb
yep; segfault
@FélixAdriyelGagnon-Grenier see bugs.php.net/bugs-generating-backtrace-win32.php on how to generate a backtrace
 
6:34 PM
phpstorm complain about "missing calling parent constructor" but the subclass has the same signature and works as expected, so shy should call the parent constructor?
why*
 
Storm can't tell if the child constructor is duplicating all the setup functionality in the parent or not.
 
hmm... i think it should recognize the duplication ha ?
 
though tbh, there are times when calling the parent contructor is inappropriate.
 
@Danack It was on security@, so I don't think I should.
 
@Derick cool. yeah, thought it might not have been in open.
 
IGP
7:34 PM
I think I happened upon an oddity. It feels like there should be an achievement for this
 
8:14 PM
Achievement Unlocked: They hated him for telling the truth
 
IGP
Either that or a badge of shame
 
JRL
hey @Crell, how has CLion been treating you now that you have it working with php-src?
 
@JRL I'm not Crell, but it's fine for me. A few annoyances though, like how many clang-tidy warnings php-src has.
 
JRL
8:37 PM
@LeviMorrison yeah, that's for sure
were you also helped by the article i linked levi, or did you already have CLion set up?
i was surprised at how many people here were trying to work on php-src without an IDE setup
though, if horvath comes through with the cmake project, all that will become much easier
 
9:17 PM
I'm keeping my fingers crossed for that. Few things would be more beneficial than easy IDE access.
 
@JRL see, I've never used a debugger, so I didn't know what I was missing out on .-.
and to an extent, I still don't know
 
9:52 PM
@JRL I haven't done anything with it since I got it working. :-)
 
10:23 PM
@Girgias Maybe you're just so good that your code is never wrong ;)
What do you do when PHP segfaults?
 
@IluTov Hopefully have a test case so that I can run failed_test.sh gdb
And then hopefully figure it out via the stack trace
and printf debugging
don't do what I do
it's really suboptimal
bwoebi did teach me how to use breakpoints tho
 
@Girgias What do you think gdb stands for? :P
 
Well, yeah sure, but I really don't understand how to invoke manually and do other stuff to help debugging
 
@Girgias Me neither, I use gdb via vscode. I've tried it a couple times but gdb via cli seems very very tedious to me.
I can send you my config if you're interested.
 
cmb
gdb via VSCode should work fine in WSL(2)
 
10:36 PM
a clion plugin to run tests would be sweet
 
JRL
if you set up according to the article, you should have run configurations for it already
running tests that is
 
When I tried it I thought you had to run it from the menu then pick the test, rather than like PHPStorm where you can just run a test directly, or did I miss part of it
 
JRL
no, you have it right, but that's in part because for php-src it actually has to compile the runtime before it can run the test, so there has to be a run configuration
 
11:02 PM
Can I get notified on GitHub about new pull requests but not every single push of every single pull request?
 
cmb
@IluTov I'm afraid that's not possible. :(
 
@cmb That's super annoying :( It blows up your inbox after like a few hours.
octobox.io Not sure if that would help
 
11:30 PM
@IluTov Use email, filter email based on what you said, ignore GitHub notifications
Github notifications have become the equivalent of unread emails for me
 
@Tiffany I'll have to check if that's possible. Sadly iCloud e-mail rules are very limited (single rule, no pattern, just "contains"). I could do it via e-mail client but I read mails on mobile and I don't want to replicate the same rules on multiple devices.
 
cmb
Well, @Jeeves could poll via the GH API, and post notifications here. ;)
 
There's also a mailing list apparently. php.net/mailing-lists.php (Git pull requests). Tried signing up but it didn't work for some reason.
I have no clue how many e-mails it sends though.
 
I need to look at the jeeves code for how its integration with SO works. I want to have it automatically link a sad trombone MP3 everytime someone votes against a good RFC
 
cmb
11:45 PM
@Tiffany What kinda defeats the purpose of those notifications. Consider to change the watch status of the repos. "Participating and @​mentions" often works fine for me.
@IluTov for a while, all comments.
Pros and cons; at least someone should watch all comments to react on spam. :|
 
@cmb Unfortunately, if I see more than 5 e-mails it's an immediate delete for me.
The thing is, it's helpful to see all PRs as you can decide if you're even remotely the right person to give feedback. I don't wanna keep being notified if that's not the case. If it is, I'll engage right away, watch the issue and keep getting notified in the future.
But yeah, obviously moderation doesn't work this way, if nobody watches an issue.
 
cmb
I see your point. Maybe we should set up a GH action which only sends mails for new issues and PRs to some new ML. Probably doable, but infrastructure part might be difficult ("we such at infra").
 

« first day (4111 days earlier)      last day (828 days later) »