« first day (4000 days earlier)      last day (930 days later) » 

12:05 AM
IIRC, PHP-DI is or was based on a service locator pattern
 
@scorgn What is worse IMO is they are telling people to use property injection, effectively hiding dependencies
Also makes me wonder how you would even test it
> you will not unit-test it (that doesn’t mean you won’t write functional tests on the interface though)
I guess that answers it :D
 
wat?
 
@Tiffany Oh lord, I am starting to doubt my company's decision to start using it
@PeeHaa I had to keep looking at other explanations of property injection because I thought I was misunderstanding the first couple
Why would anyone do that??
 
If you're trying to use the constructor for something else?
 
12:19 AM
Although it does say "Property injection is generally frowned upon, and for good reasons:"
 
Which I cannot think of a reason to do, other than because you're mixing a service object and a value object, which means you're already doing it wrong.
/me wants to write a new PHP 8-native DIC at some point, just for funsies.
/me is probably clinically insane.
 
Contribute to auryn instead perhaps?
 
What fun is that? :-P
 
If I find myself at one point thinking "Maybe property injection would be a solution here"
I'll start looking for a specific point in my life where it all went wrong
@PeeHaa I used it in the past, but I am not sure that I will be able to convince my company to use it
 
I'm sure DI would be just fine. As long as you use it correctly :)
Which goes for all injection containers
 
12:24 AM
TYPO3 is already using the Symfony container, and the odds of me dislodging that any time soon are slim. I have plenty of other fights to pick instead.
 
Is Symfony container worse than PHP-DI?
 
No, it's actually extremely powerful, and does a lot of things right.
 
@PeeHaa The fact that it only can inject singletons scares me haha
 
@scorgn Pretty sure you can tell it not share instances
Otherwise the entire thing would fall apart pretty fast
 
@PeeHaa Maybe I misunderstood the page?
 
12:26 AM
The problem I have with it is that it is SO flexible, yet its configuration is all driven by YAML, and in code it's class designs that made sense in PHP 5.3. Most of the architecture dates from 5.3, and added features over time.
 
It seems pretty clear
Scopes have been removed in PHP-DI 6. Read below for more explanations. From now on, all definitions are resolved once and their result is kept during the life of the container (i.e. what was called the singleton scope).

Scopes were used to make the container work as a factory: instead of using scopes you can either:

use the Container::make() method,
or inject a proper factory object and create the objects you need on demand.
 
@scorgn Wait, you want a new instance each time? Then... you're not really doing DI. :-)
 
I don't NEED a new instance each time :P
 
That does sound weird yeah
If that really is the case it's pretty stupid if you cannot control whether an instance is shared or not
 
But it would be nice to know that the implementation of something that I'm using isn't restricted to singletons
@PeeHaa As a solution it suggests....
class Service
{
    public function __construct()
    {
        $this->form = new Form(/* parameters */);
    }
}
 
12:28 AM
Why? :-)
Really, I've never used DI for something and wanted a new instance each time. A container that only did static singleton objects would suit me just fine.
 
@scorgn ugh
 
@Crell By principle I try to write code where injected objects could all be shared, but I work in a big company with a lot of people who will use singletons as global objects
Maybe I could convince my company to use Symfony container. I think that's what Laravel's container was built on and if you cut out 25% of the functionality it actually was pretty good
 
I've never had an issue with PHP-DI, and never bothered looking at its internals
 
I don't know from Laravel's container.
99.4% of the time, any non-cache state in an object managed through the container is a critical bug and should be treated as such.
 
@scorgn The laravel parts? :P
 
12:35 AM
@PeeHaa Probably so :P
Whoever thought that Facades were a good idea (cough Taylor)
Or.. shudders real time facades
I have no idea what they were thinking
@Girgias That does make me feel better
 
I'll say, I've never worked on actual business production websites
I'm just a pleb who uses it because well, it works for me, and I don't use a framework anyway
 
I suppose it makes sense that any non-shared instance should be created through a factory
We're implementing Slim into a 12 year old codebase, it's pretty flexible in how it works so we can choose which DIC to use
The decision to use PHP-DI was made before I came on but we haven't made a ton of progress yet so we could turn back
 
Again, it's probably fine as long as you use it correctly
 
95% of your codebase shouldn't care what DI you're using. At most it uses PSR-11.
It's just a question of which one you want to use for the config files, however those work.
 
We have a lot of developers on other teams who don't understand dependency injection or dependency inversion principle so trying to get them all using it correctly is definitely a challenge
 
12:44 AM
Make sure there are capable people doing code reviews at least
 
We're working on that
 
In the mean time set up a CI rule to shout when somebody injects the container :D
 
Now that's innovation
The one who does MRs right now has been with the company since the beginning and is writing code on the same lines as everyone else
It's a struggle to not step on toes but also be like "stop writing static methods for everything"
 
I assume there is a big Utility class with a fuckton of static "helper" methods involved too :)
 
utilities.php, 4229 lines
 
12:49 AM
:D
 
But it's actually not a big Utility class believe it or not
All functions :D
 
Class with static functions or just plain function are basically the same for all intents and purposes (sans autoloading)
 
Yeah true
Me and a couple other developers were brought on a few months ago and we're slowly trying to fix things and enforce other things
 
Din
1:49 AM
how can I use $user-name style in an arrays OOP mysqli foreach loop
 
2:12 AM
Do you mean arrow operator? Cause you can't, unless you're working with an object. Unless you want an array of objects.
Or an object container of objects
Repository pattern can be fun to work with
Is property injection when there's an array passed into a constructor, and the array is looped over, and an object's properties are dynamically set with __set?
 
Incident with GitHub Actions ・ GitHub Pages has Partial Outage
 
2:53 AM
@Crell it supports XML and PHP configurations too.
@Tiffany property injection, is public T $t and PHP DI injects T into it after object construction.
@PeeHaa it was probably renamed to injector ?
auryn did autowiring before any major DIC implementations did so, it inspired other DI containers and frameworks
 
All issues have been resolved!
exit; does not terminate program ・ *General Issues ・ #81485
 
 
5 hours later…
8:20 AM
yo phomies
 
yo joe
 
8:51 AM
o/
 
@LeviMorrison had any chance to look at bugs.php.net/bug.php?id=81380 already?
 
 
2 hours later…
11:18 AM
@beberlei the use of rt cache in observer api is not correct
 
Hey what up
 
no wait, it is a caching problem but root may be in o+
now it looks like compact literals is doing something bad
@LeviMorrison here's what is happening ... after reload, result.num of INIT_FCALL (which is cache slot num) is 0, and so occupies the same slot as the observer data, INIT_FCALL is fetching observer data and trying to execute it as fbc ... not quite sure why yet ...
debugging apache reload is a huge pita, never done it before ...
cache_size before reload is 16, after is 8
 
12:23 PM
@JoeWatkins thanks for taking a look
 
12:38 PM
@JoeWatkins would you think reassigning to dmitry and looping him in would be wiser?
 
@beberlei actually yes, it looks more related to optimizer than observer ... it's pretty tricky to debug, my first guess at compact literals is wrong, afaict it calculates correctly ... I can't figure out a way to watch the right stuff while processes are being destroyed ... simply describing the behaviour in more detail may be enough to give dmitry a good clue at what is actually happening ...
something somewhere is doing a cache size calculation wrong, possibly ignoring reserved handles, but I can't spot what precisely is happening ...
make noise at dmitry, if still open in a week or something I'll spend another hour on it if no one else has any ideas ...
 
1:25 PM
@beberlei here's a debug session you can attach to report
krakjoe@Fiji:/opt/src/php-src$ sudo service apache2 restart
krakjoe@Fiji:/opt/src/php-src$ ps aux | grep apache2
www-data  330780  0.0  0.0 2144832 7236 ?        Sl   15:21   0:00 /usr/sbin/apache2 -k start
krakjoe@Fiji:/opt/src/php-src$ sudo gdb -p 330780
-- SNIPPED --
(gdb) break zend_accel_load_script
Breakpoint 1 at 0x7f30928ca6ae: file /opt/src/php-src/ext/opcache/zend_accelerator_util_funcs.c, line 229.
(gdb) c
Continuing.
[Switching to Thread 0x7f309130e640 (LWP 330782)]

Thread 2 "apache2" hit Breakpoint 1, zend_accel_load_script (persistent_script=0x41edf380, from_shared_memory=325
I've watched cache size (in persistent script) until process is destroyed and it has not changed, something in-between the process being destroyed and recreated (which I cannot find a way to debug) is doing something bad to cache_size ... I'm sure dmitry is going to see what is happening but I don't ...
 
1:48 PM
ah
 
@beberlei No, but @bwoebi did a fix recently in the observer space: github.com/php/php-src/commit/…. Not sure if related; haven't looked, just giving you a breadcrumb. cc @JoeWatkins
 
@cmb Finally got a good stack trace, with symbols: https://bugs.xdebug.org/view.php?id=2016#c6042 — but the line 628 doesnot have the xdebug_set_in_ex call in it:

628 return xdebug_call_original_opcode_handler_if_set(cur_opcode->opcode, XDEBUG_OPCODE_HANDLER_ARGS_PASSTHRU);

any clue how that's possible?
 
@LeviMorrison yeah, that's unrelated
 
What's the purpose / use case for the emergency_restart settings / system in PHP-FPM? (Someone mentioned it elsewhere - I suspect they just saw it mentioned in a "tuning guide" / forum post)
 
cmb
2:05 PM
@Derick I assume that @ 628 + 2f indicates inlining
maybe a real debug build would be helpful?
 
diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c
index 4d4b1ffe09..adf9c57785 100644
--- a/Zend/zend_extensions.c
+++ b/Zend/zend_extensions.c
@@ -207,7 +207,7 @@ void zend_startup_extensions_mechanism()
 {
        /* Startup extensions mechanism */
        zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
-       zend_op_array_extension_handles = 0;
+       //zend_op_array_extension_handles = 0;
        last_resource_number = 0;
 }
/cc @bwoebi @LeviMorrison @beberlei
 
@cmb I think me reproducing it with a real debug build probably would be. But I need apache on windows, and I wouldn't know where to start :-/
 
@PatrickAllaert did you see my email?
 
cmb
@Derick Well, I have not been able to reproduce, so even if you tried, you may not have been either. I wonder whether there are other extensions involved (uopz and the like), and whether opcache file_cache is clean.
 
2:24 PM
no uopz in trace
 
cmb
yeah, but that ZEND_USER_OPCODE_SPEC_HANDLER might be the "wrong" one for whatever reason
 
I do mess with these opcodes... that's the whole point here. I think it might be a use after free for my set of opcode handlers. @cmb Which mode did you have configured?
 
cmb
2:43 PM
@Derick I used the settings of the OP (xdebug.mode=debug) and added xdebug.start_with_request=yes (to be able to test without IDE)
 
hm. zts/nozts, first or subsequent request?
 
cmb
zts (Apache requires that); many request (ab -n 1000 -c 10 or so)
 
and nothing in valgrind either if you try?
sorry... windows.
 
cmb
github.com/php/php-src/pull/6964 might help, but I'm stuck there :(
 
I got a good patch now @beberlei
I'm pretty sure that's correct, I've no idea how to test it, so all eyes please
 
3:11 PM
@JoeWatkins is minit called twice within a process lifetime if you apache reload, or how exactly does that fix it?
 
3:21 PM
apache forks a new process (that's after minit before rinit) and then calls startup (which calls module startup routine) on it
 
@JoeWatkins but, it does not even mshutdown in between?
 
krakjoe@Fiji:/opt/src/php-src$ grep PHP /var/log/apache2/error.log
krakjoe@Fiji:/opt/src/php-src$ sudo service apache2 restart
krakjoe@Fiji:/opt/src/php-src$ grep PHP /var/log/apache2/error.log
STARTUP PHP
[Tue Sep 28 17:23:37.449496 2021] [mpm_event:notice] [pid 459147:tid 140689196215616] AH00489: Apache/2.4.46 (Ubuntu) PHP/8.0.12-dev configured -- resuming normal operations
krakjoe@Fiji:/opt/src/php-src$ sudo service apache2 reload
krakjoe@Fiji:/opt/src/php-src$ grep PHP /var/log/apache2/error.log
 
It should
apache (prefork) would always do MINIT/MSHUTDOWN, and then MINIT/MSHUTDOWN per apache worker process
 
okay, good to know
 
PHP-FPM does not do that. It does something bizarre, and I consider that a bug.
 
3:27 PM
@Derick fpm does? startup, fork and then at the end of the worker lifetimes a shutdown per worker?
 
I can see that's what it does, but think it's wrong ... apache should minit then fork and not need to call minit in children
that's what all code assumes is happening
unless it calls mshutdown then minit in children, php will leak
 
@bwoebi Yes, it does one MINIT, and multiple MSHUTDOWN. That's weird, because you then can't init the module to use it for all the workers. What it should probably do is: MINIT/MSHUTDOWN in the main process, and a GINIT/GSHUTDOWN per worker thread, and a RINIT/RSHUTDOWN/ZEND_POST_DEACTIVATE per request.
@JoeWatkins Yes, that is what it is supposed to do. MINIT/MSHUTDOWN in main process, and then MINIT/MSHUTDOWN for each child process.
 
fpm is doing it right
 
It most certainly was not when I looked into it a few weeks ago.
It called MSHUTDOWN multiple times, and only one MINIT. Making my clean-up (of a thread) not possible to do nicely.
 
it is, the proper way is MINIT then fork, children are already in MINIT state, don't need to call MINIT again, the children need to call MSHUTDOWN
 
3:34 PM
No. You misunderstand. That's what GINIT/GSHUTDOWN is for.
Each process: MINIT/MSHUTDOWN
Each thread: GINIT/GSHUTDOWN
Each request: RINIT/RSHUTDOWN
 
not each process needs to call MINIT in a prefork model, that is wrong, the children are already in MINIT state
 
No. You are wrong. If each child process does not have an MINIT/MSHUTDOWN cycle, then you can end up shutting down (stopping a thread, for example) multiple times for only one MINIT.
 
I'm not
 
Whether Joe is right or Derick is right, you should consider spawning your thread in the fist request using pthread_once or similar.
If you use INI or env var config in that thread, then you probably have to for correctness reasons anyway, because fpm's .conf can set ini and env vars and you won't seem them until the first request.
 
I think the most important thing should be that every SAPI adheres to an identical model instead of apache doing one thing and fpm another
2
 
3:42 PM
Exactly.
 
Don't have the time right now, but can show that apache prefork does it right, tomorrow. PHP-FPM does not.
Apache prefork always did it like I wrote earlier.
 
sapi and streams can fight over what is the worst code, everything around them moves on, gets better ... I've always wanted a new sapi layer as much as a lot of people want a new streams layer, it's such a task though and for not much gain, people are mostly happy to just restart apache/fpm when it crashes and move on
 
SAPI was very well described. The FPM implementation ... that's something else.
 
@JoeWatkins the headers handling is quite wtf … would be cool if there was shared code for that, pushing info into SG() for in and out headers…
 
4:02 PM
@cmb Will do. It's been on my list of things to look at, but I haven't been able to get to it. I'll try to prioritize it for this week.
 
4:13 PM
@JoeWatkins thank you so much :)
 
4:49 PM
Is the @internal tag supposed to be specific to a direct namespace? I always thought it would be used in a library to denote "This class should only be used by the library itself and not by projects using the library", but Phan says "Any element marked as @internal and accessed outside of its exact namespace (disallowing both child and parent namespaces) will result in Phan emitting an issue."
 
@scorgn i have seen both uses, i am not sure if its defined
 
Hmm, I am just going to suppress that issue in my package :D
 
@cmb I no longer have rights to the php/pecl-php-uploadprogress repo
Is there anyone around who's able to grant me access to php/pecl-php-uploadprogress? I used to have karma for it.
 
5:09 PM
@ramsey it says you're still a maintainer. what makes you say you don't have access to it?
 
I don't have permission to merge anything or push to the repository
 
ah the repo, not the pecl...
 
yes
 
cmb
@ramsey invite sent :)
 
@cmb Thanks!
 
5:39 PM
wow. so some time ago, I wrote a store method where it first tries to insert to the db, then on duplicate tries to update instead or throws again and it sucks so much, what a bad decision that was. my "bite in the ass" here is any field can be duplicate when a table has more than one unique index, not only an id.
and this fact was completely and thoroughly hidden behind my "smart" "Oh let's look at the specific sql error code and act accordingly" idea.
 
@cmb Do you have any pointers on getting these Windows builds to pass? github.com/ramsey/pecl-php-uploadprogress/runs/3735735759
I followed the configs you set up on other PECL repos, but I suspect I might have missed something
 
cmb
@ramsey everything looks good (besides some failing tests); however, GH axtions default to fail fast, so if one job fails, the others are terminated
 
doh!
If forgot to turn that off on the Windows job
my bad
 
@ramsey Steal it from Xdebug: github.com/xdebug/xdebug/blob/master/.github/workflows/…, although ... never mind :-)
 
cmb
maybe use run: nmake test TESTS="--show-diff tests"
 
5:57 PM
Perfect! That should help me fix these failures. github.com/ramsey/pecl-php-uploadprogress/actions/runs/…
Do I need to run tests on both threadsafe and NTS builds for an extension like this?
i.e., does it matter?
I guess a good question might be: which version do most run on Windows? NTS or ZTS?
 
things I hate: customer content with ▒
I may just find/replace that instead of trying to convert it
 
6:33 PM
phpstorm users, do you know if there's some setting that could help me get it to recognize namespaces accordingly to what I think should be the case? I have the psr-4 in autoload entry like this :
"psr-4": {
  "": "src/",
  "RJFX\\": "src/",
}
I expect phpstorm to be able to recognize both Model\Something and RJFX\Model\Something if need be, but when both entries are present it doesn't recognize the RJFX one as valid according to psr-4 settings
removing the empty entry makes it not highlight the RJFX ones are faulty, but then the autoload does not autoload
 
@FélixAdriyelGagnon-Grenier "if need be" - Unless you have a real need now to do that, I would avoid it.
Autoload not working is nothing to do with PHPStorm - did you rebuild the composer autoloader after changing composer.json?
 
@AllenJB sup Allen. Yes, of course I did, that's not the problem here. I want PHPStorm not to highlight the namespace "RJFX\Model\Something" as faulty. I do not understand why it does because of how it's written in the composer.json file.
namely, I presume that writing both these would hint PHPStorm enough so that it knows that the namespace is ok, and I know it can, because when I remove the "": "src/" entry, then the RJFX one is not highlighted as faulty.
 
ohai @AllenJB, not seen you for a while... tho tbf I am rarely here these days
also totally random question @FélixAdriyelGagnon-Grenier - is "gnon" suffix in the "Gagnon" in your surname pronounced like "Sauvignon"? with a sort of silent G and an implied Y sound?
...supplementary question: why does French not use ñ for that? :-P
 
7:04 PM
@DaveRandom bake off
:O
first episode is on netflix now
 
@Tiffany pffft, same to you
oh, I see what you mean
:-P
 
@Tiffany that is not acceptable, the only suitable direction to "bake" is up :)
 
I don't have time for it this week and tbf I like to start stuff like that around week 3/4, when you can binge a couple of eps and be left only with ppl who actually have a chance of winning... best will in the world, the ppl who go in the first couple of weeks are generally not the same standard :-P
(tho they are still much better than me)
 
@DaveRandom so, the first G in gagnon is a hard one, such as with "gag", the english word, and the gn is like sauvignon, yes :)
@Tiffany oh lol wait it's the name of a series
 
@Tiffany I'm about to watch ep 2 :-D
A little delayed so we can skip through the sodding ads.
 
7:11 PM
^ also that
 
<3 netflix has no ads
 
But is a week late? :-)
 
@DaveRandom I don't know. Why would we, isn't that spanish (and its numerous direct declinations) thing?
 
And probably not available on UK Netflix
 
@FélixAdriyelGagnon-Grenier well yes but Spain is right next to France :-P tho the languages don't share that much I guess, other than some latin roots. It seems slightly anomalous to me because French does make significant use of diacritics... but then my first language is English which doesn't really have any (except loan words)
 
7:19 PM
@Derick I think it's better this year, I think last year we had to wait a month or two until season finale finished airing
I think
 
8:19 PM
Vague question, are there any consequences I may not be thinking of for defining a class conditionally? Specifically if (...) { class A extends B {} } else { class A extends C {} }
 
I don't know; what consequences are you thinking of?
 
@DaveRandom Trying to make sense of French, you're a brave man
 
@adsr I really suggest you don't do that, because static analysis tools, coworkers, and such may hate you. But, if it's because some interface doesn't exist on earlier versions or something... dunno, there are worse evils.
 
8:31 PM
@LeviMorrison Haha I should point out it's not my code. I'm doing a code review thinking of potential defects. It's being proposed as a way of ramping up new code, not a permanent solution.
 
There is nothing more permanent than a temporary solution.
 
That is often true!
 
 
1 hour later…
9:58 PM
@FaizanAkramDar Yeah that
 
americas.jump.php.net doesn't appear to be responding
europe is, though
 
@Tiffany no worries, I won't spoil ...
 
10:57 PM
@Dharman I appreciate your doc reviews, but sometimes you ask some pretty stupid question while making a valid point. "simple types" is literally the first sub-section of that page
I'll amend the "larger" usage tho as I didn't even see it the first time around
 
Sorry, I meant larger specifically as opposed to simple
 
Right, yeah I'm trying to think of something better
 
I see that simple is used elsewhere and that I have problem with.
 
Why tho?
 
Why not larger? Or why I'm ok with simple types?
 
11:00 PM
Why you're not okay with simple types
 
Shit, i made a mistake inny words again.* I have no problem with
I am going to sleep
 
Okay, was confused lol
Well good night :D
 
Basically, use composite instead of larger and try to reduce repetition in that sentence.
 

« first day (4000 days earlier)      last day (930 days later) »