« first day (3545 days earlier)      last day (1386 days later) » 

2:45 AM
@DarrenFelton Where are you working now?
 
 
2 hours later…
4:41 AM
@Trowski working for The Grommet. One of the devs for thegrommet.com. They're offices are out of Boston MA, but I work from home in Zimmerman, not too far from Saint Cloud.
How about you?
 
It's a tiny bit alarming when I'm woken by what sounds like all of the vehicles with sirens owned in this town. Severe thunderstorm rolling through, been going on for about two hours.
 
MN resident as well?
 
... followed by the loudest clap of thunder ...
@DarrenFelton Illinois
 
Ah. Storm rolling through here too. Lots of lightning and thunder tonight
 
I need to go check on my car and probably move it. One year I had a branch fall on my windshield during a severe thunderstorm.
 
5:01 AM
Yeah, don't think I'm getting sleep anytime soon, heh. Which sucks with a migraine.
 
:( sorry
hope it goes away for you
 
 
1 hour later…
6:37 AM
Git mergin'.
 
 
1 hour later…
8:04 AM
Brisbane PHP Meetup online in one hour. meetup.com/BrisPHP/events/271156919
 
8:14 AM
Also live streaming on youtube: youtube.com/channel/UCnjs7ZykvgWGaSQiYCNxzeA
 
 
1 hour later…
9:18 AM
morns
 
confused, the php documentation itself has no chapter on architecture, runtime assumptions, shared nothing, memory model and such things?
 
@beberlei that's because php doesn't have these things ;)
 
10:16 AM
But, I do think it's important to teach these things!
 
@Derick re podcast, i am a bit out of control of my timetable at the moment, would want to avoid adding more to it right now, maybe mid julyish?
 
10:31 AM
works for me
 
10:45 AM
@Derick wanna suggest a day and time in the week starting 13th july? i am pretty free all the afternoons
 
Potential use after free if memory limit hit during GC ・ Scripting Engine problem ・ #79760
 
You gotta be kidding me
GitHub down again?
 
@NikiC time to move to a self-hosted gitlab instance :-P
 
What was that side where you can check if it resolves from different locations?
I suspect this is another "down in Europe" thing
 
@NikiC works for me
 
10:58 AM
@NikiC I'm kinda stuck as to why my declare statement is leaking: https://github.com/php/php-src/compare/master...Girgias:throw-on-error-declare

Is EG the correct approach or do I need to use FC (file context) like the ticks directive?
 
@Girgias FC
@IluTov what is githubs ip for you?
 
@NikiC 140.82.118.4
 
@IluTov I restarted my system, still can't ping that address
While everything else works
 
@NikiC Strange, maybe they're blocking you :P
Pinging works fine from here.
 
VPN it is
 
11:08 AM
@NikiC Classic :)
 
Just hope it gets unblocked at some point, I don't want to work through vpn all the time
 
@NikiC Maybe you can do VPN split tunneling, that works quite nicely for me.
Wait whats the term...
Yeah split tunneling.
 
@Girgias Oooo, will you be adding a new API that includes error and exception?
 
@cmb feel free to take more of a lead when it comes to merging stuff ... I gave you access for a reason ... to save me time :)
no but seriously, I trust your judgement, and mine and me aren't always present ... don't wait around for me if you think you can make the correct decision on your own ...
 
@Girgias Now that I actually see your code, you don't even use EG, so no need for FC either :)
 
11:16 AM
moin all
 
Mornin
 
@Girgias tbf … I consider that the wrong approach … now instead of producing a local warning, runtime errors which do usually not happen in dev may take your whole app down. What I want is more resilent local error handling capabilities which are not resorting to error_get_last() string comparisons
Unless we'd have checked exceptions like in java, ensuring that these are caught, I consider that a bad idea. And checked exception have their own issues.
 
@NikiC I use EG to catch warnings emitted by any zend_error and co variants (also to automatically throw JsonExceptions)
@MarkR Dunno, what did you have in mind?
@bwoebi Can you expand? And tbf I've been hired to work on a this proposal more or less, but they should be open to feedback (which is the point of writing the RFC and getting it on the discussion table)
 
@Girgias Feels like we'd need an API like zend_maybe_throw_error(int errlevel, zend_class_entry* exception, const char* format, ...)
 
@MarkR are yes, possibly, will need to see how far I get/expand
 
11:28 AM
Then load up on a few thousand exception types [ hello namespaces :-) ]
 
yeah that's the biggest issue
Also introducing specific IO exceptions would be neat
 
@beberlei The 13th then, at 11:30 BST/ 12:00 CEST?
 
Zend/zend_language_scanner.l:301:15: error: conflicting types for ‘zend_lex_tstring’
feels like out of date dep, what am I missing ?
I can't build master, header order is all messed up ...
@beberlei check attributes merge, zend_attributes.h uses symbols defined in zend_compile.h and zend_compile.c includes zend_attributes.h before zend_compile.h
 
11:49 AM
I mean… consider the use cases. _When_ are usually runtime warnings thrown from functions? I can think of cases like fread, stream_select, fwrite, file_put_contents() etc, mostly I/O functions, some of them quite low level. E.g. I definitely do NOT want to see a broken pipe on the client side (my PHP code being the server) throw into my server, but just silently go the way of a failed write -> connection close and be done.
However a fwrite returning EBADF because I prematurely closed the fd (e.g. due to an ordering condition) is not inherently _bad_ (I am anyway supposed to handle any netwo
 
@bwoebi Well IO functions are the main use case, but DateTime with invalid formats could be another one for example
But it's mostly to have "exceptional code" in a catch block instead of an if(x === false) block and possibly have more specific exceptions down the line like FilePermission/NotFound/etc.
 
@Girgias Well, that sounds like something which should be an exception … and provide a function returning boolean (or string|null with proper error text) to validate it beforehand
I mean the invalid datetime formats
 
Well yeah, but @Derick doesn't want to change it due to BC concerns, mostly because there is not function to validate before hand as the function does it itself
 
@Girgias Introduce a function and change it later
 
I was also thinking about something you said about extending @ to catch Exceptions, which means we could change fopen and co to throw Exceptions without breaking all code in existence
 
11:56 AM
@Girgias I mean… that function to validate IMHO should exist in any case.
and not as a hack whether the call returns false or throws
 
@bwoebi that's indeed true
 
@Girgias And the OO API of DateTime should already throw exceptions...
the date_last_errors API is for the non-OO API
 
@Derick Should I make the OO API throw ValueErrors but not the procedural functions?
 
the OO API already throws exceptions when it needs to
 
Oh, I'll double check then just to make sure of it
 
12:04 PM
@Girgias Also, effectively, you do not care about the success of quite some I/O (when talking to a client as a server, possibly when writing to a logfile) as long as it's transient errors … but you still may want to know of non-transient errors which imply a fault on your side. You do not want a catch-all, but neither a catch-nothing… but you do not want to have to meticoulously differentiate between every single error happening
 
@bwoebi so basically an overhaul of the IO API?
 
@Girgias the big problem is that I do not know exactly what the API should look like
maybe there's a simple solution
like attaching an error context to a socket resource
 
I'm in no way an IO expert so I'm not sure I could conceive a good API, or how to improve the current one
 
user image
2
Bold claim
 
Indeed
 
12:10 PM
You might not differentiate based on the exception type, but the exception code usually goes significantly underutilised.
 
@Girgias neither am I - I have some experience dealing with these … thus I can tell that flatly converting to exceptions is not going to solve it. But it's going to be a hard topic properly designing an API for that
 
We need a working group... :(
 
12:24 PM
o/
@DaveRandom Guarantee promised and given in one phrase.
 
It's basically a bank that doesn't charge or pay interest
Might be good for money laundering
Just putting it out there
 
What are you listening to today?
 
12:40 PM
@DaveRandom ?
Music-wise
 
1:14 PM
sounds of silence atm actually
I had Frasier on before but I had to turn it off to concentrate on something and didn't put anything back on
According to Spotify the vast majority of stuff I have listened to lately is either Oasis or Bob Seger and the Silver Bullet Band
there's also a smattering of 90s/00s girl pop from when I was drunk the other night
mostly girls aloud and the sugababes but also quite a lot of en vogue
bet you wish you hadn't asked :-P
 
1:26 PM
 
2:04 PM
Any suggestions on a way of having opcache set to not check the timestamp on files, but still allow them to be reset on change? I'm using docker desktop and the round trip time of including 300 files is quite detrimental.

I'm experimenting with hooks at the windows level that will write a list of changed file timestamps to a single file and then using it to opcache_invalidate the files if they're newer than the value stored in opcache_get_stats(true).

I've ran it through xdebug's profiler and then through cachegrind and the IO RTT are upwards of 70% of the request.
 
@MarkR you can call opcache reset sometihng
 
@NikiC Can you elaborate on github.com/php/php-src/pull/5371#discussion_r446934423? Would you just add an error message to specify that information or make it accessible through properties? Is there a similar error that already does any of those?
 
@beberlei I'm effectively doing that at a per-file level, it carries a fair-chunk-o-overhead though, might be worth just eating it in favour of the simple opcache_reset approach
 
2:20 PM
If a method param has bad data, eg empty string etc, I use InvalidArgumentException. what to use when it's a bad data type in local code, eg I foreach an array and expect a non multidimension and if loop value is array I throw OutOfBoundsException. Is that sane?
 
2:30 PM
Or is UnexpectedValueException better?
 
@IluTov An error message
 
@NikiC Ok, I can do that :)
 
@James define your own exceptions. If you're writing code that is shared as a library, have one base exception for that library and extend all other exceptions from it.
 
hmm seems sane, tho I read many arguments against that. I have done so in the past, might continue that.. cheers
I also find that PHPStorm PHPCS doesn't manage builtin SPL exceptions. Like missing throws tag in docblock and uncaught at the other end if is in the docblock
 
cmb
2:49 PM
@JoeWatkins okay, will try – thanks!
 
3:05 PM
@JoeWatkins ooh. I can take a look, but its better to ping @kooldev - he did the PR on the last changes
 
3:40 PM
@cmb fyi pcre upgrade broke gcc build completely
Due to "-mshstk is needed to compile with -fcf-protection"
 
OknaPVHanosy ・ *General Issues ・ #79761
 
Why can't an implementation of an interface define a method with a more specific dependency? For example, a ModelProcessor interface has a Model dependency in the construct. Shouldn't I be able to make an AccountProcessor that implements ModelProcessor, and in that - use Account (which extends Model) as the dependency?
Right now I'm just extending it without using an interface, but I feel like it's a code smell
 
3:58 PM
@Alesana I would argue Interfaces should not define constructors because constructors are concrete implementation
 
I see, so since different implementations have different dependencies, I wouldn't define define the constructor in the interface
I suppose that makes sense
 
great
 
Thanks :D
 
yw
 
So then when we get to things like event listeners that always have a handle method, but require different events as the argument - an interface would not be appropriate because it's not a different way of doing the same thing - but actually doing a different thing?
 
4:09 PM
@Alesana why do you think inheritance is applicable here?
 
@Danack The extending class just defines a few protected properties
The rest of the functionality stays the same within the different classes
Processor was an example, what I'm using is actually a report preparer thing. The implementing class will define the report file name, the job that is used to prepare it, and some other arguments. The functionality in the abstract class will use that information to fire off the job with the right parameters
I am trying to make easily manageable code to add / modify reports in the future. I half get the feeling that what I'm doing is very right, and half get the feeling that what I'm doing is very wrong
 
If you are using inheritance over composition I would err on "doing it wrong" in general :)
I mean morngins all o/
 
I'm not familiar with composition but I will read up on it
 
The intro text on wikipedia isn't actually terrible
Composition over inheritance (or composite reuse principle) in object-oriented programming (OOP) is the principle that classes should achieve polymorphic behavior and code reuse by their composition (by containing instances of other classes that implement the desired functionality) rather than inheritance from a base or parent class. This is an often-stated principle of OOP, such as in the influential book Design Patterns. == Basics == An implementation of composition over inheritance typically begins with the creation of various interfaces representing the behaviors that the system must exhibit...
 
> I am trying to make easily manageable code to add / modify reports in the future.
That can be achieved through copy + pasting.....
I would have one queue and one processor for each type of thing.
 
4:27 PM
Even if 90% of the class code is the same, still copy and paste it?
I'll take a look at the wikipedia. I always try to avoid copying and pasting though
I guess there are times where it's better practice though
 
Depending on the details, traits may help there or moving code to a dependency.
 
Moving code to a dependency would be composition then, right?
 
4:51 PM
Datadog is still hiring for an open source PHP engineer. It can be a remote position or you can move to New York, or maybe Paris, don't remember. If you know php-src then it's a big bonus, though not required.
 
@LeviMorrison What experience level is required?
 
Here's the formal posting: datadoghq.com/careers/detail/?gh_jid=2147503. I doubt we actually care about PSRs and such.
Also, degree is not required. I don't know why employers do this, but I don't have a degree and Sammy's is not in anything tech IIRC, so it's pretty clear you don't need one.
 
If someone were to be interested in moving to one of the on-site locations, would they still be working remotely until the pandemic is over?
 
Great. I might know someone who would love to work on open source code if they're qualified for the position
 
5:08 PM
> You’ve tailored your bytecode cache engine, updated php.ini a time or two and you know PSRs by heart.
What does " tailored your bytecode cache engine" even mean @LeviMorrison :P
tweaked opcache ini settings?
 
I don't know; HR and hiring people are weird!
I'm pretty sure the idea here is that you know the language well.
If you know some community frameworks and libraries well that's a nice bonus too, because we want to add value to customers using those frameworks and libraries, and possibly build relationships in those communities to improve telemetry in the future.
 
@LeviMorrison searching for unicorns 🦄
 
:-D
 
This room has lots of people who know the language well; many of them are already employed or want to stay their own boss :)
 
FWIW, I can do contracts ;-)
 
5:24 PM
Did anyone talk to you about the part-time thing I suggested?
 
cmb
@NikiC thanks for reverting! I think we need something like vcs.pcre.org/pcre2?view=revision&revision=1256; I'll have a closer look tomorrow.
 
@LeviMorrison For reasons, I couldn't yet talk to them - I can now.
 
5:58 PM
@DaveRandom Frasier... as in the show? That's my favorite sitcom ever.
 
6:25 PM
Hi
 
Anyone here ever used d.tube ?
 
Why final and static can not be used together for class properties?
 
6:50 PM
 
combination of PHP and GO
https://spiral.dev/

any comment?
 
7:04 PM
the roadrunner engine at the bottom of this is quite cool imho
 
7:48 PM
@Shafizadeh We use the Go part (RoadRunner) in our custom made, old, legacy CMS. I've managed to get it running in like a week. Improvements in throughput can be huge for some applications (some being those that are already heavily optimized).
 
I see
 
It's not magic, you avoid bootstrapping your framework for every request. It's what node.js has done for quite a while.
And .NET Core is doing now too.
 
ah ..
 
But on the flip side you have to be more careful with shared state. Everything is a trade off.
We had more than 1 bug because someone forgot to reset a services state after a request.
 
yeah .. that's right .. choosing a framework is all based on the needs of the product
 
7:52 PM
Shared mutable state is the devil.
 
@Crell But it's also insanely convenient :P
 
Devil's temptation.
 
is "shared state" something in PHP?
 
@Crell Can we please move to Slack? (just so that I can send giphys)
 
Not to the degree it is in a multi-threaded or async language, but it can be.
@IluTov Or something else than this, yes.
Shared state in PHP means either a literal global or a state of an object that changes, meaning other code that depends on it behaves differently depending on when it's called.
Functional principles apply even in PHP. :-)
 
7:54 PM
@Shafizadeh Using RoadRunner makes it a thing. The point of it is that you're using a shared instance of your application, called a worker. It will handle multiple requests and thus it can accidentally leak state from one request to the next.
 
ah, I see ...
 
each worker is not processing requests in parallel though, like react-php. so its not a complete paradigm shift
 
@Exception final doesn't work at all for properties at the moment.
 
8:21 PM
@beberlei Did you mean to say ReactPHP does process requests in parallel or it does not?
 
8:53 PM
I hate removing duplicate arrays from an array.
 
9:08 PM
I setup EasyAdmin on Symfony, and i'm getting a No route found for "GET /admin", anyone else had this error before?
 
@KerrialBeckettNewham Did you register the bundle in the bundles file?
 
yes: EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
 
@KerrialBeckettNewham Apparently you need to manually set up the route: github.com/javiereguiluz/easy-admin-demo/blob/master/config/…
If you use symfony flex that would probably happen automatically.
 
yes, got that too
 
@KerrialBeckettNewham Then the routes aren't probably loaded. What does debug:router say?
 
9:13 PM
it's not in the route list
 
You're running in dev mode?
 
And still, have you tried cache:clear?
 
Try that :)
 
9:15 PM
@IluTov no change
 
@KerrialBeckettNewham Is the Kernel.php set up to look for all files in the route directory?
 
@IluTov I'm not sure
 
@KerrialBeckettNewham Something like this: github.com/javiereguiluz/easy-admin-demo/blob/master/src/…
 
@KerrialBeckettNewham Well, what file is the route in? Can you add it to a route file you know is working?
Can you define any other routes?
If it's a new project you can also just grab the demo and go from there.
 
9:19 PM
@IluTov yes, all the other routes are functioning
 
@KerrialBeckettNewham Then try adding it to a file that works
 
@IluTov adding what, the admin route?
 
@KerrialBeckettNewham Yeah
easy_admin_bundle:
    resource: '@EasyAdminBundle/Controller/EasyAdminController.php'
    prefix: /admin
    type: annotation
 
yes, I have that file too
 
@KerrialBeckettNewham Yeah but put it in the same file as a route you know is working
 
9:21 PM
as an annotion?
 
@KerrialBeckettNewham Sure, just any other .yaml file under config/routes that works.
 
I can define another route as /admin and the route works.. but doesn't go to Easyadmin
 
@KerrialBeckettNewham Well, how many route files do you have? What do they look like? It's hard to help you without seeing the actual code.
 
Also, are you using EasyAdmin 2 or 3? Are you looking at the right docs?
Anyway, this is as much help as I can provide without seeing the actual source code.
 
9:28 PM
@IluTov i'm using EasyAdmin 3
@IluTov what's your github username?
 
@KerrialBeckettNewham iluuu1994
(Most terrible username, I know. Thought it was good when I was 15)
 
@IluTov i read it like "I loo 19 94" lol
 
@KerrialBeckettNewham There's no easyadmin on that branch :D
 
@IluTov What?
 
@KerrialBeckettNewham Shared the wrong project maybe? ^^
 
9:32 PM
oh one sec
 
Or didn't push
 
didn't push :)
it's on dev branch
 
If anybody can have a look at the throw_on_error declare RFC before I post it on the wiki: github.com/Girgias/php-rfc-throw-on-error-declare
 
Taking a look
 
@Girgias I'll take a look too. Are there any updates on the editions proposal? I'm not convinced that adding different declares to tweak PHPs behavior is a great idea.
 
9:38 PM
Well that may start that conversation again
 
@Girgias Sorry if that has been discussed before, I haven't followed it.
 
I prefer the name promote_errors=1 but I can't remember which one of us came up with it :P
I wonder if it makes sense to do declare(promote_errors=E_WARNING) etc allowing the promotion of only errors of E_WARNING or above, allowing notices to slip under the radar until they can be completely eliminated
 
@IluTov The edition discussion was more or less ded, so
 
I should write more words....
 
Was it? Seemed everyone was just waiting on Nikic
 
9:42 PM
promote_errors is a good name, not sure I like it tho, @DavidNégrier what do you think about it?
@MarkR IIRC, they were meant to discuss it a the JetBrains IRL meetup
But well that got sacked because of COVID
@MarkR You know it only promotes E_WARNINGs currently?
There aren't that many E_NOTICES and some should probably be reclassified anyway
 
But before I write some wrong ones, my understanding is that OPCache optimised some of PHP's basic functions like strlen. Can someone either point me to how that is implemented, or some documentation of it.
 
SCCP IIRC
Let me find you the file
 
scp? Uh-oh.
 
@MarkR That was my impression as well.
 
@Girgias I'm seeing around 300 of them in the source. Still used heavily with E_NOTICE + return false
But notices would cover things such as undefined array indexes and the likes
 
9:47 PM
All the EXIF ones are false positive ones, they are meant to debug EXIF, ZIP ones should be reclassified or value errors IMHO
 
At least the E_WARNING on undefined variable would solve a lot of issues
 
Undefined var is an E_WARNING in PHP 8
So yeah it does solve a bunch
 
Looks like pgsql.c is the main offender with 90 or so
 
@MarkR Yeah, I need to go through that extension one day
DBA too
 
@KerrialBeckettNewham I haven't actually used EasyAdminBundle 3.0 before. There is no base controller anymore, you need to create your own controller for every entity. See the docs: symfony.com/doc/master/bundles/EasyAdminBundle/dashboards.html
The reason there is a 404 error is because the class still exists but it has no actions with annotations.
 
9:51 PM
Overall I think it's a good RFC. Ultimately I think that with something like editions it would ultimately become the default for them. We could still probably do with a shorthand try / catch which I never got around to finishing
 
@IluTov I thought as much, doesn't seem as easy anymore
 
@KerrialBeckettNewham It makes sense. The previous version was notoriously hard to extend. It might've worked for the simplest of cases but as soon as you had to do something more it was almost easier to just do it yourself.
 
@IluTov true, thanks a lot for having a look.
 
@Girgias This is a "no" from me for PHP 8.0.
 
I looked at adding something like:

$x = tc $fooThrows(), Error => false, Exception => -1;

But every syntax I came up with ended up needing parenthesis to work inside function args
 
9:58 PM
Which I can guess how it works, but would be working in the dark. @NikiC at the risk of asking a silly question, is there any documentation for that stuff ^^ ?
 
@NikiC Needs more fleshing out? Or too close to feature freeze?
@Danack Ah, yes
@NikiC Also if I use FC don't I need to leak the CG variable like I did for my initial PoC back in August last year?
 
@Danack you know the answer to that :P
 
use the force, Luke.
 
This is the file where the compile-time evaluation happens
 
I though it needed to be on the opcode level, but I don't understand why I'm getting promotion without any declares, but only sometimes
 
@Girgias Too close to feature freeze
 
so it was SCCP
@NikiC Will pass it on to David then, if he doesn't read R11
Did PHP 8 getted branched by the way?
Or is it still master?
Or does that happen on feature freeze
 
@Girgias Still master
Not sure when it gets branched ... preferably "as late as possible"
 
Okay okay
Whereas PHP 7.4. was ASAP? I also prefer as late as possible to not need to do a bazillion merges
 
yeh the RMs prefer the opposite, ironically for the exact same reason :-P
 
10:06 PM
@Girgias there was a biggish change that affected extensions, which there was a small amount of drama about I think. net result of which was branching to allow that to be merged into master.
I think.
 
Ahhhhh, okay
 
....I should probably test something against php8.
 
test how it feels coming out of your mouth with a beer in your hand
#protip
 
@Girgias This is a clear no from me as well, the biggest issue, apart from what I've mentioned already: what you describe as future scope (specific subclasses) is very much a requirement for the proposal to make sense at all to me. Otherwise I could just set my own error handler to throw…
And if anything, too close to feature freeze as well to allow amendments to it. (It will require some, I'm pretty sure.)
 
@bwoebi Welp, I'll get working on that tmr or Thurday then
 
10:14 PM
ftr I am +1 on all the things Bob said
 
@Girgias Don't hurry though, we shouldn't put that into PHP 8 anyways…
 
there are definitely case where the sematics of the current error are wrong, but "throw all the things" is a somewhat unhelpful step too far in the other direction
 
@bwoebi I'm not hurrying, I'm paid to work on this
 
...
 
@DaveRandom yes, exactly.
 
10:16 PM
@DaveRandom That's also true, but if you're already using an error handler which promotes everything to E_WARNING you're doing the same, this gives you some granularity
But at the end of the day it's still a local error handler
 
Also @DaveRandom maybe you have good ideas how one could properly have granularly exceptions/warnings on the I/O level functions?
 
@bwoebi Basically this. If exceptions were free I wouldn't mind - I will take a catch over an elseif tree in most cases - but they aren't and it hurts both perf and readability with I/O-bound code
or can... anyway
@bwoebi no, sorry :-/
 
@DaveRandom perf isn't even my main concern here … but you have to think about handling every specific possible error condition if you want to do that properly
 
yeh
from a pure control flow PoV, exceptions are marginally preferable if the exception heirarchy is sane
like if I can effectively express "transient I/O failure" as a superclass, fine
but I definitely can't do that because reality doesn't work that way
 
If we don't pass the namespace vote we can realistically be expecting to dump many dozens or even hundreds of extra classes into root, all part of an exception hierarchy.
 
10:22 PM
yes and no
 
@DaveRandom yep, but what constitutes a transient I/O failure for a client is different than for a server - also use cases (e.g. an intranet where we expect reliable connections… vs global)
 
what you mean is "if we don't ever..."
which is a slightly different thing
but yeh
 
Surely the only option is to throw on everything that's an error and let the user decide if to ignore it or not?
 
@bwoebi indeed, the tl;dr of all this is that I doubt there is a declarative way to do this that is cleaner than the logical way
i.e. "I/O is messy, stop pretending you can write code than isn't" :-P
(though I very wish I could :-/)
 
@Danack strlen is now an opcode
 
10:25 PM
@MarkR i mean everything other than E_ERROR is already that, in all practical ways
what people really care about is somehow magically separating errors from normal program flow... I haven't seen any evidence this is actually possible, but people persist with the idea
don't get me wrong, it's a great idea
 
@Girgias Gave it a read. You might want to specify what an example prints for clarity. And you could also simplify some examples to make them easier on the eyes. Other than that I don't have much to add.
 
@Derick magic mushrooms are now illegal, doesn't mean I treat them as such #yolo
:-P
 
declare(throw_on_error=1);
function doTheThing(){
    try {
        $fh = @fopen("not_found.txt", "r");
    } catch(Exception $e) {
        echo "I have caught an error!";
    }
}

// vs

declare(throw_on_error=1);
$fh = @fopen("not_found.txt", "r");
// Error: ...
 
the problem is that "your HDD is on fire" is very different to "a TCP push packet failed to arrive" (from an exceptional PoV)
 
I'd might also be worth specifying that some functions that only return false on failure will not benefit from this. (e.g. preg_match providing an invalid regex)
 
10:31 PM
@DaveRandom I don't think so tbh... if I'm writing network code, a TCP connection failing is a serious issue, if im writing file code, my HDD being on fire is a serious issue. We cannot predict what is mission critical to the particular user, so it all must be treat like it is, and throw accordingly
 
That was a bad example I concede, a better example might be that fwrite(...) === false is not always a permanent failure
and is fread(tcp://...) === /* remote endpoint gracefully closed socket */ exceptional?
and if it isn't, how do I detect that in a way that doesn't require catching an exception?
 
@MarkR I would prefer a more declarative way to tell the function (or object/resource the function is called on) what my needs are
 
True, but exceptions are not limited to permanent failures are they?
 
@MarkR no, and ftr I'm not dead against what you are saying, but there are definitely edge cases which imo need to be resolved ahead of time
 
@bwoebi That leaves us with 4 options IMO... 1) annotations 2) file level 3) block level or 4) shorthand try/catch.
 
10:35 PM
in fact @MarkR here's a better example of a thing I'm really not sure about:
 
@MarkR 5) attach info to the individual resource (i.e. after accepting/opening usually)
 
fclose(...); // this failed somehow. what now?
it doesn't necessarily to blindly throw if closing a resource of any kind failed
 
@DaveRandom sigh… getting flashbacks to fclose throwing openssl errors…
 
@bwoebi IMO that would cause design issues as the behaviour of that object would be determined by whatever set it up, if I create a DoSomething object and pass it back, I'd have to check a $something->errorHandler each time to ensure I could depend on its error handling logic.
 
it failed, so chances are the resource is dead, but it probably doesn't make practical sense to disrupt the program flow in that scenario, because the resource is dead anyway and there's nothing you can do about that
 
10:38 PM
@DaveRandom I think that's where shorthand would come in IMHO.... try fclose(...), Exception => null; explicitly throwing away the exception by "assigning" the return zval a null.
 
ftr I don't have a "right" answer here, I'm mostly just complaining about shit that is unreasonable and you can feel free to Do It Anyway™ :-P
 
@MarkR well, you can either a) replace the info yourself or b) know that you used the right class for your use case (like an externalSocketServer which will give you the correct handling for external client sockets)
 
@MarkR yeh but my point is that I never want to do that with fclose()... I can already use @ but even if I do I still want the error message
 
@MarkR the problem is … you do not want to even have to think about the fact that something like fclose() could ever throw… because it's bullshit in 99.9% of the cases
 
In some ways what I want is a way to still raise E_WARNING without disrupting anything... which we already have... what is it that needs changing again? :-P
 
10:41 PM
but for logging the error message would be good to detect later on what went wrong
@DaveRandom you want to see some types of warnings, but not others and some of them you want to handle
 
yes, that was the original idea of E_ERROR/E_WARNING/E_NOTICE tbf
 
IMHO exceptions form a big part of defensive programming. You either handle them or you crash out execution because you're in a state you didn't anticipate.
 
3 mins ago, by DaveRandom
ftr I don't have a "right" answer here, I'm mostly just complaining about shit that is unreasonable and you can feel free to Do It Anyway™ :-P
to reiterate :-P
 
like in C write(2) -> can emit eintr, epipe or ebadf. eintr? retry. epipe? ignore and continue. ebadf? throw.
 
EAGAIN? lol go read the docs more
 
10:44 PM
@MarkR there is a limit to what you want to handle. fwrite() can fail from many causes.
 
I am so hoping the edit window expires rn
 
@IluTov Seems a good point to bring up, although I don't consider those failure states personally, they are valid, albeit dumb, return values, same as with strpos returning false
 
@DaveRandom sorry :-P
 
:-P
 
@bwoebi I don't see a situation in which I was writing code that handled fwrites that I wouldn't not want it to throw though. What's necessary would be a decent exception hierarchy that would allow discarding specific errors or groups of errors easily.
 
10:47 PM
@DaveRandom there are more, but just to illustrate
@MarkR Can you even properly group that?
 
@bwoebi ofc :-P
 
@bwoebi It's a valid point. I think IO is the hardest of the lot.
 

« first day (3545 days earlier)      last day (1386 days later) »