« first day (3739 days earlier)      last day (1192 days later) » 

DGF
12:00 AM
@Dg
@Tiffany Hm yeah, true, probably role is a better fit
 
@DGF also say what you mean, using an int is just a way to map the ideas, but it requires a legend. Why can't you use varchar and name them "admin," "base," (or something similar) and "moderator"?
Or "mod," ¯\_(ツ)_/¯
 
DGF
I though of that but would need to write more, int is just a char eheh. But will think of that
 
What's wrong with writing more if it increases understanding of the code?
 
@DaveRandom bip boop
 
I have been mostly "playing with child" or "drunk and angry" today
there was a butter zone of about half an hour but it was fleeting
 
12:07 AM
Angry, why? o.O
 
I promise I will sort by Monday morn tho
 
@DaveRandom I mean it's not urgent, I'm just making it a reminder x)
 
Not like we can move lol
 
DGF
Nothing, but since it's for a school work... But yeah, the teacher would probably like that way more
 
12:09 AM
@Girgias by all accounts getting things from the UK to <anywhere else> or vice versa is essentially impossible atm anyway
 
@DaveRandom I'm back in London
 
oh cool
getting french people from france to the UK not problematic then, that at least is good to know
or at least, not impossible
 
Well, I got back on the 5th, before a bunch of rules got put in place (also I'm British/German but not French x) )
 
I will be in basildon at the end of this mth so I could drop them off to you if you want
(contact-free delivery guaranteed)
 
Hi
 
12:11 AM
yo
@Girgias orly? I thought you were french native for some reason
 
@DaveRandom Seems like a plan, dunno if my friend in Leads want it there or in London might need to ask
 
so you got a british and german passport? that's pretty sweet
 
@DaveRandom It's confusing, I grew up in France since I was 2 but my mum is German and my father was British
 
@Girgias I can get the other stuff over to him as well, I'm back on the road and up to normal business again now, I'll be passing through leeds in the next month for sure
I go "through" leeds a lot in the sense that I do a lot of stuff on that side of the M62, it won't be more than 30mins out of my way to drop it off on the way home one ever or whatever
and again, contact-free and sanitised delivery guaranteed
 
@DaveRandom I'll send you his postcode via Twitter as he's not really in Leads it's just the closest city I remember lol
 
12:14 AM
sure no worries, wherever it is will be somewhere I will be within 45mins drive at some point in the next few wks
 
Okay okay :)
 
got a bunch of stuff on in liverpool this month, supposed to install 35 PCs and 97 phones on tues and there's only been one day blocked off in the calendar and I'm nervous :-S
 
That seems a lot for one day
 
and I have to rewire a bunch of stuff when I do the swapover that's the real problem
@Girgias I mean 5 ppl and I only have to do stuff at the cabinet end
as a general rule phone system swapovers and azuread migrations kinda need to be done in one shot, otherwise you end up totally fucking up the business
it's hard to do a staged migration to a complete system swap
 
I've understood half the words of your last sentence lol
 
12:18 AM
we obviously migrate all the phone numbers and deal with all the IP routing and stuff in advance, but it creates so much more work if you try and spread things like that over multiple days, it's much easier to just throw manpower at it and do an 18hr day and then collapse for a week after
from the user PoV more than anything else, it's a fucking nightmare trying to manage 2 or more groups of users using more than one system
in general, not just in IT
people are fucking idiots, you have to put that principle at the top of every design document
see also: all events this millenium
 
@kelunik :-D
 
Right
 
> drunk and angry
 
DGF
1:03 AM
Guys, I will be doing a Contact form. The only way to send message for an email (like gmail) is using SMTP ? I'm using localhost
Or, is it even possible on localhost?
 
@DGF you will save yourself time, money and sanity if you use an email service provider to send email through their API, rather than trying to do this yourself.
Why do they pay to get that above their sendgrid domain....
 
DGF
1:35 AM
@Danack Kinda wanted to learn how to do it... How does SendGrid work? Can I users and admin talk to each other and is it possible to make a email verification with it?
But even so, If I wanted to do by myself, what would be the steps to do it?
 
2:37 AM
posted on January 09, 2021

I have some thoughts on this week. A long newspost is on the way later today.

 
Wes
3:18 AM
good morning
probably
 
3:51 AM
@DGF this room is not a good place to ask questions that need a tutorial length answer. Try google first, then ask specific questions.
@Wes I like your optimism. Is it okay to start promoting your mug yet?
 
Wes
too soon, maybe in 2022
@StatikStasis opened your stream the moment it ended
 
@Wes Constructors cannot be async. Instead use a static constructor that returns a promise and make the actual constructor private. Do the async stuff in the static method and pass the concrete values to the private constructor.
 
Wes
yep but that's horrible, especially if you have child classes
 
How is that horrible?
PqConnection is an example.
 
Wes
4:07 AM
like, in the child class you have to await for the parent class's constructor to resolve
 
Well, you might have to have some protected partial constructor, I dunno.
 
Wes
imagine you need a constructor on both the child and the parent class, and both are async
 
I so rarely use inheritance anymore it hasn't been a problem.
 
4:44 AM
Feedback/opinions on my PR to refactor the whole error handling/exception docs is very much welcomed: github.com/php/doc-en/pull/320
 
 
2 hours later…
Wes
6:48 AM
i ended up lazy loading the construction before method usage @Trowski
so like rather than
$o = yield Foo::new();
yield $o->baz();
i only have
public function baz(): Promise{
    return call(function(){
        yield $this->ensureInitialized();

        // ... method

    });
}
hopefully i am not going to regret that :B
 
@wes Is this a php syntax? it's strange for me
 
It's a generator
 
ok
 
 
1 hour later…
8:26 AM
morns
 
8:43 AM
 
 
3 hours later…
12:10 PM
Hello, do you know if dtor for destructors was removed intentionally in PHP8 for ReflectionMethod string representation? 3v4l.org/oR3UK
 
12:29 PM
@lisachenko yes
 
 
2 hours later…
2:36 PM
Hello, folks! Could you please recommend some schedules to run cron scripts? (Jenkins is not an option)
Thanks!
 
2:50 PM
Add links to external resources about php-src and ext developement ・ Documentation problem ・ #80612
 
DGF
3:19 PM
@Danack What I found out is that I need to use some kind of MTA (depending of what I'm using) if I want to be able to use email in a localhost. Is that correct? If so, what would be the best and simpliest MTA to use? I'm on MacOS but my project is on a VirtualMachine (Debian)
 
I have no idea. I have never, nor will I ever, use an MTA.
 
DGF
Guys, I have a function to validate the regist form. What do I need to do if I want to not validate the input email has the word admin after @ ?
*if the input email has the word admin after @ the user cannot register?
@Danack what would you use for a simple project in a localhost?
this is my function btw ` function validateEmail($email){

//remove unwanted chars that maybe included in the email field content
$email = filter_var($email, FILTER_SANITIZE_EMAIL);

//verify if the inputted email is according to validation standards
if( !filter_var($email, FILTER_VALIDATE_EMAIL)){
return (false);
}else {
return(true);
}
}`
 
@DGF I would use an api that allows sending emails, and setup a separate test account set of credentials. Some of them allow test credentials that don't actually send emails, but allow querying recently 'sent' emails so you can test your code is working.
Or not use email.
 
@DGF PHP8, PHP7
 
DGF
@Danack It's for security reasons that you wouldn't use MTA? That API that you show, is it easy to configure and does it actually send emails, for example for gmail? Sorry, a bit newbie
@Tpojka I'm using php7
 
3:32 PM
Ok, then use strpos() function.
 
It's that they work. And if they don't work, you can open a ticket to get something fixed. If it's your own email server or using a free SMTP account, and suddenly you find that half your emails aren't being delivered, due to being rejected as looking fake, trying to fix that stuff is too annoying.
 
😂
@PeeHaa league today, later? Maybe?
 
Yeah could do a round in a bit. Finishing food right now
 
Mobile chat strikes again
I need to eat and clean. I have to make up yesterday when I felt sick. Also, isolating to be safe x_x
 
DGF
3:43 PM
@Tpojka Like this? ` function validateEmail($email){

//remove unwanted chars that maybe included in the email field content
$email = filter_var($email, FILTER_SANITIZE_EMAIL);

$pos = strpos($email, 'admin');

//verify if the inputted email is according to validation standards
if( !filter_var($email, FILTER_VALIDATE_EMAIL) || $pos !== false){
return (false);
}else {
return(true);
}
} `
For what I see in php.net it needs to have 2 = signals ($pos !== false). Why is that, why not only != ?
@Danack Got it, thanks for the input
 
!= is not type safe, !== is type safe. != will type juggle/coerce whereas !== will throw an error
 
@DGF You are missing '@'. This way.
 
DGF
@Tiffany !== will check if $pos is same type (boolean) and if is also false. But != would check if it's false the same ?
*But wouldn't != check
 
cmb
see the warning at php.net/manual/en/…
 
DGF
@Tpojka '@admin' ? What if the email is eample@tttadminttt, would that work in that email?
No right? cause will only look for @admin (all togheter)
 
3:57 PM
@DGF After sanitizing email string and checking it is valid email string, strpos is checking if there is occurrence of "@admin". In valid email address there should be one occurrence of "@" character.
Be aware it will return true for "@adminttt" too.
 
DGF
@Tpojka Yes, so @tttadmin would return false (would be a valid email) right? Btw, I believe that strpos is not canse sensitive. Is there any fuction that works like that but case sensitive?
 
Edited, check again pastebin link (convert email with strtolower($email)).
For differences between == and === learn loose and strict comparisons tables.
 
DGF
@PeeHaa What's that, mailgrab?
@Tpojka Sorry, what pastbin link? Hm, yeah, I could make all emails lowercase. Didn't remember that, thanks
thanks for the reference on == and ==
== and ===
 
4:13 PM
@DGF It's a thin local mailserver for testing mails locally
Instead of actually sending mails out it will capture all mails and you can look at them / debug them
 
DGF
@PeeHaa Hmm, okay nice, I will have a look at that
 
@DGF 3v4l.org/gDS9D this is a flawed example, but something you can play with
and should give an idea
@Sean not deprecated, in the process of being rewritten :P
@Stephen it is better than I had hoped, acceptance despite my issues helps :)
 
@Tiffany great!
 
4:29 PM
@DGF This 1.
 
DGF
@Tiffany Think I understand it, there are things that even if are not implicity "false" or "true" they return false or true?
@Tpojka Can't see it, "Error, this is a private paste or is pending moderation."
 
@DGF yes. By utilizing type safety, you encourage better code. It gives you code that generally does what you expect (generally because PHP sometimes does weird shit). Occasionally, when people don't utilize type safety and rely on type juggling, they have to accommodate weird behavior, which encourages sloppy and harder-to-read code.
that's not a rule though ^
 
DGF
Got it, thanks for the input
 
Why does the manual recommend catching the exception? php.net/manual/en/pdo.construct.php
 
4:52 PM
@DGF Sorry, default visibility left. Check now.
 
DGF
5:05 PM
@Tpojka I can see it now. Thanks!
 
5:18 PM
@Dharman It's not really a recommendation - it's an example. It shows how error handling works - that it throws an explicit type PDOException - in case you want to handle the error explicitly
 
That's bad. People who read the documentation are looking for the simplest best practice way. Showing them something unrelated is just confusing. If they want to learn how exception handling works they can take a look at the manual page that explains how exceptions work.
 
Given the range of different error handling methods used by different parts of PHP, I think it's sensible. The manual page is a reference - I want to be able to go there and quickly see what parameters a function / method takes, what it returns / does and how it reports errors.
It's not showing bad practice - there's nothing bad about explicitly handling errors - it's design choice in how you want that piece of code to work.
 
There's a dedicated page here php.net/manual/en/pdo.error-handling.php it explains how it works. The constructor page should just describe how constructors work, nothing else.
@AllenJB There's nothing wrong with doing it properly. In this case, the try-catch does nothing useful.
 
5:35 PM
Even with the error reporting page (which isn't immediately visible from the PDO constructor documentation page, so you would have to know it already exists), in some cases constructor error handling differs to error handling post-construction.
I also disagree with your premise that examples must only show the absolutely minimum working code - they are examples.
And again, there's nothing improper about this code - it's not bad practice and it's not not "best practice" (stop thinking of "best practice" as "there is only 1 true way to do something")
 
Are we going to lose valuable information if I remove it from there?
 
I believe so, yes
 
IMHO, no. But this will prevent people from mindlessly copy-pasting useless try-catch statements.
 
People who are going to mindlessly copy-paste code are going to end up with terrible looking code no matter what you do. I don't see why the manual should be removing information to cater to them.
On the other hand, new users who want to know "how does this report if it failed to connect" can look at the example, even if they disregard the rest of the page (which they may not be doing just because they're "noobs", but for other reasons such as English isn't their native language), and see it immediately
 
@Tiffany you ready?
 
5:42 PM
sure
I really need to buy a new keyboard
cherry reds are so unfamiliar when I use cherry browns all day at work
 
We have that information in the section above the examples. I see no reason for the examples to show something that we don't recommend doing. It is just noise. If you want to show how to catch exceptions from the constructor then there should be a separate example that demonstrates it properly.
 
Then you have 2 examples showing almost exactly the same thing for no good reason, and some new users are going to end up having to spend time working out why there's 2 almost identical examples and what's the difference between them.
 
There are 3 examples on that page.
 
So "just 1 more" isn't an issue? Documentation should be concise
 
Why would one more be an issue?
As long as the new example provides useful information I see no reason why it would be a problem
 
5:50 PM
Because it makes the documentation less concise, in my opinion.
 
How?
It already isn't concise because we have a redundant try-catch in every example. If you dedicate one example to showing how try-catch works then it will be more concise.
 
As I said earlier, you have to spend more time reading the page to work out the difference between the examples and which applies to what you want to do.
We're going round in circles now. The try/catch isn't redundant because it shows how error handling works.
 
It is redundant, because I have learned nothing.
 
You may have learned nothing because you already know how PDO constructors work and handle errors. Think from the perspective of a new developer - or someone who's been using only mysqli for years and now has cause to use PDO. You also read English well enough to easily understand the rest of the page. And you're not pressured for time.
 
cmb
I can imagine that example has been added to show a better alternative to $db = foo_connect(...) or die('...');
 
5:59 PM
Exactly, but if I were a new developer and I wanted to learn how to make a PDO connection then what do you think I would copy into my code? I would take the whole example. There is no explanation on that page of what does the try-catch do. If there were, then a new developer would read the explanation to know that it only shows that it is possible to catch errors from the constructor, but not what to do with that caught exception.
 
The example can't tell the developer what to do with the exception because it cannot know - that's a design choice for the code being written and will differ depending on context. There are simply some things that manual examples cannot show and shouldn't try to.
I think this example does a good enough job of showing "this is what will happen if a failure occurs". I think even someone new to programming would be able to work out what's going on here or what they need to look up ("try catch" or "exception") to find out.
 
Most of PHP functions throw exceptions and yet you do not see such try-catch on every page
 
In most cases I would wager that's because those examples haven't been updated in a while. Also, in many cases those are errors not exceptions - even in the latest PHP versions there's notable differences between (thrown) errors and exceptions.
Another point: Error handling for the constructor is notable in the case of PDO because you can change the post-construction error reporting mechanism
 
6:16 PM
@NikiC ok, I see, thanks! And what about default values for properties in PHP8 when there is no explicit assignment 3v4l.org/uZDTh ?
 
@Dharman I don't see why "catching exception" === recommendation
 
Then what is it? I see no explanation on that page of what these few lines do
 
It's an example
 
Yes, an example of what?
 
If you want to flesh out the description sure, but it's useful to know that IF you want to handle a DB failure, maybe because it's remote or IDK why, you know it's a PDOException
Of different DSN usages
 
6:25 PM
Then whoever needs will check the error reporting page
 
I see no harm at all in it being in the example but whatever, that's just my opinion
Other than giving somewhat more work for translations (but that's what we live with anyway)
 
guys, I git-checkout the branch 7.4.12 I tried to compile (make clean then make -j8) But I received many to compile errors ... (configure like this ./configure --enable-debug --without-iconv) With other branches like 8.0.0 all goes well
 
./buildconf before
Also the best is to have git worktrees to not need to checkout a bajillion files everytime
 
I did it
 
Did you use --force?
Otherwise distclean
 
6:34 PM
mmm ok I will try
 
@lisachenko This is correct for untyped properties
For typed properties, hasDefaultValue returns false
 
Aha, thanks )
 
7:14 PM
@PeeHaa harro
 
8:05 PM
popcorn at the "silly question" thread.
 
knew that name was familiar... news-web.php.net/php.general/start/327357
 
Tiffany, queen of search.
 
8:54 PM
500 Internal Server Error downloading APC 3.0.18 ・ APC ・ #80613
 
9:11 PM
@Crell I'm subscribed to the general mailing list on my work email, and I see him emailing it constantly
name starts to stick after awhile
 
Wes
9:51 PM
\o
davey, how you doing
 
still alive afaict
run out of booze and it's cold out and too pissed to drive
other than that broadly fine
I got 7 different kinds of weed atm tho so can't complain
 
Wes
lol
 
10:19 PM
got a couple of real special things as well, got some from BC that was £45/3.5 but totally worth it
 
BC was 45? After 2k years must be fortune.
\o
 
yeh the price is insane compared to when I started smoking in the late 90s
but the quality control on the expensive stuff is so much better
my main smoke is some silver haze that was 220/oz, which is pretty average, at least among the contacts I have
I remember paying 120 for an oz of something prob about 95% of this quality in ~2004, though
legalise now. the tax we are wasting, if nothing else
both in lost revenue and in money wasted on fighting something that should be fucking legal
also weirdly the UK deals in metric, even drug dealers of white powery things deal in metric, weed is one of a very few things where we pointlessly still use imperial units
(milk also comes in 568ml/1pint instead of 500ml for no good reason)
oh and burgers
 
I know imperial weights well but never bothered with volumes.
 
well maybe you do, maybe you don't
UK and US measure are different
I think it both weights and volumes
I think distance is the same
I don't know weights at all really anyway, I remember there are 16floz in a pint in the US and 21floz in a pint in the UK, but I think a floz is different anyway
12inch = 1ft
3ft = 1yd
22yd = 1chain
8chain = 1 furlong
10 furlong = 1mile
I think
 
10:36 PM
Lb is 454 (or 453.something) grams. Oz is 1/16 of it.

Is all I need to know regarding food. :D

Mi = 1609.25 (I think) m.

Inch, feet and Yard are ok (well known).
Didn't know for chain and furlong yet.
 
454 I know, because burgers :-P
(you often get 4 packs which weigh that much)
@Tpojka "1 chain" (22 yards) is the length of the crease on a cricket pitch
that's the main reason I can remember it, I had a form teacher who was obsessed with cricket for 3 years
sound guy, one of the best teachers I ever had, never saw anyone get so excited about people getting pissed and hurling a ball at each other
 
wow
 
$order = try SortOrder::tryFrom($input) but ValueError => null;

$order = try(SortOrder::tryFrom($input), ValueError => null);

anyone have any other options?
 
10:48 PM
@Tiffany AKA "We're morons who keep our passwords in plain text"
 
why not just remove the requirement for a block statement between try catch?
try SortOrder::tryFrom($input) catch ValueError;
empty statement perfectly valid
 
I'm thinking about the ambiguity. Would want whatever was on the left had side to be guaranteed an assignment.
 
oh I guess you would need a semicolon after the try stmt but whatever
oic
in that case I would actually expect the error handler on the left hand side
$foo = catch<Error> $expr;
idk I hate that
but I expect it to be more like sizeof()
 
Not just catching, but assigning a value to it. As I mentioned on the newsgroups, effectively a try / catch where the catch is a match.
 
$foo = try($expr) {
    FooError => 1,
    BarError => 2,
    Error => null,
};
?
or is that not what you mean?
 
10:54 PM
That would work, although if we could do it without the need for a block at all that would be better, just because most coding standards would shove it onto 3 lines at which point it's giving up a lot of the cleanliness
 
$foo = try($expr) {
    FooError $e => 'Foo' . $e->getMessage(),
    BarError $e => 'Bar' . $e->getMessage(),
    Error => 'Dunno',
};
@MarkR if there's only one case you can bin the block
 
@IluTov Do you want to throw in some suggestions? You're the guy with the experience at it.
 
maybe add a catch() if you want to keep it visually logical
 
hmmm true wrapping () around the expr would give a definite end token.
 
I must say I'm generally a fan of recycling the try/catch keywords for this
just because of what you are doing
 
10:57 PM
$foo = try(SortOrder::tryFrom($input)) FooError => null;
 
@Girgias asked me about something similar a while ago (an expression version of try/catch). Not sure if that's something he's working on.
 
@Girgias Did you jump on this by any chance? I remember discussing it ages ago but if you're working on it, awesome
 
@MarkR I'd prefer catch(FooError => null) and catch { /* cases */ }
without the keyword it's not immediately obvious that symbol is an error type
 
$foo = try(SortOrder::tryFrom($input)) catch (Error => null) ?
 
@MarkR Well I was trying to extend the @ operator, but hadn't had a look since before I went back to France
So that one could then change I/O functions to throw exceptions
 
11:00 PM
@MarkR yeh... but then in that way it looks like the parens are superfluous... :-P
/me is not being helpful
 
I was thinking the same Dave, someone who knows the parser better than me, could the parser accurately determine catch to be the start of a catch block for all properly formed expressions before it?
 
hang on a minute
=> null is overcomplicating it
it always returns null
if you want something else use ??
it's just "suppress"
 
That's an ultra-ultra-shorthand but you'd not be able to return different values based on the error in that case.

Although:

$foo = try $expr catch => null;

Would be usable 99% of the time
 
Alternatively, try(expr) could just return the expression result or the exception. And then you decide if you want to rethrow or not. I like the idea but handling each exception type manually seems very verbose and that kind of defeats the purpose of it.
 
$foo = suppress<ExType>($expr) ?? 'whatever';
 
11:03 PM
We could also do Rust style Result<T, E>.
 
What we don't want is for a requirement that all exceptions are caught, IMO. As it's possible that things could have bubbled up from further down the stack
 
it's somewhat equivalent to unchecked() in C#
@MarkR that's true of catch(\Throwable) though, you can't stop people being dickheads
you let them specify a type
s/let them/force them to/
 
Sure, if people want to do that they can and will, but I don't think building it in that everything has to be caught is a good long term strategy.
 
oh no definitely not, that's not useful, that's just ... or die;
 
@DaveRandom Does this imply suppress returns null on failure?
 
11:06 PM
but worse, in fact
 
So any shorthand would need to account for at least allowing matching specific exception types, and rethrowing everything else
 
@IluTov it returns the result of $expr, and intercepts any exceptions of or inheriting from ExType and returns null, any other exception is thrown as normal
 
@DaveRandom Probably works well enough, although will be a pain when the expression can also evaluate to null.
 
then it's the wrong tool for the job and you shouldn't be using a shorthand
 
Aye, that's why I thought => ... I have experienced much pain with this issue with the PSR caches
 
11:09 PM
$foo = suppress<ExType>($expr) => 'whatever'; could solve that problem I guess
@MarkR yeh
whatever it is has to be simple, otherwise it isn't useful
one problem is, I suspect that $expr will always be visually complex enough that I wouldn't use it, no matter what syntax you land on
I want a block in 99% of cases
 
Agreed. Still, if we can come up with something that works on one line for 95% of cases, that will help a lot with upgrading things like IO to throw
 
the body of methods that are try { return } catch { return } are where I most see it being useful
 
$fp = try fopen('doesnotexist', 'r') catch => false;
 
/dies
omfg how fucking long have we been trying to get rid of that API :-P
 
Girgias is working on it :P
 
11:13 PM
@DaveRandom Not sure. It's a good thing to make try/catch blocks as small as possible, you don't want to catch exceptions of code that you're not expecting to actually fail.
 
failure to open a file is always exceptional
 
As an upgrade path I think it's a lot cleaner than rewriting everything to be:

try {
$fp = fopen('doesnotexist', 'r');
}
catch (FileException) {
$fp = false;
}

// continue with code here
 
@IluTov as simple as possible, sure, but that does not necessarily mean I will still be able to understand it when removing characters from the code
 
@Girgias it works!
 
functional simplicity != short
 
11:15 PM
@BruceStackOverFlow Nice :D
 
bearing in mind that try/catch is already syntactic sugar over like a trillion loc
 
Aye I gave up trying to understand the error handling opcodes after about 3 days.
Speaking of giving up, I see Tyson is going to consider jump head first into the warm embrace of everyone who hates \PHP xD
 
I know what all of those words mean but not in that order
 
\PHP namespace policy came up again in the discussion about iterable_any and iterable_all
 
@MarkR Man you gave it longer than I did lol
But it is a hot mess
on on this note I checkout out the silence-exception branch again
 
11:30 PM
@MarkR I agree we something better. Been kind of kicking around this idea for a while
given:
function foo($input, out ValidationException $exceptionOutParameter): ?int {
 ...
 ...
}
calling it like $result = foo($input, $error); results in the $error variable being set.
calling it like $result = foo($input); results in an exception if an error occurs.
 
@MarkR ah
these are presumably the same people call things www1.www-mysite.mysite.com instead of 1.www.mysite.com
I get it, naming is hard, but surely the basic principles of hierarchical naming are easy enough
 
www.mysite.1.com
 
my parents didn't name me Chris-Wright Wright
 
Wes
error handling is the thing that in my life as programmer i have changed opinion about most times
every time i think i found the ultimate definitive way turned out i didn't :B
 
On Error Goto Next
 
Wes
11:40 PM
i think a lot of programmers and book authors are very delusional about it and dragged me in their confusion
like "exceptions are for exceptional things" like it's always a binary distinction
wait, how do i say that PC
 
"binary"
 
Wes
thank you.
 
@DaveRandom Depends on the objective, a lot of my stuff gets prefixed with the last namespace before it.... UsersRepository in the Foo\Users namespace etc
 
Wes
or like "don't use try catch as goto"..... but that's what try catch is :B
 
but fuck that, I don't think anyone in their right mind would attach racial connotations for that, "black and white" in that context refers to #000 vs #fff
 
11:43 PM
I've found it helps a lot when an application could easily have 50+ things all with the same kind of names
 
Wes
@DaveRandom i know, but better to be on the safe side
 
@DaveRandom You've obviously not met Twitter :P
 
@MarkR sure, but that's about local naming, the machine's local name does not need to be the same as the last label of it's fqdn...
I mean the name it advertises over DNS does, obv
but everything else is just a label
 
Wes
right now i've settled with using union types to return success/failure and exceptions for things no one would ever want to catch
 
@MarkR *in here
:-P
 
Wes
11:47 PM
that unfortunately means i have to use a bunch of factories around constructors because i can't return stuff from constructors
 
imagine if the dickwads adopt #000 and #fff as racial abuse, some people are going to shit their pants, how can you do your job and write racist abuse!!!!1111one
 
For me, exceptions provide two things.... 1) an interruption to the flow if not handled and 2) a frozen record of where the issue occurred (trace) and why (message + type). I could see still getting 2 returning a Result with the exception embedded, but not 1 (at least without effectively enforcing try / catch anyway)
 
Wes
i don't dislike it though
 
it sounds to me like you need to look at the way you throw exceptions
and remember that you can catch interfaces
 
@bwoebi So I'm looking back into this now, and I'm still confused, to I need to iterate the live_ranges in the ZEND_HANDLE_EXCEPTION, correct? What does the zend_op_array.last_live_range element mean? Is it similar to the last_try_catch element? Or do I need to use the start/end elements from zend_live_range?
 
11:58 PM
@Girgias I don't remember context, what were you trying to achieve again?
 
Catching Exception using @ operator
 
ah, yes, then yeah.
last_live_range is the number of live ranges
so that you can do a classical for loop until
 
And change the return value (possibly later) so that one could change I/O functions to throw Exceptions instead of returning false
 

« first day (3739 days earlier)      last day (1192 days later) »