« first day (3670 days earlier)      last day (1278 days later) » 

2:28 AM
My cat does this thing where she brings a toy from one room to the room I'm in, but she's started doing it with a wand toy. She drags it from one end of my apartment, through the kitchen, to the other end. Bell ringing, plastic handle rattling across my kitchen floor... it's ridiculous and funny.
 
 
2 hours later…
4:38 AM
return \Fiber::suspend(static fn(\Fiber $fiber) => $promise->onResolve(
    static fn(?\Throwable $exception, mixed $value) => $exception
        ? $fiber->throw($exception)
        : $fiber->resume($value)),
    Loop::get()
);
Is that abusing fn? lol
 
5:26 AM
Hi all, here I am again with a question about the JIT. Benjamin wrote in his excellent article about benchmarking the JIT that you shouldn't use the CLI but php-cgi instead, so that there's a warmup request (https://beberlei.de/2020/07/05/what_to_look_out_for_when_testing_php_jit.html)

So what's the recommended approach if you want to benchmark a CLI tool? Specifically, I want to test whether psalm is faster using the JIT or not.

I was actually able to use php-cgi to run psalm several times and there seems to be a performance gain by using the JIT, but now I want to use that same JIT conf
Of course I found the solution to one of my questions after writing this, I need opcache.enable_cli instead.
Still I wonder what the best JIT configuration is, since there's no warmup request possible in CLI
 
Wes
6:02 AM
do you ever pursue some design and spend a lot of time on it, just to settle on using something completely different, way simpler?
i keep doing that
 
@Wes Sure, common side effect of spending a lot of time designing something is you inevitably end up having distilled the problem down to be something a lot more streamlined than your initial idea
 
Wes
the amount of time i spend that way....
 
I'd say on any average project I throw out 70 to 80% of what I do
 
Wes
:'(
 
All just part of the process. Tend to end up with less tech-debt that way too.
 
6:23 AM
Good morning.
 
o/
 
Wes
\o
still, pretty infuriating
depends on the time wasted, though. spending weeks pursuing something wrong is really something hard to digest
 
7:08 AM
hi guys
do anyone know what is php backend development looks like?
 
@SuperPuperMegaUltraEpicHacker Can you differ backend from frontend or at least can you define frontend first? There is plenty of articles on the net about that segmentation. But basically and most simple definition would be PHP code that runs on server.
 
7:32 AM
@BrentRoose that applies to trying to benchmark a web app, if you are trying to benchmark a cli app you must use php-cli, and that's fine ...
a web app won't typically enter the same code a huge number (or infinite number) of times, a cli app will
 
8:01 AM
morns
 
8:15 AM
\o
 
Wes
8:53 AM
i am super amazed that this works 3v4l.org/7I09k
 
@Wes Why should it not work? ^^
 
Wes
because php? :P
 
@BrentRoose Just keep the default opcache.jit setting
You only need to set opcache.jit_buffer_size
Assuming psalm runs long enough (which it probably does), warmup shouldn't matter much there
@Wes Heh, good reason
 
Wes
:D
 
 
1 hour later…
10:24 AM
@NikiC @cmb derickrethans.nl/files/dump/appveyor-download.php.txt is what I use for downloading appveyor artifacts
You get the bearer token at ci.appveyor.com/api-keys
Looks like they changed the URLs recently, so the URL in the script to fetch history needs to be changed too
 
cmb
@Derick thanks! One problem is where to put the scalar_objects artifacts, though.
 
10:41 AM
GitHub release tag area?
 
lol
 
hah, yeah, you do need to tag your releases for that to work :-)
 
11:14 AM
Good morn-noon-even everyone :)
 
Hey guys.. Sorry i am late :-)
Well i want to put my website live now, its partially done now. So i am wondering how to make it secure from cyber criminals. I never brought anything online, i a newbie.
 
If you want to put your website live now and only now start to think about security I am sorry to tell you you're too late :)
 
@MompolokiNkgageng there are several good comments on your closed question worth reading and researching
Particularly the one with Top 10 OWASP
 
@Tiffany yes i really have to do research on OWASP..
 
So start there
 
11:20 AM
@NikiC Any idea what this could be? bugs.xdebug.org/view.php?id=1876 — first time I hear it, and I do run Xdebug builds on CI on OSX.
 
the most important things to look out for as a beginner: 1. do you put user provided value into sql statements? It must be escaped/prepared. ORM libraries do this for you 2. do you render user input into html? it must be htmlspecialchars. template engines do this for you 3. are database entries private to users / groups? you must verify that the user has access to the resource after fetching it from the databaase
 
@PeeHaa Exactly .. I have a good feeling that its very nice to see your product online ... yeepiiiiii !!
 
... I need caffeine ...
 
@Derick No idea, the error doesn't make sense to me
Best guess is that PRId64 is not defined, but I would expect that to result in a different error message
 
@beberlei Wow that very useful... And hey, about file uploads, that where the problem is. Even if you scan the user provided upload image, they are other hacking tools that can bypass you scanning tricks. I dont know how to battle this upload in my site
 
11:26 AM
That's what I'm thinking, but I have no such issues building on 10.14/10.15 on CI
 
@MompolokiNkgageng are you allowing file uploads?
 
@beberlei 4. don't put code in a publicly accessible place
 
i didnt mention them because often sites don't need that, but if its the primary feature of your site, then a large range of additional problems appears :)
 
@beberlei yes
@PeeHaa meaning ?
 
@NikiC I think that's spot on though, otherwise the compiler would've recursively expanded the PRId64 definition as well - and the error is logical, you cannot just juxtapose a variable next to a string
 
11:29 AM
for file uploads, you should really try to find a library or htird party service that handles everything for you, there is so much to consider
 
@MompolokiNkgageng Don't put your code in the webroot
 
@beberlei yeah. Handling file upload its a total mess. My site is primarily on file uploads :) ..hahaha
 
Have an index.php that requires an autoloader that requires the rest of your code which resides in another folder
 
@MompolokiNkgageng thisisfine.exe
 
@PeeHaa whats that PeeHaa ? :)
 
11:32 AM
@MompolokiNkgageng sorry but i havent worked with file uploads for a long time, so can't really help you exhaustively, things that pop up in my mind are: 1. avoid php code injection / upload + execute 2. avoid zip bombs 3. avoid files with viruses 4. remove potentially privacy related metadata from images
 
@Tiffany wow, thats great knowledge there. I did'nt know that. thats why is always good to ask guys with experiance :)
 
Probably start with a smaller project that doesn't involve user input if there are security concerns... get experience before jumping in the deep end and potentially losing everything
 
BTW no need to star random things that were helpful to you
 
@PeeHaa Yeah
 
SO chat doesn't work the same way as slack
 
12:14 PM
Incident on 2020-11-02 12:14 UTC
Incident on 2020-11-02 12:14 UTC ・ Notifications has Partial Outage ・ Gists has Partial Outage
 
Wes
took me a bunch of seconds to figure out what was wrong here
 
Ah the good ol pubic
 
Wes
:D
 
That happens so often to me
 
funciton.
 
12:20 PM
I just spent 10 minutes tracking down why some uncooperative person wasn't using my "upgrade to edge" button I recently added to get people off ie... turns out it was my own ip using an arbitrary account to test the page.
 
Incident on 2020-11-02 12:14 UTC ・ Notifications has Major Outage ・ Gists has Partial Outage
 
Wes
@MarkR it's like my client being really happy with the number of impressions on the site, congratulating me
it's you dude, you visit the site every minute :D
 
@Girgias I might have to be a bit late today, waiting for groceries to show up
 
Incident on 2020-11-02 12:14 UTC ・ Notifications has Major Outage ・ Gists has Major Outage
 
Wes
i think i asked this already... is there a way to advance the debugger in phpstorm, excluding all the files in vendor?
 
12:28 PM
I don't know, but that would be really useful...
 
the feature i never knew I needed until I read it just now
 
Wes
because every time i end up in amphp files i get totally lost and the only thing i can do is set breakpoints all over the place and hope to hit one that is close to the thing i am debugging
 
@Wes Can I introduce you to printf? :P
 
Wes
lol
 
@Wes Yes, you can do that.
You can exclude directories.
(I don't know how though)
 
Wes
12:31 PM
in xdebug? does it integrate in phpstorm, well?
 
yes, and yes
 
Wes
ok, i'll check. thanks
 
It's not a feature in Xdebug, but it is in PhpStorm.
 
Partial System Outage ・ Gists has Major Outage
 
12:33 PM
All issues have been resolved!
Partial System Outage ・ Gists has Major Outage
 
well that will be handy
 
All issues have been resolved!
 
Wes
i just tried it, step into still gets me into vendor files, like
i am here and press step into, i get to visit both my code and vendor code
vendor_code(my_code())
 
@Wes probably need to talk to phpstorm people and ask for a "add all vendors" option.
twitter.com/svdate/status/1323108083355340801 "For many, it's a shared sense of grievance. They don't get the respect they feel they deserve." looks in the direction of the opensource assholes...
 
1:17 PM
Morning!
 
@Derick No worries, let me know if you want to move it to later
 
1:52 PM
How can I set the route for login in Symfony using a Custom Authentication System with Guard?
 
@Girgias I am now finished, so gimme 5 for setup
 
👍
 
@Girgias read for you
 
mornin
 
 
1 hour later…
3:23 PM
The address operation does not pass correctly. ・ Unknown/Other Function ・ #80306
 
3:43 PM
Hi folks. I am looking for several examples of complex value objects that would benefit from named params. I already have the stock Points, URL, and US Address, but I want to replace US Address with something less US-centric. Suggestions? (This is for the PHP 8 blog series.)
 
S3 config settings ?
 
Examples that won't summon an eldritch horror to destroy my readers.
 
but maybe ask nikic as he had definite stuff in mind.
@Crell and this might be one of those features that is most useful in code that is tearing at the seams of reality.
 
@Crell Most examples I can think are better suited with setters :(
@Danack Ouch :P Exactly my point
That sure is something :D
 
It tradeoffs all the way down.....using setters for stuff like that is annoying. It might be safer, but just so annoying.
All of those have sensible defaults, and any subset of them might be the thing you want to tweak.
 
3:51 PM
Why is it annoying? I like myself some nice intuitive fluent interface for that
 
Something with lots of constructor args, most of them optional would be ideal. PSR-7 URL is the perfect example, but I need more than one.
 
@Sjon It looks like 3v4l uses a default timezone
 
$chrome->printToPDF(:pageRanges = "1,2", :printBackground = false); // easy to read
 
Rather than the default, default timezone UTC
 
$chrome->printToPDF((new PrintToPdfConfig())->setPageRanges("1,2")->setPrintBackground(false)); //makes me feel stabby
 
3:54 PM
disablePrintBackground()
I do see where you are coming from though
 
@PeeHaa I've been kicking around an idea of a talk....that I should probably write up. Doing it like that is very nice if the option is under programmer control, but is much worse if the option is under user control:
function printPage($printBackground)
{
    $config = (new PrintToPdfConfig())->setPageRanges("1,2");

    if (!$printBackground) {
	    $config->disablePrintBackground(false);
    }
    $chrome->printToPDF($config);
}
vs
function printPage($printBackground)
{
    $chrome->printToPDF(:pageRanges = "1,2", :printBackground = $printBackground);
}
 
Users! Who needs them!?
But yeah there is something to say for both versions IMO
 
> Good or bad. Telling the difference is hard.
 
Wes
4:23 PM
mswin's phpstorm's console still doesn't support ansi colors, right?
 
Wes
i tried the one to clear console and doesn't seem to be working
echo chr(27) . '[H' . chr(27) . '[J';
works in powershell tho, so it's phpstorm
 
An object that has both variants would be ideal. (Named constructor args and chainable methods.)
 
cmb
@Wes you can check with php.net/sapi_windows_vt100_support
 
4:38 PM
@PeeHaa heroin dealers
 
:P
 
Wes
thanks. no luck though.
@PeeHaa sorry, just saw the ping, yes i do
 
@Wes chr(27)? Write "\e[H\e[J"
 
Wes
didn't know that existed
is that escape?
 
yes
 
4:46 PM
@Wes It's all good @cmb already built it for me
 
cmb
you can also download the artifacts from ci.appveyor.com/project/nikic/scalar-objects (click desired job, and then "artifacts")
 
Oh wow. Look at that \o/
 
Wes
@cmb wow that's nice
 
5:17 PM
My manager is trying to create new Magento 1 feature requests in microservices so we don't have to use it as much. There is light at the end of the tunnel :p
 
New Magento 1 features
2020 strikes again
 
haha right
I don't know why they would want us to implement new features for Magento 1 this all makes no sense
 
fwiw we had the same discussion last week about magento 1 support
 
Oh wow. Where are you working again? I feel like I know this but I can't remember
 
Order Desk
 
5:22 PM
When using ZEND_HASH_FOREACH, does it break out of the loop if an exception is thrown?
 
We don't really deal with any of the stuff ourselves, but we have an integration with tham
 
@Trowski no
 
So we are dealing with our customers dealing with Magento :P
 
I didn't expect so, but it seems like it is :-P I wonder how that's happening.
 
@Trowski maybe you're reaching a zend_bailout()?
 
5:23 PM
Ah I see.. that makes sense. Not quite as bad as dealing with Magento 1 yourselves then :p
Are there a lot of users on there that use Magento 1 though?
 
Oh! I know… I have an error observer that empties the hash I'm looping over if the exception would be uncaught.
 
Yeah we still have some stores :(
 
That's surprising. I just don't understand why anyone would use it, unless they have it set up already and don't have any developers
 
@DejanMarjanović Never underestimate the power of Excel over SMTP.
 
5:25 PM
@Trowski I think I'm 'stuck' in poking the words. There's a couple of places waiting for your feedback, but for some of them they might be easier via voice. Do you want to have a quick call some time after tomorrow to chat through them?
@Sara Is it possible to learn this power?
 
@Danack We might be changing the API to Fiber::suspend(callable $enqueue, FiberScheduler $scheduler). Avoids having an Awaitable interface. My schedule is a bit erratic this week, so I can't commit to a specific time, but sometime late this week should work.
 
cool.
 
@Trowski fwiw Using ZEND_HASH_FOREACH on an array that may be modified during the loop is generally not safe
 
@NikiC Yeah, that thought crossed my mind. I'm going to do a check and break out of the loop if it is modified.
 
@Sara I do not recommend CSV over SMTP and then Excel CSV over FTP, trimming leading zeroes can crash multi-million dollar business :D
 
5:37 PM
or lose count of how many people have covid-19 in your country...
 
It's not like anybody's gonna die.
 
6:09 PM
The callable given to Fiber::suspend() is provided a Fiber instance and is expected to create an event in the fiber scheduler that will eventually call Fiber::resume() or Fiber::throw().
Not requiring an awaitable allows fibers to be suspended/resumed from watchers directly: github.com/amphp/byte-stream/blob/v2-no-awaitable/lib/…
 
@Trowski For the record, I don't grok this stuff, so....not an opinion you should pay much heed to. About the only thing that's worth saying is that Fiber::await() being a mapping to the possible eventual 'await' keyword makes sense to me.
any reason not to have both? they seem to do different things, even if they overlap a lot.
 
@Trowski I do think an Awaitable interface is going to be more intuitive, but I guess the Fiber API is not really to be used in user facing code directly
 
@Danack That would still be possible, though would probably then require more explanation in the RFC.
@Danack Trying to be minimalistic. Only what is required to work.
 
@Trowski yes, but cover more use-cases, so less chance of someone who knows what they are talking about from saying "you don't cover the use-case I care about".
 
though, I think I back @Danack idea
 
6:22 PM
@bwoebi Nah, not really. Not requiring the Awaitable allows reuse of a callback to schedule the fiber.
 
For stuff like that it makes no difference....people who don't understand this are just going to skim read the function definitions.
 
It is certainly a less obvious API though…
 
which is why I try to put a nice little story in the intro.
 
@Trowski though I would use a callable for the FiberScheduler
 
@bwoebi I'm not sure that's possible. I need to reuse the same fiber if the same instance of FiberScheduler is provided.
So a callback is much less obvious than an object instance.
 
6:25 PM
@Trowski is that an internal optimization?
 
I can see people using a closure when they shouldn't.
@bwoebi No, that's basically a requirement.
FiberScheduler == event loop. There shouldn't be multiple event loops.
 
okay
I think that's fine
 
Internally there is a fiber for each FiberScheduler that is suspended/resumed as needed.
 
but have you considered being able to set a default FiberScheduler?
and making passing it optional
sort of like Uv functions work - you have your default loop and then can use a special one if you ever need to
I mean like Fiber::setDefaultScheduler()
 
That would definitely be a possibility.
 
6:29 PM
and then Fiber::await($awaitable) would be a real possibility for those who wish to develop independently of the backing event loop
 
However most user code will not directly be using Fiber::await, most will call something like Amp\await() that handles which scheduler to use.
 
@Trowski Assuming you want to use a specific framework
instead of just the minimal coupling if you set some arbitrary event loop
 
The code creating the Awaitable needs to know what scheduler to use, so not having it available when calling Fiber::await seems unlikely.
 
I'm just saying, if we want to have a more user-friendly Fiber::await(Awaitable) - then we shall also go the whole path to making the Fiber::await() actually user friendly
 
Potentially the onResove function could return the instance of FiberScheduler.
 
6:34 PM
@Trowski ah, eih okay
 
But I think I prefer them being separate.
 
My API gets data from various 3rd party APIs for the same data, however they all use different names for their data. e.g. I have "productName", they have "product-name", "p-Name", "P_NAME"..etc I'd use adapter pattern right?
 
@bwoebi I'm still leaning toward the callback API because it's the very minimum required for Fibers to work. It saves a lot of Deferreds when doing reads in byte-stream. Plus it avoids bikeshedding on an Awaitable API that isn't really necessary just for fibers.
If we later introduce Awaitable as part of async/await, it may not even need methods.
 
@James I'd just call it 'code' rather than giving it a special name. design patterns are more about same-program level problems rather than 'stuff that's going over http' problems.
 
6:50 PM
Hmm, I'm not looking for a fancy name/pattern per-se, just trying to keep things in nice named places for tidiness. E.g. "Http/Mapper/" or whatever
 
Depends how you're doing it, but if you are trying to make them be a set of classes that have a common interface, I would do it like:
class YourProduct {
  // whatever
}

interface ProductFetcher {
  // returns YourProduct[]
  function getProductList();
}

class EbayProductFetcher implements ProductFetcher {
    function getProductList() {
       // get the data
       // convert it into an array of YourProduct aka convert from
       // "product-name", "p-Name", "P_NAME" here

       return $products;
    }
}
Though, I have a blog post about why trying to force things into a common api is bad.
 
ok thanks :)
 
/and my website hasn't even keeled over from lack of attention...
though I see multiple bugs...
 
yeah good read tho ;)
I wont mention "blog.xx/blog/" or lack of ssl :P
 
The SSL I will fix. I don't a shit about paths.
 
7:01 PM
@Trowski yes, I agree on that part. Just saying that we should have the most trivial callback API … the awaitable is desired but optional
 
@Trowski I didn't fully understand that sentence, but it sounds like it might need to be in the RFC.
actually, have a suspicion that a link to an example project will be needed...
 
@bwoebi A lib could easily provide an Awaitable API on top of the callback API (actually, that's essentially what Amp would do).
@Danack Yes, I think some example usages will be necessary and links to Amp libs using fibers so people can try it out.
I've refactored all but a couple of the libs to use fibers. They're in vX branches, were X is the current version + 1. @bwoebi @Danack If you want to try them out.
http-server and websocket-server are probably the most interesting out of the box.
In that there's examples that actually do cool things.
 
 
1 hour later…
8:33 PM
Segfault in zend_execute when opcache preload enabled ・ opcache ・ #80307
 
8:47 PM
!!lxr zend_verify_recv_arg_type_helper_SPEC
 
Total number of search results: 2
• [ /php-src/Zend/zend_vm_execute.h::2445 ] static zend_never_inline ZEND_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL <b>zend_verify_recv_arg_type_helper_SPEC</b>(zval *op_1 ZEND_OPCODE_HANDLER_ARGS_DC)
• [ /php-src/Zend/zend_vm_execute.h::3629 ] ZEND_VM_TAIL_CALL(<b>zend_verify_recv_arg_type_helper_SPEC</b>(param ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
 
@Jeeves my browser hates those links.
 
Why that user_opcode line written so many time? May be it's 256 times :P
 
9:08 PM
@Danack Number of HTML elements?
 
many.
 
9:24 PM
Has Too Many eLements
 
@Trowski It surely could … but it would probably be good if some Awaitable API could be standardized for interoperability (and at least once we introduce async/await we'll need it)
but may be out of scope of the Fiber rfc yeah :-)
 
@bwoebi Yeah, I think that should be the next step.
 
10:05 PM
@cmb It's your turn to delete an entire page worth of comments, I see. :-)
 
cmb
@Crell I removed 2 very old extensions (sqlite and msql) from the docs, and so I just quickly deleted all comments :)
 
Ahhh... That's an easy way to find stuff to delete, I suppose.
There's something still buggy about my account, so when I go on a cleaning spree I get 50 error message emails instead of the notes list getting them..
 
cmb
don't know about ML issues; I'm reading via NNTP
 
Have you gotten big surges of deletes from me in the past?
 
cmb
10:22 PM
@Crell not a single message
you can check on news-web.php.net/php.notes
 
Yeah, they always bounce.
I've deleted ~250 comments, but I just get failure emails myself. They say to forward it to some address, which I do, and nothing happens.
 
cmb
hmm, are you subscribed to that particular ML?
Well, that can't be the problem, since I'm not subscribed anyway. Maybe send a mail to systems@?
 
10:45 PM
strtotime() issue with Nov 1st ・ *General Issues ・ #80308
numerical array keys converted to int in strict mode ・ Arrays related ・ #80309
 
Omg, instant productivity improvement upon switching to PhpStorm from Eclipse
It's like a dream come true
 
@cmb I am subscribed to php-notes, yes.
Who is systems@? I feel like that's the address I forwarded the messages to in the past, to no avail.
 
cmb
systems at php.net. And yes, their response is suboptimal. php.net sucks at infra. ;)
 
I figured that address, I mean who's the person on the other end?
 
cmb
11:00 PM
I think there are several persons, what might be the problem ("oh, somebody else will cater to that...").
In important cases write to sas@, but better use that rarely. :)
 
11:17 PM
@Danack Yes, but beware. Once learned the dark side is, unlearned it cannot be.
 
YOLO
 
Well, I don't know that this is important. I mean, it's hardly a site-down.
 
> Symfony\Component\Cache\Adapter\AbstractAdapter
why not just call it Symfony/Foo?
 
Now learn every PHPStorm shortcut It will make you more productive.
 

« first day (3670 days earlier)      last day (1278 days later) »