« first day (3572 days earlier)      last day (1376 days later) » 
02:00 - 12:0012:00 - 00:00

2:10 AM
posted on July 25, 2020

I’m keeping this quick. I am (for real) prepping for Hurricane Douglas tomorrow. It’s not my first hurricane by a long shot, but it is my first experience with one in Hawaii. I have food, water, etc. for a couple weeks. The pandemic saw to that. I’ve picked up anything nearby that could get carried in the wind. As for flooding and power outages, I have a long way to go. It’s supposed

 
2:45 AM
I want to make sure I understand a concept correctly. Union types are like int|float where $number could be an int or a float. Intersectional types are like Rectangle && Square where $shape would be an instanceof Rectangle & an instanceof Square?
 
Yup.
 
👍 thanks
 
 
1 hour later…
3:52 AM
A more "accurate" math example would be two interfaces: "IdenticalSideLength" and "IdenticalDiagonalLength".
A union of those two types gives you the choice between a Rectangle, a Rhombus and a Square, whereas the intersection only gives you the Square.
Basically a union can only widen the valid set whereas an intersection can only restrain it
 
4:41 AM
I'm looking at design patterns and I can't for the life of me understand what the point of the factory here in the factory pattern is
And I know the AWS SDK even does it but I don't understand the advantage of resolving a WriterFactory class just to use it to create a JsonFactory, instead of just resolving the JsonFactory in the first place
I guess so you could put logic in the factory method while keeping it out of the constructor?
 
Have you read Patrick's book. He kinda explains it in his book.
 
I started it. I have it in my closet
I tried to find the guy to ask him about Switzerland
It looks like he just kinda disappeared
 
He was going to work on another book.
I wonder what happened to him.
 
No idea
I guess then, does using dependency injection bypass the need of a factory class/method? Or, is using dependency injection utilizing a factory method?
 
4:59 AM
I had the same question.
When reading his book.
 
I'll try to do some googling
I'm looking for a new job so I figured I should probably read up on all the design patterns
 
Where you located
The company I work for will be hiring soon.
 
Raleigh NC but I might be open to moving as long as it's remote until the pandemic is over
Where are you?
 
California. All remote for now. Provably the rest of the year.
 
Okay cool. I'm going to be putting in my two weeks in a week because my current job takes too much out of me to where it makes it hard to focus on getting a job. I have a bit of a savings anyways
 
5:04 AM
In what way?
Demand to much?
 
Yeah working 12 hour days lately
 
This is kinda hard aswell.
maybe not in the hours. but the owners demand alot.
 
I would stay but I'm also paid less than I know I can get with my expertise, and less than my coworker who knows less than me (he said himself)
 
Dam
that is messed up
How much you making?
 
I like stepping up to the challenge, taking on more work and responsibility, pushing myself, etc... but I gotta get paid for it lol. I imagine every dev has parts of their job that are really stressful
 
5:07 AM
Unfortunately most of the time, the only way to get more money is to change jobs.
 
Yeah unfortunately so. I think the place is going to collapse without me, or so the front end devs had said (very small team). I feel bad but, I did ask for a raise and didn't get anything
 
I was going to something similar. I had a meeting with the owner.
I was able to talk my way to a better salary.
 
I wanted to do that but I didn't really wanna step on my manager's toes
 
That book helped me somewhat
that's what you have to do. I had the same situation with my manager.
They were looking out for themselves.
 
I was planning on figuring out the best way to do it (especially with WFH) but then the IT director literally yelled at me in front of the team for not having something finished (when it was finished), and just wouldn't listen to me trying to explain anything so eventually I was like, this place isn't worth it anyways
Yeah I was definitely planning on it
 
5:12 AM
Yeah I feel you on that.
I wouldn't wanna work there either.
 
Yeah, like my manager said I needed to do 3 things, then the IT director was like "Why is it not done you just had 1 thing to do you shouldn't be working on anything else" and I was trying to be like I do have that one thing done already but my manager is making me do the other 3 things before we deploy but he wouldn't listen, and my manager didn't speak up either
 
That's the director's fault.
He's not communicating with the team as he should.
 
Yeah exactly
I stayed calm but decided there and then I was done with that place (a lot of other things piled up too)
 
The entire team should talk to him about it.
It
It's like in sports if one member of the team not performing as they should. Is the difference between winning and losing.
 
Yeah they did, well they told my manager to
 
5:18 AM
What he say after that?
Did he apologize?
 
That's a good analogy
Nah he hasn't said much to me since
 
Have you guys been working remotely?
 
Yeah
I'm not a fan of it
 
They got strick hu?
Me either. The product lead was on us at first.
lol
I adapted to it.
 
Strict you mean?
My last job was WFH I just get unhealthy lifestyles
 
5:23 AM
yeah
 
Not really
Things for the most part stayed the same
Where do you work? Out of curiosity
 
Would there be an interest in supporting idea of applying ini directives by environment variables like PHP_MEMORY_LIMIT etc which easies a lot working with php docker containers??
 
A small company that deals with government regulations.
they have this compliance software that keeps track of all the regulatory compliance.
Data-intensive.
 
There is a topic on ML which proposes a different approach but by that I started thinking of allowing to interfere with any ini directive by simple lookup with name transform
 
What industry is the company you work for?
 
5:28 AM
@brzuchal This could be done with a library right?
@SalOrozco IT training
 
Not all things if for instance dl is disabled
@Alesana if dl is disabled you cannot mimicks for eg PHP_EXTENSION
Another thing could be running script before all IIRC there is an ini directive for that
 
Ah okay that makes sense. I think think it would make sense in the instance of docker but I would almost think to build it within docker would make more sense
 
Also configuring opcache before running any script by env variable would also be nice
The thing is docker is just an example
You could just export an env variable in your shell which has impact on other php instances executed inside
Imagine running script with memory limit higher which fails cause it calls another php script by exec or proc_open inside
You could fix it by exporting local env variable and without touching ini files
 
I would definitely have used that this last week
 
Git mergin'.
 
5:35 AM
This way ini files remain as is but we add another way of applying ini directive values with higher priority in the middle of ini files and -d options
Another thing which came to my mind with this is a little Refactor of zend_ini into sort of zend_config cause applying ini directives with -d options is no longer ini related and ini is just a file format.
Now I'd like to know if it's worth exploring and spending some time on it. If it takes even 1yr to make it happen wisely I'm on it but need to know the feelings of it.
 
Personally I think it would be a good idea but my opinion isn't worth as much as people who may be more experienced
 
6:19 AM
Maybe I should hire a tutor to go over all these design patterns with me because there's a few of them I just don't understand the purpose
 
Which ones?
 
The Factory patterns are a bit confusing to me because it seems simpler to just instantiate an object rather than instantiate the Factory then use that to instantiate the Object
But I'm used to injecting any dependencies so maybe if you're not using dependency injection it would be useful in that manner?
Also the Bridge one seems like just not using an interface but just with extra steps lol.
> Decouple an abstraction from its implementation so that the two can vary independently.
Why ever would you want the implementation of an abstraction to vary from the abstraction
 
You not always able to instantiate an object with additional logic, so moving it into the factory which can give you objects implementing specific interface allows you to reduce compllexity of class which instantiates an object
 
So in Laravel I can define what objects should be resolved in a service provider, is the service provider just one big factory?
 
For instance I use a HttpClient factory with dedicated methods which allow me to create a GuzzleClient with additional middleware for OAuth2 with specified credentials passed into the method arguments.
Provider in Larevil indeed is sort of a factory but I like to think of it as a Symfony Bundle
This thing is framework specific and I always like to be decoupled from framework so I'd use my own factory inside the service provider
I also use the HttpClient factory in my domain (commands, etc.) they use it for creating a HttpClient preconfigured for specific OAuth2 credentials
Maybe am not good at giving examples
But the biggest benefit it gives you is extracting a specific logic and helps you with achieving single responsibility
 
6:29 AM
Okay that kinda makes sense then. So if I want to switch from being able to use a Car or a Truck, I can have a "VehicleFactory" then just do "makeVehicle()", but in that method I can easily switch from a car or a truck?
 
It's easy to write a unit test on that logic which is inside factory if it does only one thing
 
That makes sense as well
So then in that logic I would say something like "if ($weather->isRaining()) { return new Truck(); } else { return new Car(); }`
 
Yes, and that's easy to test cause you have a specific input and expect a specific output
You can easily write a unit test which covers this
But if you need more input parameters in complex optional configuration you should go with the builder pattern
 
Okay that makes sense. And I guess in the Provider I could bind the Car class to the Vehicle interface, but if it starts raining after things are bound then that's where it could get tricky?
 
I would not go that path
IMO it whould be used within your logic then
Because you're making a decision which is made on specific input in your business logic
 
6:34 AM
Okay so that makes sense
 
The things in service providers should help you with getting services not entities or value objects
 
Right right
 
Car and a Vehicle are not services
That's why it's called service provider :D
 
That makes it a lot more clear
 
@Danack Any update on this? All I know is that it's this Saturday.
 
6:35 AM
Haha I never actually put that together, even when binding services to interfaces in the Service Provider
 
I think that taking a look on different service providers may help you with understanding how it should be used
 
Yeah that does make a lot of sense
Thanks for the explanation
You can't just type hint a "Vehicle" interface and have it inject the car or truck
You would have to type hint a VehicleFactory interface, and then it can use the current point to decide whether it should use a car or truck (when you ask for the vehicle)
 
morns
 
mornin
 
7:34 AM
I've expressed a little bit more on the idea with environment variables as an additional configuration provider and some small changes in INI directive system here news-web.php.net/php.internals/111199 Any thoughts?
 
morns
 
8:35 AM
@brzuchal I was just talking to JetBrains about that for PhpStorm and Xdebug 3 the other day. Due to "the docker effect" allowing settings to be made with an environment variable makes sense. (I suggested to remove that functionality from Xdebug 3, where you can use XDEBUG_CONFIG env var to already set some settings.
Will reply on list too
 
we have added more environment variables to tideways php extension as well for docker users, essentially most important "tideways.*" are also available as "TIDEWAYS_", a generic PHP_ mechanism would be nice. though the ambigoutiy with . and _ is meh
 
@Derick Thx. You think it's worth of taking a bigger pile and refactoring the zend_ini* so they be more like a config not an INI settings anymore?
@beberlei that's an issue, but as I believe authors should consider that when choosing a config name, right?
 
For which settings would it be really useful though?
And with . and _, I'd accept both.
if both a foo.bar and foo_bar exists, then well, screw it
 
I think env var should allow only _ but should lookup for config names with a transform for all . into _
 
@Derick opcache ones, date.timezone, memory_limit, default timeouts, extensions
 
8:39 AM
@brzuchal That seems sensible
 
PHP_DATE_TIMEZONE would work
 
@beberlei Extensions isn't really ... possible.
or maybe it is
but I am not touching that one
 
if there is date_timezone configuration then screw it and modify both
 
Does it matter to make it a generic thing?
@brzuchal There shouldn't be both
 
in the end the generic solution should be less code and avoid future reports where people request this and that other variable
 
8:41 AM
It's gonna be odd when talking about modifying ini settings via environment variables
 
@beberlei Sure, but I'm going to need this in PHP 8 (for Xdebug 3), and that's too late now.
 
IMHO it's already odd talking about it in relation to -d CLI options or .htaccess configuration
 
yeah i guess it requires some research and an RFC :)
 
I'd like to know many supporting thumbs up I could get on it
 
@brzuchal do an informal poll on the wiki, tyson did this a few times now
 
8:43 AM
My most important one is "xdebug.mode", so I might just introduce a XDEBUG_MODE env var, or a PHP_XDEBUG_MODE one with forwards compat in mind
 
In the past I've made many mistakes making RFC's with more or less of investigation etc. so if spending some time on it, I'd like to know if it's worth
@beberlei Ok, that's an option I could write a raw RFC and then arrange a straw poll
 
As override order, I'd do: php.ini setting, env var, .htaccess and friends, ini_set() in script
 
I'd propose to have a multiple config providers and register them in specific order which determines override order
 
^ don't forget fpm has it's own set of additional settings plus admin+ settings which enforce certain settings to become read-only
 
@brzuchal Don't over complicate things though. Simpler RFCs are easier to pass
 
8:46 AM
Indeed, that requires a lot of research
Hmmm
 
@Sjon The admin_value thing is something that's also a standard thingy; the apache configs also support that
 
@brzuchal config providers? i am with derick on keeping it simple and just work on environment variables
 
@Derick sure. But it makes things a bit more complicated
 
@beberlei I though it could make things more clear internally, but I may be wrong
It's just config from INI files, env variables, extensions and user by ini_set are 4 sources of these settings
 
I have looked into the ini code in the past. It's not pretty.
 
8:51 AM
Indeed that's why I was thinking of moving needed structures from zend_ini_entry* into zend_config and alias them for start then move functions responsible for registering and overriding, then make zend_ini one of the sources where these configuration options can be updated/overriden
This would allow to limit changes in the API cause extensions could still use the same functions but interenally they'd get elsewhere
for start
Dunno if it makes sense this way but I am just thinking out loud
Oh, and we shoudl not forget about Windows Registry, that's another source of config values
Only Windows specific and that's why I was thinking of a provider
Where should the Windows Registry be in override order? Before env vars, right?
@Derick considering .htaccess and friends it also applies for .user.ini where config values can be set per directory/hostname? If so then what happens if different "xdebug.mode" is set globally and different in for instance public_html/.user.ini with [PATH=public_html] section ?
Which one the env variable overrides then?
I guess the one from .user.ini if script path is public_html...
 
9:07 AM
@brzuchal php on windows does not have registry support for 25 years now (or?), why would we want to add it?
 
probably a good start would be a documentation page (which might already exist partially) explaining where settings can come from and in which order they are applied
 
I - INI files
E - environment variables
X - extensions
U - user by `ini_set()` and `.user.ini`
order - IEXU ?
@beberlei I read on manual
> PHP_INI_USER Entry can be set in user scripts (like with ini_set()) or in the Windows registry. Since PHP 5.3, entry can be set in .user.ini
TBH TIL there is a .user.ini thing
 
TIL windows registry ini changes exist :P
 
One more question, the MH is being invoked each time the config value changes does that mean if it's set INI file then it invokes MH once, then second time when environment variable is set and then third time when it's applied in -d option on CLI ?
That's three times of calling MH, right?
@beberlei So we both learned today something about INI directives :D
Regarding the Windows Registry: if that works, which I dunno...
@beberlei calling MH after extension default value is overriden by INI files, env variable and by -d option would be a good thing, right?
Or it already works like that?
 
imo that order should be EUI with E being most important, I'm not sure if/why extensions should be handled different from PHP core defaults, eg. least important
 
9:21 AM
I should modify the list and move out ini_set() cause it's runtime
And if considering both I and U are INI files related we end up with core/ext being overriden by env vars then optionally by any INI files (php.ini or .user.ini) and then optionally on runtime
So the .htaccess and family would be handled before env variables which can override them, dunno if that makes sense, weird
.htaccess is similar fo .user.ini which works per directory there IMO it should override env variables but is populated by ext
@Derick would it make sense to register all configuration settings internally with _ and replace all . on lookups everywhere? I mean even in ini_set('date_timezone') for eg. ?
 
Goood morning!
 
9:40 AM
\o
 
@beberlei Dmitry finally didn't implement the JIT config changes, right?
 
cmb
@brzuchal just checked, and seems to work as documented
 
@cmb Great and it applies configuration settings before or after .user.ini overrides it?
 
cmb
individual per-directory settings appear to override all settings in ini files
 
@Sjon you choose the opposite ordering, if considering the override order this would be IUE
 
9:50 AM
Hi can anyone help me for this please
https://stackoverflow.com/questions/63112308/how-to-append-the-data-from-database-to-html-select-box-using-ajax
 
So with R standing for Windows Registry this would be IURE, right?
@cmb does above make sense?
Ohhh crap forgot about the CLI options let's say it's C (from CLI) or D (from -d flag)
IUREC - order of override
 
@brzuchal are there cli options that modify ini-settings which are not done through -d ?
 
@Sjon that's the same, I was thinking of a letter just
 
@brzuchal ah. You're still missing the fastcgi (sapi) params btw; see php.net/manual/en/install.fpm.configuration.php#example-33 I guess they are equal to the C level, maybe just call that S for sapi
 
@Sjon Fair point
@Sjon so if I run PHP_PCRE_RECURSION_LIMIT=99999 php-fpm this should override the sapi config right?
 
cmb
10:02 AM
@brzuchal no, individual settings in the registry are last (they are read per request)
 
Hi I have edited the question if anyone is free please help me for this
https://stackoverflow.com/questions/63112308/how-to-append-the-data-from-database-to-html-select-box-using-ajax
 
@brzuchal Imo the ENV vars are the highest prio, but running fpm like that presents an interesting question. It feels to me like the ENV should not override a php_admin_flag for example
 
@cmb That's not mentioned here php.net/manual/en/…
@Sjon ok so the SAPI still is the most important, which means the ENV vars would not be the highest priority but right after the SAPI overrides
Considering PHP_MEMORY_LIMIT=1G php -dmemory_limit=2G script.php it'd expect memory limit to be 2G actually
Cause if it's already set in ENV variables then the only way to override would be calling php with -d flag
 
@MateKocsis he gave me the OK to work on it, so i will do that this week
 
I'm finally trying Linux ^^ What distro do you guys recommend? Manjaro is really popular atm. They're all just so ugly :D
 
10:12 AM
just use ubuntu
 
@IluTov I'm a huge fan of Archlinux if you want to learn and understand your system. If you need some experience first I'd try Fedora
 
I use Ubuntu on my personal and in all PC's at home, but osx on my work laptop
But I consider a Ubuntu the best OS in the world so it's personall preference
 
@brzuchal That's a great example - but it might also be the reason this change is hard to pass
 
@Sjon what about two kinds of config setting resolvers? on process start and on request
 
@brzuchal It's definitely personal. For me, the the package-manager and vanilla packages in Arch are perfect. I run it on all my servers too
 
10:16 AM
@Sjon If it's not easy then it probably is worth of exploring, right?
 
@Sjon I had a colleague recommend Arch as well. They're very hard for me to distinguish as they all seem mostly the same.
 
@beberlei Ah, I missed that! Thanks for the info!
 
10:34 AM
@brzuchal I agree. I'm kind-of missing why docker creates the needs for ENVs to be parsed, as those settings might just as well be written by an ini file, possibly by a small wrapper.
@IluTov distrowatch.com/dwres.php?resource=major explains the "major" distros, if you encounter other distros they're probably based on one of these
 
@Sjon That would go into entrypoint.sh script but would not be possible to run a bash on a container and invoke php with specific ENV variable then
 
Hello guys
I have a question to ask
 
Consider a k8s deployment for example there any ENV variable won't be parsed by such entrypoint cause when I configure my deployment for eg. I use command: bin/console messenger:consume [queue] and that's all
 
in my php project previous developer used mysqli_real_escape_string($$link,$string)
procedural way
of mysqli_real_escape_string()
 
@Sjon Thanks!
 
10:39 AM
So it uses the bin/console with the shebang resolved to php interpreter directly AFAIK
I mean I think it skips the entrypoint which is set in Docker Image but I may be wrong
 
so my question is can i use both ways in a php project
$mysqli -> real_escape_string(escapestring)
can i use $mysqli -> real_escape_string(escapestring) and mysqli_real_escape_string(connection, escapestring) in same project?
 
@Sjon anyway it requires modifying an INI setting which we wanna avoid, right?
 
or should I have to follow one approach
 
@Maximious yes you can use both ways
 
ok thanks
 
10:46 AM
@brzuchal xdebug.mode is INI_SYSTEM only, so I don't care about the others there
 
Morning! Stupid one regarding logging - my objects usually have a logger passed through via the constructor, but I'm missing trace/request IDs in my log messages. I could either require a logger to be passed through per method which has a trace ID embedded, or I could pass some kind of trace object / ID through the methods and add it to the log context in the method. This is with amphp + auryn, so a lot of classes are shared between different requests.
 
@brzuchal No, that would break ini_get().
@brzuchal I can't parse these acronyms.
 
@Derick 1.I (INI files), 2.U (User INI files), 3.R (Windows Registry), 4.E (env vars), 5.C - should be S (overriden by SAPI, for eg. -d option for CLI or php_admin_value family)
order of overriding default values
 
@Sean it sounds a bit complicated to me personally. I'd just write to some logfile using a static method without DI, or use a SIEM service.
 
and then ini_set in the script itself :-)
 
10:51 AM
Yes
 
that order seems good.
 
Windows Registry being considered last read before request handling
 
env vars should still override these
 
@cmb ^ what you think?
 
ini options are applied at every request anyway, so I can't see this being an issue...?
 
10:55 AM
@Code4R7 Fair, cheers. I am a sucker for DI generally ^^;
 
@salathe How long should it take to commit to "https://svn.php.net:443" ? It's been nearly 10 minutes now
 
another question after fetching records from database like mysqli_fetch_array() then how can I filter values?
 
11:18 AM
@MateKocsis Duh, I saw the test failure, then did a "git pull" and try to reproduce... spend 10 mins WTF-ing, only to find out you already fixed it :-)
 
cmb
@brzuchal fixed
@brzuchal only PHP_INI_USER can be set this way; is there any need to have such settings in env vars?
@Derick just took a few seconds for me
@Jeeves, you dead again?
 
@cmb Which host should it commit to?
It's connected too...
svn     126780 derick    5u     IPv4          356891594      0t0       TCP gargleblaster:48434->ip-185-85-0-29.ax5z.com:https (CLOSE_WAIT)
 
...
 
@cmb Would you be a star and commit this for me? derickrethans.nl/files/dump/svn-diff.txt
 
@SebastianBergmann Behold!
This saturday, Saturday, SATURDAY, this is the plan for the 'Socially awkward physicaly distant PHP meetup'. Just coming to chat is fine, but who would like to take part in:
5
Lightning talks - anything tech related, any time length between 5-20 minutes. I'm going to give one talk about the minimum stuff you should do for taking part in online chats. Need at least 2 more, maybe like 4.
Whats your favourite feature of PHP 8 - Get people to talk about their favourite feature for PHP 8 and how they think it's going to make people's lives better. There's a list of suggestions in the doc. Please either PR your name against the one you want to talk about or just ping me here.
What's cool about XYZ? - Opportunity for people to either rave about something they've learnt about recently, or to ask "I've heard people talk about X, why's it so cool?"
The only tech requirement is please can people use headphones if you want to speak rather than just listen. Feedback between multiple people's speakers gets quite annoying.
I'm going to attempt to stream part of it....not the whole thing and as the socialising part is more important than the streaming part, the worst case scenario is me just turning off the stream and you can all laugh at my inability to work a computer.
 
11:33 AM
@cmb dunno yet, need to gather my thoughts cause a lot learned for today about INI directives how they work, but the idea was to allow overriding most of INI directives via env vars
 
cmb
well, I'm not sure if that needed at all, but at least PHP_INI_USER settings can easily be changed in a PHP script
 
Open invitation, if anyone who gives talks online, hasn't started using OBS for doing their presentations yet, I can walk them through how to get it setup for talks. It's pretty awesome.
4
 
@Danack I might do something regarding the crap I have seen and still am looking at in my current position for some good laughs/cries
Big might as I am currently vacationing and need some time to find the gems
 
@Danack That sounds worth it :D
 
@cmb consider INI settings which can be modified in Docker & k8s stacks without changing INI files, there's a place for ENV vars and also when you want to change some INI directives when executing scripts which calls another php interpreter via exec or proc_open without changing INI files.
Changing INI file has an impact on whole host environment while env vars can be changed at hand before executing script and this is passed over to embeded php executions by exec & proc_open family
 
11:41 AM
Anyone else wasted an entire day on something challenging only to finally scrap it and do things the simple way that you knew existed all along? >.<
 
Everybody in here did does that
 
I spent 4 months writing an extension for HHVM, and then ended up scrapping it.
 
Many times
 
Cold comfort :)
 
Most of my RFC's :P
 
11:44 AM
just one day? thats nice ;)
 
I often think there must be an element of insanity to being a programmer
but hey, I imagine other fields can be just as frustrating
 
cmb
@Derick done (XML was not well-formed; fixed that)
 
11:59 AM
> asking Danack
> raving Danack
mobile SO being dumb
 
02:00 - 12:0012:00 - 00:00

« first day (3572 days earlier)      last day (1376 days later) »