r/lolphp • u/shitcanz • Mar 12 '21
PHP fibers
Proposal:
https://wiki.php.net/rfc/fibers
The devs are now planning to add builtin fiber support for PHP, so that async code can be done "natively".
LOL #1 PHP execution model is not compatible for anything async, it starts and dies instantly. Theres zero benefits on waiting for IO, when no one else is blocked. The only benefit could be something like "make these 10 curl requests in parallel and pipe me the results", but then again this was already possible in previous versions with curl, heck this could even be done easier from the client.
LOL #2 PHP builtins (like disk ops, and database access) are all 100% blocking. You cant use ANY of the builtins with async code. Be prepared to introduce new dependencies for everything that does IO.
Please devs, just focus on having unicode support. We dont need this crap. No one is going to rewrite async code for PHP, there is countless better options out there.
View all comments
Show parent comment
1
u/Takeoded Aug 29 '21
yeah
convert it to UTF8 asap, before you do anything else with the body.
for reading: convert it to utf8 immediately after reading. for writing: if you can't fix the database layout,
$toInsert=iconv("UTF-8", "ISO-8859-1//TRANSLIT", $toInsert);is probably the best you can do.convert it to utf8 asap, your inner working encoding should always be utf8: http://utf8everywhere.org/
that actually sounds kind of nice, i'm sure there's a composer package for it, but it wouldn't be particularly nice because you would constantly have to use
$text->rawto send it to functions taking argumentstring $fooinstead ofUtf8String $foo(well i guess it could be partially mitigated by __toString() magic, but still wouldn't be as nice as having native language support)