« first day (1503 days earlier)      last day (3445 days later) » 

4:00 PM
@FlorianMargaine tag that with rfc-discuss so I can pin it
 
can't, too late
sowy
 
then all is lost
 
> it is a crime to wear a bullet proof vest if you are commiting a crime
It is a crime to commit a crime O_o
:P
 
@RonniSkansing can´t i just show to you here?
 
4:01 PM
@PeeHaa yeah... but you know, you'll get 150 years of prison instead of 120
 
@FlorianMargaine 110 on good behavior ;-)
 
dammit, I thought it were TLS in sense of transport layer security and not thread local storage…^^
 
zere! learn zom german: buzzfeed.com/lukelewis/…
 
@RonniSkansing here pastebin.com/FWicVs6f
 
@bwoebi Tnx I was somewhat confused at first :P
 
4:02 PM
@PeeHaa yeah .. well .. the term is "felony". In some USA states it is a felony to have any amount of weed on you.
 
@bwoebi well still good, no moar TSRMLS_ALL_THE_THINGS
 
^^
@JoeWatkins I'll miss it! :-D
 
@PeeHaa what I meant by this is that if you have committed a crime while wearing the vest it tells of your intentions to expect being shot at which adds years to your sentence since this confirms you have planned the crime
 
figures
 
@bwoebi I won't miss broken builds ... it does sorta make PHP code look like PHP code ... now we're just going to look like any old C ...
 
4:04 PM
@JoeWatkins Oh, I'm sure it'll break my builds first because I add it when I shouldn't…
 
placebo
 
@JoeWatkins The contributor floodgates will open slightly ;-)
 
I'm already used to…
@JoeWatkins yeah, but should be removed nevertheless.
 
it'll still be defined as placebo for compatibility most likely ...
@bwoebi will needlessly break exts, it probably will get removed ...
but already 95% of pecl will be useless
no need to make it 99.9% straight away ...
 
no, I mean that anyway it's easy to remove the tsrmls with a simple regex all over the code.
 
4:07 PM
I meant to help with that patch, kinda abandoned anatol on it ... woops ...
 
@Naruto pastebin.com/FWicVs6f
 
I don't like this abstract final class idea
that's just encouraging awful things ...
 
@Japa do you have the word localhost anywhere else? What was the exact warning/error/notice ?
 
@JoeWatkins Agreed, but I don't have time to discuss it so I didn't chime in on Internals ^^
 
4:14 PM
@RonniSkansing thanks for answering....i only have the word when connecting...the exact warning is (translated to english): the webpage in localhost indicates: undefined
 
@JoeWatkins anatol?
 
He's a PHP core contributor.
 
haha I thought "to abandon anatol" is some kind of an expression which I didn't know
like "abandon all hope" or something
 
@Japa no problem, I am making food, so is not here all the time atm =] so if you only run the code where you connect to the db, you get that warning? or do you know which line triggers it?
 
@HamZa you in that shitty city of yours tomorrow? And near the center by any chance?
 
4:18 PM
@RonniSkansing i´m checking if it is failing or not with this: if (mysqli_connect_errno())....and it goes to else...and echoes the message that i got in....the problem is in the peace of code i have posted here before (below):
// add the header line to specify that the content type is JSON
header("Content-type: application/json");


// determine the request type
$verb = $_SERVER["REQUEST_METHOD"];

// handle a GET
if ($verb == "GET") {
	$arr = array();
	$rs = mysqli_query($link,"SELECT EmployeeID, LastName, FirstName FROM employees");

	while($obj = mysqli_fetch_object($rs)) {
		$arr[] = $obj;
	}

	echo "{\"data\":" .json_encode($arr). "}";
}
 
@Japa the "{\"data\":" looks abit strange to me.
 
@Japa echo json_encode( ['data' => $arr] ); and why not use mysqli_fetch_all instead since you don't do anything to the $obj
 
Morning
 
Good morning
Why this fails:
interface Foo {}
interface Bar extends Foo {}

abstract class A
{
        abstract public function test(Foo $x);
}

class B extends A
{
        public function test (Bar $x) {}
}
I think this code follows LSP pretty well ..
 
4:30 PM
(guess) cause it breaks the abstract signature?
 
@AlmaDo What if someone called parent::test?
Also function test(Foo $foo) and function test(Bar $x) are different signatures.
 
parent::test does not exist as it is abstract
@Leri different, but totally compatible from my perspective
 
@Gordon i have use the mysqli_fetch_all($rs) and the problem still presists...i´m tottally lost here!
 
@AlmaDo They are not. One sec.
 
@Leri how so? If entity implements Bar, then it's for sure implements Foo
 
4:35 PM
@AlmaDo Because parameter types are "invariant"; they must exactly match their parent when you inherit a method.
Here's why:
interface Foo {}
interface Bar extends Foo {}
interface Boo extends Foo {}
 
morning
 
A::test() permits Boo to be passed.
 
By subclassing A::test() in B::test(), you must allow everything that works in the parent.
Passing Boo to B::test() would fail if we allowed what you suggest because Boo is not a subclass of Bar.
But it worked in A::test() so it must work in any subclass of A.
Did that help, @AlmaDo?
Also, the example Leri posted may also be helpful to look at and understand.
@NikiC Good morning ^^
 
@LeviMorrison I got the idea, but then it should work backwards:
interface Foo {}
interface Bar extends Foo {}

abstract class A
{
        abstract public function test(Bar $x);
}

class B extends A
{
        public function test (Foo $x) {}
}
right? (but it's not accepting that as well)
 
4:41 PM
You are correct, actually.
It's called "contravariance" and it's type safe and permitted in most languages.
 
so, why it's not working?
 
Because PHP has implemented "invariant" parameters.
The types must exactly match.
We've actually been talking about permitting it, but nobody has really come up with a good use-case.
 
yes, because, despite code above "should" work (like you've explained) - it still makes no sense
I mean - I doubt that there is a use-case for it
 
Someone actually thought of something that might be useful just yesterday:
interface Reducer {
    function __invoke(Iterator $in, $initial);
}
If we had contravariant parameters you would be allowed to do this:
class MyReducer implements Reducer {
    function __invoke(Traversable $in, $initial) {}
}
 
@NikiC Hey Nikic, what does usually gives Dispatcher::METHOD_NOT_ALLOWED error on route dispatching?
 
4:49 PM
It means the HTTP method you passed isn't registered to the route.
 
@BenBeri You registered a POST handler, but requested with GET
(For example)
 
ah, ty
 
ok, thanks @LeviMorrison in any case
 
@AlmaDo If you ever come across a valid use case for contravariance, let me know ^^
 
5:06 PM
That Native TLS RFC? Oh YES PLEASE
Let TSRMLS_DC and TSRMLS_CC die a slow, and agonising death.
 
posted on November 27, 2014 by kbironneau

/* by Matías */

 
I love this, PHP 7 is really changing so much stuff.
Zend Engine 3 will be the best Zend Engine ever.
Now if only we could get rid of the Zend :p
(Especially the Ze hahaha- ok that joke isn't that clever)
 
interface Reducer {
    function __invoke(Iterator $in, $initial);
}
class MyReducer implements Reducer {
    function __invoke(Traversable $in, $initial) {}
}
First use-case for contravariant parameters I've seen.
 
5:11 PM
I just think it's interesting.
 
@LeviMorrison With the use case being "working around someone having written a stupid interface"?
 
@NikiC I mean, maybe. I'm just saying it's the first remotely viable use-case I've seen.
 
why do people want to write new projects on PHP 5.3? github.com/nikic/FastRoute/pull/26
 
5:14 PM
Yeah, that's just silliness.
 
@NikiC Because people still use old Linux versions.
PHP's release cycle is unrealistically fast.
PHP moves forward at a pace far faster than the community does.
 
no, community is moving too slowly forward.
 
@AndreaFaulds I don't see how that is relevant for php 5.3
Which didn't use the 1.5 year cycle yet
I don't expect that people use PHP 5.6 right away, but I do expect them to stop supporting an EOL PHP version on a new project
 
That's a fair point.
php -S and $x = [] FTW, long live 5.4+
Welp, Safe Casting Functions is set to be rejected by a 3/4 majority, holy shit.
 
@NikiC i) People are idiots ii) For people who have a large static server infrastructure, and haven't done any thought of how to run projects under separate versions of PHP, they have a massive technical debt to start using PHP5.4+ - Yeah, they're just ignoring their real problem, but I can see why they don't want to start upgrading.
 
5:28 PM
@NikiC Why not use at least 5.5 for a new project now? When it will be finished 5.4 will be near EOL…
 
@AndreaFaulds Well, at least the voting made a pretty pattern. And that 'abstract final' rfc should be voted even more strongly against if it gets put to the vote.
 
@Danack The pattern is imperfect, needs an extra No vote between salathe and seld
 
@Danack What's the problem with the abstract final RFC?!
 
@bwoebi Two things - the first stolen from Reddit: "This is the wrong solution to PHP not being able to autoload functions."
 
@Danack You know what'd be better than abstract final? FUNCTION-BLOODY-AUTOLOADING
 
5:31 PM
^^ ding-ding winner
 
@Danack how's that related?
 
there is a patch for that somewhere ... igor came in and asked me to fix it one day ... for 5.6 ..
 
that's obviously not a solution to that, but is there a problem with it?
 
@bwoebi The main use case for an abstract final class is a collection of static functions...
 
But the real problem is that it's a 'feature' that doesn't allow any people who aren't idiot to do anything new. All it does is try to protect people who are doing dumb things from doing dumb things. Let me quote from the RFC....
 
5:32 PM
It's one of the things I'd like to do at some point, but I'm busy just now :/
 
which is totally horrible
 
@AndreaFaulds why collection of static functions can't go to the normal class?
 
I'll do the patch for function autoload for 7 if you wanna argue with internals about it @AndreaFaulds ?
 
@nikita2206 Because you don't want it to be A) extended (final) or B) instantiated (abstract)
@JoeWatkins Yes please.
 
@AndreaFaulds sure. But what does that have to do with pure functions. There might be static context in that class...
 
5:34 PM
@AndreaFaulds what is the problem of it being instantiated?
 
@JoeWatkins If you do it, I suggest extending the existing autoloading functions rather than adding a new API like Anthony did.
@nikita2206 No clue, but it bothers somebody enough to write an RFC.
@bwoebi My normal functions might have static context - so?
 
@AndreaFaulds they have only static context each one, but no shared static context
 
@bwoebi Yeah, normal functions can't be closures, for better or worse.
 
From the RFC and email:
> Currently, PHP developers' only resource is to create a final class with a private constructor, leading to untestable and error prone code.....The reason comes not to the construct method itself, but to other
implemented methods...By forgetting "static" in any of your declared methods, you get no parse
error and gives you 2 possibilities:
- With E_STRICT enabled: Fatal error when non-static method is being
statically called. You'll only get this at runtime, leading to potentially
error prone. Now the testability come that with this addiction, you get a
 
@bwoebi But static context's kinda evil...
 
5:38 PM
phew
 
So basically the whole thing is to i) protect people who forget to write static on one of their methods. ii) Make it so that people who don't know how to setup proper error reporting for their unit tests, don't silently ignore errors.
iii) Continue using static classes as groups of functions, because of deficiencies with PHPs autoloading of functions.
Adding a hacky feature to continue a bad practice, instead of fixing the actual problem is a terrible idea.
I mean seriously - has anyone here ever had a static class and accidentally extended it and wished that the language had some way of stopping that from accidentally happening?
 
@PeeHaa Yes I am, depends at what time...
Not exactly near the center but easy to get there
 
@Danack It's not like we even have an excuse with functions, unlike C# or Java
C# and Java use "utility classes" because the language designers stupidly thought everything should be a class. PHP uses "utility classes" because nobody bothered to implement autoloading for namespaced functions.
 
@AndreaFaulds And someone with a name between SA and SE - so sascham78 ?
 
@JoeWatkins btw if you do function autoloading you should do constant autoloading while at it
@Danack :D
away, eat
 
5:46 PM
Man co-codamol works nice :)
 
@Fabor They give you the decent mg one?
 
feels nice to be paid to work on open source code
 
6:08 PM
@AndreaFaulds Actually, people did and RFC either were withdrawn or rejected. Yay, php community
 
6:30 PM
@Leri It's hard to do, that's why
It's hard to figure out a sane way to structure your code without hardcoding a list of function name => file name mappings
Which you could do, of course, but that would suck
Or of course you could put an entire namespace of funcs in one monolith
Which might work a lot of the time, but it would suck sometimes
 
And you name it function.php which would never get autoloaded accidentally by a class, ever.
 
/me is out for now, travelling
laterz
 
@DaveRandom Given how you'd be doing the same with a static class namespace, that's a silly argument.
 
7:11 PM
I'll wait ~1 week before deciding anything, but there's been little feedback on return type variance.
 
7:30 PM
I might just put it back to vote in its current state, acknowledging the limitations ^^
 
8:24 PM
@Danack 30/500mg. That okay?
 
8:53 PM
Hey @Fabor, how you doing?
 
@Fabor yeah, the over the counter stuff is just 5/500.
 
9:18 PM
How can I optimize LIKE '%string%' in mysql? 'string%' is quick because (binary) prefix search, but how to optimize contains?
 
@bwoebi I haven't used them but theoretically a full text search with a FULLTEXT index might be faster dev.mysql.com/doc/refman/5.6/en/column-indexes.html
Or you could use something more appropriate for text searches.
 
Nah, I'm not going to introduce these complex tools for that.
 
@RonniSkansing doing okay. A lot of pain without medicine though. I'm home at least.
 
@Danack I don't want to match on word boundaries, I want to match inside words.
 
9:39 PM
I just thought of a nice use-case for on-the-fly classes:
throw new VerySpecificException('message') extends Exception { };
I like it when the specificity is tied to the type, and not exclusively the message property.
 
@DanLugg and how would you catch it?
 
catch (Exception $exception)
 
I dunno, I agree about specificity it's pretty important thing that a lot of developers don't follow but this way it's kinda impossible to catch this specific excpetion
(technically, given how hints work in php, it's possible but logically it's bad)
 
@Fabor =/ Hope you get better soon... And you get hooked up with some meds asap
 
ThW
@DanLugg that's really generic
possible to add an interface and catch that?
 
9:57 PM
Possibly.
On an unrelated, however more important note.
 
ThW
like: throw new VerySpecificException('message') extends Exception implements MyLibraryException { };
 
ThW
hehe
 
@ThW Perhaps, or just simply throw new VerySpecificException() extends MyLibraryException { }
 
ThW
@DanLugg I convert errors to exceptions (not notices and warnings) so catch (Exception $e) could hide that.
i use an interface for the library exception to avoid the single point of inheritance
 
9:59 PM
I just favor new SpecificBecauseTypeException() rather than new Exception('Specific because message')
 
MMK
any drupal guy?
or any link to anyone?
 
MMK
man.. tried too much but nothing found :(
 
throw new FiveOClockException('See you Monday')
 
ThW
@DanLugg more information but same interface
 
10:25 PM
I agree it's bad, but honestly I wasn't in touch with newbie-friendly php frameworks for a while...
What do you think is better?
@tereško ^
 
Silex would be the lesser evil
and it is small enough for a newbie to understand
 
yea, =] a microframework would be better..
 
but I honestly think that learning a framework before having any clue (as is the case with OP) will actually be reaaaaaly harmful
that guy does not understand how to make a lame autoloader, but he is trying to make his own MVC frameworks ?!? for fuck sake
 
Yeah probably it's better to write some shit first to understand how things work
 
ThW
A wall that a lot of people have to hit ... the hard way
 
10:33 PM
also, @nikita2206 , from my own experience, I find having postLogin(), getMain() and putCurrent() to be much better convention for controller's methods
 
Question: if you prepare a statement in the middle of a transaction, and then roll back the transaction, would you expect the prepared statement to be executable after the roll back?
 
@ThW imagine someone learning about autoloading from this abomination //cc @nikita2206
 
@tereško I don't really like the idea of REST so I wouldn't agree with you
 
DaveRandom wild guess.. no =] (atleast that is not what I would expect)
 
the RESTlike bonuses are just that - bonuses
 
10:35 PM
But it's up to this guy how he implements all this stuff, he doesn't even know at this point what REST or Soap is (most probably) so he should not care
 
ThW
@tereško You're mean, I need more alcohol
 
@nikita2206 the point is that having if (empty($_POST)) { in each controller's method is really really dumb
 
Related question: would a cursor created during a transaction still yield results after a roll back?
(Asking what you expect, not what actually happens)
 
[= I would not expect that
 
@tereško Yeah but it's a problem of router and how your router maps routes to methods is a different story
@DaveRandom I wouldn't either
 
ThW
10:37 PM
@DaveRandom the action creating the state for the variables is reverted, so now I would not expect to access anything of that.
 
Agree on the cursor, but I can't see any reason why a prepared statement shouldn't work after the roll back
 
@nikita2206 well .. mine looks like like this
 
I mean, you haven't actually done anything to the data at that point
 
ThW
But you could, couldn't you?
 
I would expect the prepared statement to go void on the rollback
 
ThW
10:39 PM
defining variables/functions in a previous statement
 
@tereško this is one way of doing it, another is configuration where you explicitly map route patterns to method names - in this case method can have any name, be it putBlaBla or throwFoo
 
ThW
never tried that
 
@ThW Oh variables, good point
That would make a difference
defining functions in a transaction would be... weird
 
@nikita2206 you mean like this: github.com/nikic/FastRoute
 
ThW
but it is possible afaik
 
10:40 PM
@tereško yep
 
side note: transactions in an async environment are hard to think about
 
ThW
syncing async is hard to think about
completely unrelated - I love my new monitor (replaced a 2 monitor system) ;-)
 
I'd rather have two monitors than 1 big one, always. Can't really explain why.
 
No, it is actually worse, because you take a active record instance, pass to it a template and then your controller renders the AR instance. — tereško 8 secs ago
.... internet makes me sad
 
I think I'm going to just not implement cursors for now, not least because the internal impl in pecl/pq seems to be somewhat incomplete
@m6w6 ping me whenever you have a few mins to discuss a few things
 
ThW
10:47 PM
@DaveRandom plus.google.com/… 34" curved,can be used with two separate inputs
 
Also @rdlowrey I wish to discuss the promise/generator result set thing further, and generally understand where promises might be appropriate in the context of SQL (there are some places where I'm pretty sure they aren't)
@ThW That's pretty epic, but it's worth noting that I don't really game, and I've found that for working there's just no substitute for two monitors
 
ThW
You can use that as two monitors (5:4) but without the split between
 
Yeh it's the split that matters though (for me). I can't really explain why.
 
ThW
fullscreen click on one monitor is very convenient
splitting input and output while working
 
ThW
10:59 PM
@DaveRandom still waiting for the new graphics card with a displayport - i actually have the problem that the right side of the monitor had some lagging :-)
dual dvi has not enough bandwidth
 
heh :-P
 
ThW
hihi
 
11:29 PM
for fuck sake, why I am even discussing with that guy
 
fixed
 
@tereško ever discussed with a religious fanatic?
[=
 

« first day (1503 days earlier)      last day (3445 days later) »