« first day (1721 days earlier)      last day (3210 days later) » 

9:00 PM
shouldn't you invoke the "context sensitivity RFC" in this case too? Or did you really mean that $something->void() should be considered soft reserved?
the "enum" section is clearer:
> (enum) should be reserved in all contexts that are not protected by the context sensitivity RFC [...]
 
> reserved in class, interface and trait name contexts
 
hi, is there any PHP api for sending free sms..at any where?
 
@NikiC I removed the need to pass an error level to zend_throw_error. github.com/php/php-src/compare/…
That doesn't do everything we talked about, but I wanted to see what you thought first.
 
@Trowski The VA_ARGS usage there is probably an issue for MSVC
Because ##__VA_ARGS__ is a GNU extension
 
@NikiC Oh, then I suppose I have to make it a function :(
 
9:08 PM
hmmm - msvc supports most of va_args
but in teh standard manner
 
@ElizabethMSmith And the standard manner is totally useless
 
At least in a language that does not support trailing commas in function calls
Which is why MSVC doesn't actually do it in the standard manner ;)
It just does it in a different non-standard manner ^^
 
I guess I'll just make it a variadic function. Not like it will be called a lot.
 
@NikiC yea, but the RFC text is strange... it implies that there is a difference between the "void" and "enum" reservation, when in fact you just want to reserve both words for class names.
 
9:15 PM
msvc will ignore the trailing comma :)
 
Goood friday monring o/
 
9:31 PM
but it's nearly saturday :P
 
@PeeHaa \o
 
@RonaldUlyssesSwanson tsssshhh always the pessimist
@kelunik o/
 
In totally unrelated news: dayum it is hot still this night
 
See what's new in #PHP7 https://github.com/tpunt/PHP7-Reference It's not just about being fast... http://t.co/TDF3Ah5t6w
 
9:39 PM
@PeeHaa I just changed all the things to snake case for the API, then I decided that I only want snake case for array indexes in PHP, so I converted all objects to array. Then I noticed, I can't differentiate between arrays and objects anymore. I think I'll change it all back and use camelCase instead...
 
I'm liking this PHP 7 thing. So many things I wanted to fix so long ago :)
 
@NikiC I think I can just eliminate || (error_num & E_EXCEPTION) since the error handler shouldn't be called with E_EXCEPTION anymore.
 
@marcio The difference is that enum also can't be used as a function name or global constant name
@marcio That condition looks bogus. Even if zend_error is called with E_EXCEPTION, zend_error_cb shouldn't be
 
when did ArithmeticError extends Error DivisionByZeroError extends ArithmeticError was introduced? :P i've missed it
 
@RonaldUlyssesSwanson Yesterday or so
 
9:45 PM
@NikiC Ok, I just removed the condition, and E_EXCEPTION itself.
 
@Trowski nice
 
@Sherif another bc break is that division by zero was a warning returning false iirc, now it's an error
 
@RonaldUlyssesSwanson Only with intdiv().
 
@RonaldUlyssesSwanson now it's a nothing
It just return Inf, -Inf, NaN
 
a nothing ?
 
9:48 PM
@NikiC Now take a look. github.com/php/php-src/compare/…
I linked to that line because I think you wanted E_ERROR there to be 0.
 
@RonaldUlyssesSwanson I mean, it doesn't throw anything
 
not even a warning?
sorry, not understanding :P
 
@marcio I've rephrased the text, is is clearer now?
@RonaldUlyssesSwanson yes, not even a warning
 
@NikiC woa, are we talking of intdiv or any division by 0?
 
@RonaldUlyssesSwanson We're talking /, but not intdiv. intdiv throws DivisionByZeroError
 
9:53 PM
and it's definitive? or it will throw the Error at some point?
 
@Trowski yeah, that's the line I meant
 
@NikiC Ok, will have to change at least one test then too :P
 
since you guys started adding more Error types, you could consider implementing those as well
Jun 24 at 2:15, by Ronald Ulysses Swanson
Error
'---NoSuchMethodError $x->thisDoesntExist()
'---IllegalAccessError $x->thisIsAPrivateMethod()
'---InstantiationError new ThisIsAnInterface()
'---ScalarPointerError false->lol()
    '---NullPointerError null->lol()
copied straight from java
 
@Trowski Looks reasonable to me. Though maybe move the zend_throw_or_error into zend_exceptions (changed to accept an error type arg) as it seems this pattern is used in a bunch of places
 
(apart ScalarPointer, which i made up myself :P)
 
user4268046
9:56 PM
I am getting a "could not be converted to string" error when using array_diff() I looked it up, and it's because they cast to string to compare them. Is there a simple way of getting the same functionality without having to cast to string?
 
so @NikiC will 1 / 0 throw an error, trigger a warning at some point? not that i disagree with returning nan
 
@TheMineBench php.net/array-udiff
 
@Trowski Actually nevermind, doesn't seem very common
@RonaldUlyssesSwanson it is not currently planned to throw anything
I think this doesn't make sense (in PHP!), but others disagree
 
It is still a warning though.
 
the risk is that you end up as in js with nan propagating everywhere without warnings
 
10:00 PM
@NikiC Nah, it's pretty much just there. I could make it zend_throw_or_error(zend_bool throw, int type, zend_class_entry *exception_ce, const char *format, ...), but there's only one other place I'd use it.
 
@Sherif it's not
 
another option could be throwing an error when one of the operands is NAN
 
@RonaldUlyssesSwanson Go complain on list
 
16 mins ago, by NikiC
@RonaldUlyssesSwanson Yesterday or so
 
10:01 PM
like
$a = 10 / 0; // NAN, execution continues
$b = $a + 10; // Error, $a is NAN
 
No.
 
@NikiC Are you saying you removed the warning?
 
> another option could be
 
@Sherif yes, I removed it.
 
@Sherif @bwoebi did
 
10:02 PM
wtf man
Why are we removing the warning?
That's useful error information.
 
@NikiC yes, thanks. I wasn't thinking about global functions likefunction void(){}. With the risk of being a PITA, the enum section is still not 100% accurate, global constant names can have any name already: 3v4l.org/0ZvHJ. It should be:
 
> the risk is that you end up as in js with nan propagating everywhere without warnings
 
> This includes class, interface and trait names, but also global functions and constant names etc.
 
@bwoebi Was there at least discussion around this where people agreed?
Otherwise I'm going to revert the crap out of that commit.
 
@kelunik What side am I looking at here? The client side of the API?
 
10:04 PM
@marcio A matter of interpretation ^^ I was thinking about const and normal references there
 
@NikiC I know, it's just a neat. Ty for doing the RFC.
 
@Sherif have a look at internals...
 
@NikiC How about soft reserving async?
 
@PeeHaa Server side.
 
@Trowski and await
 
10:08 PM
@marcio Okay, try again ^^
 
@FlorianMargaine I suppose, though you could possibly use yield for the same purpose.
 
@Trowski I have not yet seen any evidence of this being in the works
 
@bwoebi So it does throw an error?
 
@NikiC It was something I'd like to get to eventually, but I have a long way to go.
 
@Trowski We can make async function the keyword
Like with yield from
 
10:12 PM
@NikiC Alright, if that's possible and async doesn't have to be reserved for that, then n/m.
 
It should be fully BC. (Unlike yield from which is only 99% BC ^^)
 
I was thinking the function wouldn't have to be declared using async at all, you could use async within the function and it would automatically detect it like with yield.
 
Oh wait, maybe I'm thinking about the wrong thing here. Sample usage?
I though async is only used to mark up functions
 
@kelunik Ah yes makes sense
 
@Trowski async/await usually go together (see c# or js)
 
10:15 PM
@FlorianMargaine Yeah, I suppose we wouldn't want to deviate too much.
@NikiC This is kind of contrived, but it maybe gives you an idea.
function connect($host, $port) {
    $resolver = new Resolver();
    $ip = async $resolver->resolve($host);
    $connector = new Connector();
    $connection = async $connector->connect($ip, $port);
    return $connection;
}
Usually the function is declared async, and then they use await in the function, but is that necessary?
Since we can upgrade functions with yield to a Generator, you could do the same thing here.
 
php > try { var_dump(1/0, 1 % 0); } catch(Throwable $e) { var_dump($e); }
object(DivisionByZeroError)#1 (7) {
["message":protected]=>
string(14) "Modulo by zero"
["string":"Error":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(14) "php shell code"
["line":protected]=>
int(1)
["trace":"Error":private]=>
array(0) {
}
["previous":"Error":private]=>
NULL
}
what's up with that @bwoebi ... you said you'd introduce ArithmeticError?
 
@Trowski How does this differ from doing the same thing, but using yield from instead of async?
 
Removing the warning and leaving no useful information to debug a division by zero bug is pretty silly.
 
@Sherif Write that to the list
 
the general idea for most languages is underneath you're spawning a new thread/process for async/await unlike yield and from that is asynchronous but not parallel
 
10:21 PM
Oh, you know me. I voice myself pretty loudly when I have something to detest :)
 
@NikiC At the moment, nothing. But the thought was to put an event loop in PHP itself and hide a lot of the promise/future stuff from the user.
 
@NikiC: (sorry for lazy question): yield from is with or w/o keys from from traversable?
 
woohoo
going from .tar to .tar.gz really helps
 
@Sherif sure. DivisionByZeroError extends ArtihmeticError.
 
@ElizabethMSmith exactly, that's what I'd expect too.
 
10:22 PM
@hakre with keys
 
@NikiC thx
 
@Trowski Is there anything preventing us from doing the same, but using normal coroutines?
 
@NikiC Also what @ElizabethMSmith said :)
 
@bwoebi But you aren't throwing DivisionByZeroError on division by zero! You are throwing it only on mod by zero.
 
@Sherif try intdiv.
 
10:22 PM
@NikiC No, what I'm describing is exactly what Icicle does :)
 
I don't give a rats ass about intdiv.
 
and modulo is also a division @Sherif
 
@NikiC But it depends on userland code, so it's not as fast as it could be.
 
I want the warning back or an error on division by zero the way it was.
 
@Sherif also look at the message saying "Modulo by zero"
 
10:23 PM
@bwoebi nobody uses that anyway.
 
@Sherif tried that, got rejected
 
@Trowski I mean, what's preventing us from integrating the event loop but continue using normal coroutines
 
@bwoebi By who?
 
@Sherif ?
at the message of the exception?
["message":protected]=>
string(14) "Modulo by zero"
 
Who rejected something that was already there to begin with?
 
10:24 PM
@NikiC That's a good point. Potentially nothing.
 
I'm not talking about that. I'm talking about removing the warning.
 
I think the issue there is unless you're isolating globals that can be messy if users aren't expecting parallel work
 
it's kind of nice to have both
 
If you're going to remove the warning, you have to add the error/exception or otherwise I have no way of debugging a division by zero bug.
 
10:25 PM
@Sherif because it's not a bug anymore, it is now the well-defined INF or NAN.
 
@NikiC @ElizabethMSmith Clearly this requires some more thought and investigation. If it ends up having to wait for PHP 8 because of BC, I guess so be it.
 
maybe it's worth to "fix" the bug by just reporting divsion by zero as a hard error and then turn it into a warning like previously?
 
@bwoebi No, this is absolutely the wrong way to handle this. You still broke BC and for the worse because you removed ALL useful error information permanently.
 
yup yup
 
@Sherif I didn't break the BC.
 
10:26 PM
@bwoebi No, I can still get INF or NAN with a non-division by zero operation.
You did, you removed the warning.
 
@Sherif that's not a BC issue.
 
@bwoebi It is.
 
Of course it is.
 
???
 
@Trowski Yeah. We can also hack it without BC break (async function + continue using yield from) if we really want to ^^
 
10:27 PM
I'm putting this on the thread and noting that I will revert this change if it's not addressed properly.
 
forget about BC, PHP7 is not about BC, it's getting rid of it for a good share.
 
This is just not the way this should have been handled.
 
@Sherif I will revert your revert when you just revert.
There's for me two options: leave as is or always error.
warning is not an option.
 
I wonder if we'll have a usable yield from before Python does ...
 
it needs to have some kind of error
@NikiC depends on how ambitious people get :)
 
10:28 PM
@NikiC how usable?
 
@ElizabethMSmith why? Inf is a perfectly valid value
 
in what sense? … didn't follow the whole discussion now
 
I like the yield from construct. if you have doubts, just ask, I know how to write the PHP userland code w/o it. so just ask :D
 
^ behold the verbal contract

"ZOMG php 7.1 will have async" pops up on reddit :P
 
@bwoebi I wrote some code today using yield From() (the trollius port of asyncio), because I can't feasibly use Python 3
 
10:29 PM
@bwoebi Why is warning not an option? The warning has always been there to provide the user with information that may be help them debug potentially buggy code. You're now leaving them with no way of knowing for sure. INF is not a guarantee that the operation was a result of division by zero.
 
@marcio don't you know? Reddit is dead
 
So I wonder whether we might end up having an actually, practically usable yield from before Python :P
 
only if you write it :) I'll break it!
 
@FlorianMargaine Reddit is on strike. That is different from dead (sorry for the correction).
 
@Sherif because we now have valid values. Either have a bogus value+warning (where exception is really better) or a valid value. But not valid value+warning.
@NikiC PHP > Python… that's obvious, no?
 
10:30 PM
@bwoebi Sure, it's still a potential bug.
 
I'd rather have streams objects underneath, fix the bugs, and finish the other half of the implementations :( sooo many todos
 
@NikiC Changed the code to 0. If you think this looks good, I'll merge it. github.com/php/php-src/compare/…
 
@bwoebi You're still missing the point. Valid value doesn't fix my bug if I never intended for division by zero to happen!
 
@Sherif Code can't differ between intended or not.
 
@FlorianMargaine no, I don't visit reddit very often. What happened?
 
10:31 PM
@bwoebi a warning always was on a co-channel, so I don't see a problem having a value+warning in PHP honestly.
 
@Trowski @bwoebi for you as well
 
@bwoebi What differs is my ability to hunt down the bug
 
And you don't really want to use the @ operator for that.
 
You removed the warning with no objective reasoning whatsoever.
 
also, shouldn't division by zero returning NAN?
 
10:32 PM
@Sherif objectively I removed the warning because division as per IEEE 754 on doubles (and PHP implicitly casts to double if necessary.)
 
@RonaldUlyssesSwanson inormally 0 in PHP
 
@RonaldUlyssesSwanson 0/0 == NAN
 
@RonaldUlyssesSwanson NaN is only used if the expression is indeterminate
 
@RonaldUlyssesSwanson Nope, because of floats near 0.
 
@bwoebi That isn't a reason to remove the warning. Your reasoning is in what the result of the operation is.
One has nothing to do with the other. Leave the warning as it is.
 
10:33 PM
Actually just throw the damn error.
 
@Sherif sure. IEEE 754 doesn't throw an exception then either.
 
IMO we really should just have an exception always…
but well.
 
@Sherif So you have multiple desks just for this purpose?
@bwoebi yes!
 
Yup
 
10:34 PM
always exception doens't work in PHP. and from what I learn this is really for a reason.
not only for PHP btw.
 
There's no point in discussing this with you. The error information needs to be there. Period.
 
@marcio drama, all the frontpage subreddits have gone in private mode
 
@NikiC that's what I initially did… But for some reason was rejected… so…
 
@bwoebi rejected by who?
 
@bwoebi The only person who disagrees with it is @Andrea
 
10:35 PM
It wasn't rejected. Someone complained about inconsistency.
So your solution was to go and make it even more inconsistent.
Now division by zero doesn't provide any error information at all, but mod by 0 and intdiv do ?
How did that address the issue you pointed out in the bug report?
 
@NikiC hmm okay.
 
Or conform with what you set as expectations for your patch in the list?
 
(I think)
 
I somehow had the feeling more people disagreed
 
well, if it's about inconsistency then an exception sounds right. as it was not expected.
 
10:37 PM
goddamnit rasmus please stop the fuck writing stuff in php
5
 
And people wonder why we have inconsistency throughout the language....
 
I'd like to know… what's the $code in Exception for at all?
 
@PeeHaa lol
 
@PeeHaa which file and line number please (php error style pls) ;)
 
@bwoebi Theoretically to store an error code (easier to compare than parsing an error message), but in practice nobody uses it
Apart from DB drivers maybe
 
10:38 PM
@hakre File: all of them. Line: All of them
 
@NikiC this is so true
@PeeHaa sounds like a function ^^
 
@PeeHaa ?
 
@NikiC Apart from @rdlowrey.
 
@hakre :P
 
@kelunik where does he use it?
 
10:39 PM
@NikiC I'm pretty sure plenty of people use it :)
 
@kelunik Wow, really?
 
@PeeHaa all of a sudden everybody wants to write "STATIC_ANALYZERS"
 
That's a first ^^
 
and this is a bad thing why?
better than another framework
 
@ElizabethMSmith I think they're complaining about his coding style, not about writing static analyzers :)
 
10:40 PM
@FlorianMargaine This is just the latest horrible thing coming out of him, but I genuinely hate everything he does in general
 
ah well... yeah there's some interesting PHP code out there from people you wouldn't expect
 
And no that it not subjective. Nobody likes puke in any shape or form
 
@PeeHaa ah, saw that. What's wrong about it?
 
@NikiC I've seen 3 new static analyzers popping on github this week
 
@NikiC ah...
 
10:41 PM
3 mins ago, by PeeHaa
@hakre File: all of them. Line: All of them
 
defeating a runtime by making static code analysis a requirement.
 
@NikiC Hm, actually, it's just $code = 0 because of $prev. ^^
 
@kelunik That sounds more like it :)
 
meh…
 
Actually, I've been trying to solve the static code analysis problem in PHP for years. I think it's definitely a problem worth solving. Unfortunately, it's not trivial to write a decent static code analysis tool for PHP.
Many of the things that would be useful to analyse statically happen in the runtime :/
 
10:44 PM
where is your static analyzer @Sherif ?
 
@marcio Mine was written back in the PHP 5.3 days, but I never released it. It was written in C and does some pretty scary things. Hence not releasing it publically.
It executes PHP in an isolated environment to find things like "undefined functions" for example.
Something you couldn't easily do pre php 7
 
eval(php_code);
 
@Trowski Hmm, we maybe should do zend_throw_or_error expect a zend_bool instead of a fetch_type?
 
@bwoebi It is only used in that file, but I could.
 
@Trowski in that case make it rather a static function of that file?
 
10:47 PM
@Sherif I could make good improvements with simple text analysis.
 
@bwoebi It is.
 
oh it is
@Trowski yeah, sorry. fine then.
 
btw, I've never said it here in chat, but I like the one UNIX principle to separate recordsets by newline.
or better: terminate a record-set by newline.
 
@bwoebi I could move it to zend_exceptions.c and make it take a zend_bool and error type, if you thought it could be useful elsewhere.
 
@Trowski no, currently not.
LGTM then.
 
10:49 PM
@bwoebi Alright. Step 2 is to add some more Error classes, if that sounds reasonable?
 
@hakre meh. I find this messy.
@hakre I prefer to start the record with the length of it
 
@FlorianMargaine you mean to have control characters?
 
@hakre yes
 
@Trowski It does. we just need to decide what ones exactly
 
@hakre because then you can't have the control chars in the recordset
 
10:50 PM
@FlorianMargaine sure, just use an esacpe sequence.
 
or you can, if you escape...
so it's messy.
 
@Trowski and while we're at it, deprecate the old SPL exception equivalents
 
starting with the length is simpler
also allows for simpler streaming capabilities
 
@FlorianMargaine not messy, just meta.
remember, it's text. it's not yet binary.
for processing you convert it to binary first.
 
well, I guess
 
10:52 PM
Coding best practices question. Let's say I have a User object, and I want to load a bunch of BlogPost objects into an array as a property of the User. I want to do this *whenever* I create a new User object.

I have a UserProvider and a BlogPostProvider object. Should I have the User model invoke the (BlogPostProvider object)->getBlogPostsForUser($this); method or should it be invoked by the UserProvider?
 
@bwoebi Yes, exactly. I'll merge this and then start on suggestions.
 
@Trowski :-)
 
@Sherif nvmind
 
I've been mostly working with binary these days -- archives (ar, tar), chrome messaging, etc
so I guess I'm kinda biased
 
@SilentEcho that totally depends.
 
10:53 PM
@hakre What does it depend on?
 
@SilentEcho the direction (order) of which you want to obtain those objects.
 
@hakre I'm not too concerned, as long as I end up returning a User which has a $blogPosts property which is an array of BlogPost objects. By the time {UserProvider object}->getUser($userId) is finished, this is what I need back.
 
@SilentEcho use an iteratorAggregate whcih resolves the consturction at the time of use then (lazyload)
 
@hakre fix your keyboard :P
 
@FlorianMargaine I hate to admit it, but it's more the level of blood alcohol (or how you call it) :P
 
10:56 PM
@FlorianMargaine happens to me too when writing too fast ^^ (or tired)
 
@bwoebi PEBKAC :P
@hakre hehe
 
@FlorianMargaine always.
 
@hakre So, when the User is created, it creates an implementation of IteratorAggregate, then when I call {User object}->getBlogPosts() the implementation loads them?
 
also it's really hot right now here. - just noting. I mean really hot for this region.
 
Thus saving my User from having to know anything about the BlogPostProvider... I like that.
 
10:58 PM
@SilentEcho Not, even later. When you call {User object}->getBlogPosts() it returns an object implementing the interface IteratorAggregate (technically Traversable) so you can foreach over it whenever you want.
 
@hakre Thanks, and would you inject that object at User creation time or use a new in the User object? :P
 

« first day (1721 days earlier)      last day (3210 days later) »