« first day (3181 days earlier)      last day (1767 days later) » 

Wes
1:33 AM
@bwoebi remove "precision" ini setting in PHP 8? warning: i know nothing. but i always thought that kind of thing shouldn't be user-customizable
 
 
1 hour later…
2:54 AM
Hi everyone
Is there any better way to create a new typed object in PHP? I have to initialize the object and add properties one by one in separate commands
It's possible for anonymous classes like this: (object)['x' => 1]
But not for a customized object like this: (User)['firstname'=>'John']
This is possible in Typescript easily: let user : User = {username: 'John'}
 
3:41 AM
Good morning
 
 
2 hours later…
5:24 AM
morningz
 
5:45 AM
posted on July 02, 2019

 
6:22 AM
@Tiffany yes, all other errors are being logged in properly. I am sure there is no permission or any other issue. Only with reserved keyword case, I can't see error log (neither on screen with debugging turned on, nor in file).
 
6:43 AM
TIL: people actually use EmptyIterator. github.com/sebastianbergmann/phpunit/issues/3743
 
7:09 AM
@rostamiani You have the __set_state method, which is mainly intended for var_export, but more generally to convert an assoc array back to an object. You'll need to implement that method yourself though. Alternatives are adding a custom static method or passing the array in the constructor.
All-in-all there is nothing built-in that creates an object and sets the public properties. It's easy enough to add a function for that though. You can use Reflection to set the properties prior to calling the constructor. See github.com/jasny/entity/blob/master/src/Traits/… for an example.
@SebastianBergmann Yes, I also use it all the time, specifically for unit testing. It's a practical way to test that the function works as expected when the input is an iterable with no items.
 
git merning
 
\o
 
7:37 AM
morns
 
8:05 AM
insomnia's a bitch
 
Wes
8:18 AM
how do you say in english when something stands out in something otherwise very patterny and regular?
"stand out" is the closest translation i can provide from my native lang :B
 
@Wes outlier
 
Wes
nice :D
that's totally the word. thanks
 
@Wes I see no value in that, except maybe purism
 
Wes
no value in removing it?
 
How do you guys suggest one should handle an exception thrown by Monolog's stream handler while it's itself handling an exception and logging the error?
 
8:56 AM
let it bubble up? some things cant be handled; exceptions while logging exceptions are a pretty good example
 
The mystery from my childhood was finally explained .. never thought it was real
 
@Sjon That would be a bummer, maybe sending an email to the admin in such a case could be an option?
Which might also fail and this can keep going on and on...
 
@2dsharp exactly
 
 
1 hour later…
10:08 AM
set_error_handler() blocked – #78239
 
10:43 AM
@JoeWatkins Are you able to modify the retention settings in azure?
 
yes, when I login with the master identity ... how shall I set them ?
 
90 days?
Especially the PR one is way too low right now.
We don't really care about artifacts & attachments
 
11:04 AM
pull request max is 30 days
I've set 1/90/30
 
ugh
 
it's a good reason to deal with pull requests within 30 days ...
 
pipe dream ^^
 
@Wes it's an "outlier".....and apologies for the lay/lie confusion.
 
11:12 AM
@NikiC well if a pull isn't dealt with in 30 days the majority of the time, it's an RFC, or it's going nowhere ... maybe if we used stalebot to close stuff after 30 days of inactivity that doesn't have RFC label, that could really clean up ...
it's difficult for a person to do it, because it's personal, but if a bot does it, it's just policy ...
 
/and so began the war against the machines.
 
I see other projects using stalebot quite effectively ...
 
Looks like we can now do scheduled builds from yaml
But 30 days for PRs is really quite low for us :( There is a separate option for test retention that I set to 90 days, but I don't know how it interacts with build retention
 
in yaml is much more sensible
and I'm not sure either
 
12:15 PM
If i type in the url: /?p=phpinfo(), and use it in a condition: if($_GET['p']) the phpinfo() function will not work because it's converted to string. But it's recommended to validate user input, to use only inside logical statements? Or it's not needed?
 
12:31 PM
@DerpDeeDerp The ()'s aren't part of the callable.
$fn = 'phpinfo';
$fn();
Also....don't do that. You need to whitelist any function you allow people to call.
$allowedFunctions = [
   'phpinfo'
];

$key = array_search($_GET['p']);

if ($key === false) {
	echo "Computer says no";
	exit(0);
}

$fn = $allowedFunctions[$key];
$fn();
 
Buenos Dias!
 
\o
 
12:47 PM
@Danack i will not allow people to call any function. I will use the value from $_GET/$_POST to make some conditions, example: check if the variable is empty, compare the value with another string and use it inside functions that manipulate strings like strpos(), str_replace(), strlen(). Do i need to validate the input (to prevent any kind of attack)? I don't think so, but i'm not sure.
 
As I said, whitelisting what is allowed, rather than trying to detect badness is the way to go.
 
@DerpDeeDerp no, you don't need to validate for that
The only thing you should be validating is that you get a string
Keep in mind that GET/POST parameters can also be arrays
 
1:02 PM
Morgens
 
\o
 
can anyone point me to an algo I can you for A/B or Split testing?
 
Include/require doesn't seem to preload – #78240
 
o/
 
1:26 PM
\o
 
1:48 PM
Does it make sense to store file/directory paths to .env files? For example- storing the templates directory to be used by twig. In that case how do I make sure the absolute path is resolved?
 
@2dsharp Use a better format for config files like plain php arrays
That is assuming you do not need to share it with different systems
 
@PeeHaa I was thinking of giving github.com/vlucas/phpdotenv a try. PHP arrays do solve the problem, but I was wondering when .env could be a better option.
 
@2dsharp use absolute paths from the root of the project.....and I wouldn't bother storing that in config to begin with, unless for some reason you need to have multiple dynamic template systems.....which sounds horrible also.
 
@PeeHaa Writing db credentials on a PHP file doesn't really feel right.
 
@Danack Theming would be a valid reason
@2dsharp Why not?
 
1:53 PM
@PeeHaa even then.....themes would all be in one directory, and it would only be the theme name that varies....rather than the whole path, hopefully.
 
@Danack I have some projects which support "external" themes
As in they are bootstrapped from the vendor dir instead
 
@PeeHaa There's no real reason, just a personal thing for saving myself from accidentally commiting to VCS. A bit of superstition. xD
 
@2dsharp The same can happen with your env files
Now if you use actual environment variables it's a bit different
By actual env vars I mean things set on the server level
 
@Danack Right, I didn't find any good reason to store paths in config yet. Absolute paths from the root works just fine.
@PeeHaa I have been using the env vars set in Apache's configuration. I was exploring and was thinking of giving .env a try.
 
2:24 PM
Sorry for mega triple ping guys @Trowski @bwoebi @kelunik. I am trying to start a udp server, but it fails with a pretty useless error for me:
> PHP Fatal error: Uncaught Amp\Socket\SocketException: Could not create server udp://127.0.0.1:53: [Error: #0] in
errno is 0 and string is empty
Can I do a specific dance to debug this or at least get something useful somehow?
Code is $server = \Amp\Socket\listen('udp://127.0.0.1:53');
 
Do you have permission to bind to that port?
Maybe needs a sprinkle of sudo?
 
Errr good one
Am on windows, so let me run it as admin
Same error when I run it as admin
Also still the same on non privileged ports
hmmm tcp works
 
I have no idea, but this bit of the manual is so useful:
> SOCK_RDM Provides a reliable datagram layer that does not guarantee ordering. This is most likely not implemented on your operating system.
 
@Danack Yep. That at least starts the server \o/
 
2:38 PM
o/
/me has some reading to do about the different datagram options
 
2:49 PM
Does anyone know what do they mean specifically with "Adding dependencies installed via git to a git repo will show them as submodules. This is problematic because they are not real submodules, and you will run into issues." in getcomposer.org/doc/faqs/… ?
you will run into issues
:O
ok, I've tried and I think this is what they mean:
warning: adding embedded git repository: doesnt/matter
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
 
nah, that's all fine, it means you need to git init submodules --recursive when cloning
 
... or you just don't use submodules and save yourself the trouble
 
or that, yes. I've yet to have a thoroughly successful and enjoyable experience with these..
 
Happy birthday @Fabor ! Sorry for the three days delay!
10
 
this is all because a guy wants to get a non-php dependency via composer (which is just cloning a repo). But that has this incompatibility with committing vendor
 
2:58 PM
if said dependency is not developped by you, and tends to stay stable, it can be not that bad
most of my problems stem from adding submodules that are in active development in-house, which (possibly because we're bad at it) was a bit of a hassle
 
@pmmaga how often does that other repo change? If it's not often, just downloading it by hand and committing it to another directory other than vendor would be better.
 
it won't change that often but they don't want that kind of manual control :/
IMHO, submodules would be the way to go here
"but I want to control everything in composerrrrrrrr...."
baaaahhhh
 
Ask them to articulate the reasons why they want to do that, other than it's the first thing they thought of? And then ask them to really think if the downsides that are already known are justified by those reasons?
if you have any budget, I could come and give some consultancy on how to make better decisions...
 
@Danack They have OK-ish reasons. For one, they don't want to commit vendor because of the page above. And second, because then they can control all dependencies from one place
My reasoning against was mostly because of how long the images will take to build (composer install every time), and because given that that is a private repo, we either have to copy keys to our images or use an intermediate build image
but given that they are the ones that will have to wait for the image, and implement the intermediate image solution, they can have it their way
 
3:29 PM
@PeeHaa listen doesn't work properly in 0.10.x for udp. You'll have to use master for now (to be tagged 1.0 soon).
 
@Trowski Yes noticed... :(
 
$socket = DatagramSocket::bind('udp://127.0.0.1');
 
Yeah got it after two hours
See my suggestion on the issue about it
 
@PeeHaa Issue? As in github issue?
 
TL;DR please don't close issues and make them hard to discover if things are not released yet
 
3:32 PM
Ah, yes, point taken.
 
\o/
tnx <3
 
I'll poke @kelunik about tagging a release. We wanted to play with it a bit in http-client/http-server to make sure it was ready. I think it is.
 
@Trowski If I do find something I will make noise too
 
Since so many things depend on socket you probably will end up with a few other dev-master dependencies.
 
Yeah. I am using artax in specific in another dependency which broke
 
3:36 PM
And master is a lot different unfortunately.
 
You guys did anymore work on ext-async support?
 
How much of the storage will be used if I make a varchar(100) column and write 10 chars inside it. The whole 100 chars will be used/locked in this case? or the same as value will be used?
 
Ok my problem is, what does "Storage Required" mean? (that expression exists even in the link you provided)
 
3:52 PM
it means the storage, that is required, in bytes
 
@PeeHaa Not lately. I was waiting for a tagged version so we had something stable to code against.
 
does "required" mean either "that amount of storage must be free" or "that amount of storage will be used regardless the value size you write in the field" ?
 
4:30 PM
kk
 
Wes
@Danack outlayer?
 
@DaveRandom whenever you feel like poking your head in here again and want to answer some questions regarding libdns ping me :0
 
Wes
evening folks
 
heya wesmon
 
I need an objective opinion. I'm planning to go on a little trip with my sister, niece and nephew through July 3-5. I ordered a bathing suit online on Sunday (June 30) and picked expedited shipping because it estimated I'd receive it July 3-4. The store shipped it through US postal service which follows federal holidays (so they're closed July 4 cause it's a holiday). USPS tracking site estimates July 5th. Am I within my right to request a refund on the expedited shipping?
Other stuff: I'm going to wait until tomorrow if I request a refund, in the hopes I might be lucky that I receive it tomorrow. I would not have picked expedited shipping if I wasn't going to receive it before the trip. The site might have had a warning about shipping delays due to holiday, but if it did, it was not obvious and I overlooked it.
@Shafizadeh typically, it means the amount of storage must be free. I'm trying to think of a situation where it would mean something else, but in almost every case I can think of... if they meant "that amount of storage will be used regardless the value size you write in the field," different wording would be used.
 
4:44 PM
 
@Wes outlier is correct. I had to go look up the exact definitions, though. laid is the past version of 'to lay' and 'lay' is the past version of 'to lie', which is confusing.
@PeeHaa you broke my site....
4
 
:-)
 
You're worse than those unit tests.
 
Users always are
 
Wes
lol
 
4:51 PM
> Server setting Value
opcache.enable '0'
I should probably turn that on...
 
Wes
so that you can blame opcache rather than peehaa? :B
 
Even opcache is less broken than me
 
Wes
:B
 
How's your musical career btw @Wes?
 
Wes
stopped doing anything. except singing when i take showers obvs
 
5:00 PM
:D
 
Wes
my favorites tunes to sing are the ones i cannot sing
like, have you ever tried to sing journey. hella hard
 
@Wes more so that the site uses less cpu.......That box is a $20 a month fella that is running multiple things through docker-compose. Explosions seem likely.
 
I only lately realized node.js is so voracious. I was trying to launch a few servers and stuff behind nginx, and that will very much not happen on a 5$ droplet on digital ocean... 1GB is so very quickly filled.
 
5:44 PM
@Trowski how ready is your http-client PR?
 
@kelunik Very close. I was going make sure my keep-alive logic makes sense and I was going to update it to use the new function in amphp/http.
 
6:10 PM
I'm reading about not passing an entity object to Symfony form class because it violates things, like "the entity can be in an invalid state". The general consensus seems to be to use a DTO. But I don't like it because that itself violates DRY. In that I then have ORM annotations in my Entity defining field structures, AND in the DTO. And would have to remember to change things in both (like if a varchar length increases). What are your thoughts?
 
touch() does not handle dates after 2038 in PHP 64-bit – #78241
 
@James are you talking about this article?
 
@FélixGagnon-Grenier yes that and this one is often linked to: stovepipe.systems/post/avoiding-entities-in-forms
 
@NikiC badong ....
can you tell me what is precisely the idea behind pcre having a per request and a persistent cache ?
I can't approve that PR, it reads really strange to me, I see that it's copying some of what pcre is doing, but I don't know what pcre is trying to achieve or why ... so, fill me in ...
 
@James It seems to me that an awful lot of things have been written about this. Interestingly, it feels to me that "entities should not be invalid" is more properly solved by not allowing invalid entities to be created (such as throwing from a constructor) rather than making deep impacting design decisions about it.
 
6:25 PM
@JoeWatkins It has to do with interned strings
Well no
The problem is that with large regular expressions, just performing the string comparison when looking it up in the hashtable may take much more time than actually matching the regex
So you want to instead make use of string identity, in which case we don't need to do the full string comparison
but the persistent cache needs persistent strings
So either permanent interned strings, or persistent string copies, in which case you lose string identity
 
@FélixGagnon-Grenier Thing is, it makes it so quick and easy with the form fields, entity properties, and DB fields all mapped. Pass entity to the form class, once the form is valid just pass the resulting entity to repo to persist.
 
I see
 
The main argument seems to be "in case someone persists a bad entity". But not sure I fully agree that is a problem to solve. Anyone can try to persist bad data from anywhere in the app. So hence asking here - am on the fence/unsure.
 
> just performing the string comparison when looking it up in the hashtable may take much more time than actually matching the regex
does it take more time than compiling the regex and performing the match ?
 
@JoeWatkins I doubt that
 
6:29 PM
that's what we should be comparing it too, no ?
a miss, or no cache ...
 
we're comparing to looking it up with string identity
Which is what the per-request cache would do
 
ah ok
 
Though I don't know if this is really the right way to go about this.
The real solution is a regex object, but that's also not a short-term solution...
 
@James Yes, I think I'm in agreement with you here even though it might not be evident from my previous message. I was rambling about some articles about "entities should not be invalid" sounding like a dogma that's being taken too far.
 
perhaps, move the key management into pcre
there should be one cache, persistently allocated ...
(not in module globals)
I'm thinking maybe, use modified collision detection so that fast path can lookup the strings by their hash (since all [long] strings from userland will have hashes, right?) ?
also opcache doing anything to pcre caches is really strange, that needs to go ...
even when we have a user object, it won't really help internals will it ?
 
6:48 PM
Does method_exists() still find private/protected methods in 7.3?
 
ThW
@2dsharp Looks like: 3v4l.org/J9Blu
 
@ThW Thanks :)
 
ThW
However is_callable() returns false: 3v4l.org/lR9SN
 
Yes, that clears up the doubt.
 
hello
anyone here to help ?
anyone worked php application on iis server ?
 
6:57 PM
@FarveenHassan Don't ask to ask, just ask
 
okay sorry mate.
my application on iis server is only executing one function and time when i take
 
a new link or fun.it will complete the old linknor file. then process next
like..one complete then goto next..if i click one url then take nee url in a tab. then only when first url is loaded second url load
any help?
thanks in advance
 
What is your question? It's not very clear.
 
ThW
Your IIS (with PHP) only processes only a single (parallel) request?
Might be session locking
 
7:03 PM
here.... on menu suppose there are two links.when i click one link in the same tab and soon open other linkin another tab....then the second tab only loads when first tab is finished
 
ThW
Try it with two different browsers/computers
 
yes two browsers it dealing different
same browser is issue...
i want to do many pages in the same browser
 
ThW
Sounds like session locking. If the application uses a session the first request will lock it. Any other request using the same session will wait until the session is closed for the request (or the request ends)
 
how to unlock that ?
 
ThW
The reason for that is that the request could change the session data.
 
7:06 PM
hmm how could i overcome that ?
 
ThW
You can close the session for the request using php.net/manual/en/function.session-write-close.php
 
let me have a check !!
 
is there a way to mock up different location/IP with Behat? i want to test for visibility of content base on location.
 
7:37 PM
@Ghostff I believe the standard way to do that is to set a customer header, then look for that header in your code where you identify where the user is coming from.
 
7:56 PM
@NikiC regex objects are sort of annoying … It feels - in other languages at least quite clumsy to instantiate and then execute an operation … also keeps the expression next to the input/matching. As an optimization it may be fine, but should never become the recommended way…
 
8:09 PM
@Danack okay
 
ugh - travis is struggling: traviscistatus.com
 
@bwoebi Maybe you have an idea how to solve this issue, did you already have a look at amphp/http-client already?
 
8:26 PM
@kelunik what issue exactly?
 
@bwoebi I implemented github.com/amphp/http-client-cache and yesterday was the first time I actually tried running that code by writing an example that requests api.github.com/users/kelunik. Unfortunately, the second of two requests doesn't use the cache, because GitHub sends a vary: accept header and there's a mismatch.
The first request has accept: */* set by the client, but the second request hasn't (yet) when the request is compared to the cached requests vary headers, because the cache is an ApplicationInterceptor and that runs before the accept header is normalized in the client.
There's a similar issue with accept-encoding and basically any headers modified by interceptors.
 
9:00 PM
My first thought was that headers added by interceptors should have corresponding headers removed from the response, so to the cache things like content-encoding would be transparent.
 
9:32 PM
@Trowski The issue with that is that the actual caller can't determine the raw sent request anymore.
 
@bwoebi It depends on usage
 
@kelunik Don't cache on sent request, cache based on original request.
 
For one-off usage I agree that not going through a regex object makes more sense
 
You can include the raw sent request in the response.
 
But when you're dealing with lexers or similar, having regex objects is much better
 
9:35 PM
@NikiC that's the only use case though…
most regexes (I write) are one-off though
 
@bwoebi it's also the only case where you really care about perf ^^
 
I totally agree
 
@NikiC In traditional PHP probably, yes, in long running applications like an HTTP server most expressions are probably reused.
 
@kelunik yeah … there are most probably a few expressions with high reusage - and then the occasional dynamic regex
 
@Trowski Thought about that as well, works correctly as long as all interceptors are deterministic. In fact, every interceptor is just like an intermediary forwarding server, so should be fine.
 
ThW
9:45 PM
even in "normal" php here is the study modifier. I like the OOP approach for patterns. Optimizing matching only matters if your reuse it.
 
@bwoebi Where do you have dynamic regex? Building dynamic, single-use expressions is very, very rare.
@ThW There's the modifier, but currently you can't keep a ref to the compiled regex, no?
 
PHP internally keeps compiled regexes
They are (obviously...) not recompiled on each use
 
Unless you have too many, no?
 
It just breaks down in some edge cases :)
 
ThW
@NikiC works most of the time? :-)
 
9:47 PM
@ThW I don't think studying even does anything nowadays
 
ThW
I set in the my CSS parser. - not sure how much it does.
With an Regex object I could consider a pattern object as optimized. Much more difficult with functions.
 
10:02 PM
@kelunik preg_quote and user input sometimes
 
@Trowski Should we just drop the request from Response then?
 
@kelunik Hmm… maybe. You can always add another network interceptor if you want to grab the request just before it's sent.
Having it in the response might lead to misuse.
 
@Trowski like?
 
Like using it for caching :-)
 
yeah well, caching has no purpose there
if you want caching, decorate the whole of artax I guess?
 
ThW
10:13 PM
My desk at work
 
@bwoebi You could. We were doing it as essentially a middleware.
 
10:29 PM
@Trowski I'd say let's keep it. I wanted to avoid caching the entire request for caching, but I'll just use the current request there.
 
10:41 PM
@ThW nice :D
 

« first day (3181 days earlier)      last day (1767 days later) »