« first day (2013 days earlier)      last day (3157 days later) » 

Wes
Wes
19:00
@JoeWatkins i didn't say the concrete class was related. but that code is legit. the abstract in B is saying that the method in A is no longer valid (because of other methods in B) and force child classes (eg C) to reimplement it
posted on April 20, 2016 by bwoebi

amphp/aerys-session v0.2.0

@bwoebi ya
@bwoebi Why would order matter?
@NikiC you could decide to make foo("12") with function foo(int|bool) to be casted to int, because string is not in list and int is first.
Just saying that it's a possibility how you could solve weak types.
@bwoebi A bad possibility
Agree.
19:04
You wouldn't be able to get reasonable int|float behavior with that
But other people did suggest that.
Where reasonable is cast "12" to int and "12.5" to float
Wes
Wes
@JoeWatkins works in java ideone.com/wqbYvu
@NikiC for example
our is_numeric handling is doing that quite well.
@Wes Java is doing it wrongly, not we!
Wes
Wes
not sure if serious
19:06
@Wes I am.
Wes
Wes
then you are wrong :P
nah :-P
I am obviously right.
:-P
Wes
Wes
tsk
could the compiler sort the types in the prefered order ?
@JoeWatkins Not sure why you'd need a preferred order here
19:12
I mean prefered for us
engine
correct order
we'd just branch checking whether types are present
like pass in string for int|bool … [simplified syntax:]
Morning part II
typedef struct _zend_union_t {
	zend_uchar *types;
	uint32_t    count;
	zend_class_entry **ce;
	uint32_t    classes;
} zend_union_t;

/*
types[0] = IS_LONG
types[1] = IS_DOUBLE
types[2] = IS_OBJECT -> classes[0]
types[3] = IS_OBJECT -> classes[1]
*/

zend_uniont_t* zend_create_union() {
	return (zend_union_t*) ecalloc(1, sizeof(zend_union_t));
}

void zend_union_append(zend_union_t *u, zend_uchar type, zend_class_entry *ce) {
	u->types = u->types ?
		 erealloc(sizeof(zend_uchar) * ++u->count) :
this would be horrible ?
Wes
Wes
he wasn't joking
user image
6
@Jimbo :D
switch (is_numeric_ex(Z_STR_P(zv), &lval, &dval)) {
    case IS_LONG: if (types & MAY_BE_LONG) { ZVAL_LONG(zv, lval); break; }
    case IS_DOUBLE: if (types & MAY_BE_DOUBLE) { ZVAL_DOUBLE(zv, dval); } else if (types & MAY_BE_LONG) { ZVAL_LONG(zv, lval); break; }
    default: if (types & MAY_BE_BOOL) { convert_to_bool(zv); } else if (types & MAY_BE_LONG) { ZVAL_LONG(zv, 0);} else { convert_to_double(zv); } }
}
(considering the scalars bool|int|float|string, we can have similar solutions for each of the four cases)
19:19
I super hate the idea of having to write extension code that looks like that ... super hate it
@JoeWatkins extension code?
how will zpp work ?
this is unrelated to zpp
yeah I guess it has to work for internals too, right ?
with zpp internal functions currently all accept zval and cast themselves [with no consistent rules]
19:20
what ?
no they don't
they do when they accept unions
yeah sure, but if we are adding it as a feature ...
@JoeWatkins sure, but at that point we'd BC break internal functions … would need to be careful there
out of scope currently I think.
19:38
@JoeWatkins This looks roughly like what I am planning on.
Multicatch is awesome , hope it will be pushed forward :D
it's not super efficient, the masks thing is better for scalar case, but I can't figure out how to combine the two ...
Actually, it isn't.
But maybe it's what I should do.
Anyone here ever had memory problems when running functional tests for a REST API in Symfony?
Once about 130 of them run I get an error saying it can't allocate anymore memory and it seems to be something got to do with Doctrines UnitOfWork class
I do clear the entity manager before each test so I don't know what it could be
@tibanez usually a reference kept to an entity somewhere
maybe one of the services is keeping a reference to your entity graph, and PHP can't GC it
19:44
@Ocramius Damn this could be tough to debug
well, put breakpoints and measure memory after every breakpoint
@tibanez do you keep reference to a Client instance or an entity in the TestCase itself?
Lester...
@Ocramius I think only the entity manager and the entities themselves hold references to the entities and tokenstorage holds an instance of a User. I can't think of any other place.
@nikita2206 Maybe to the Client, I will check
@PeeHaa Nope.
19:47
@nikita2206 I do hold a reference to the client but I reset it before each test
@NikiC c'mon ... that's funny ..
@tibanez null it upon tearDown
@JoeWatkins I should ask for a refund
@tibanez each test runs in a different instance of TestCase, so the fact that you reset it in setUp doesn't mean that you erase the old one from another TestCase
@nikita2206 Thanks I'll try now
19:48
For all the time spent reading his mails where he says the same thing again and again
@nikita2206 Okay they are running now. Lets hope for the best
@NikiC lol
@nikita2206 When all tests in a case are done why doesn't it just GC the test case instance
he must really have nobody to talk too ... maybe we should send him a cat ...
@nikita2206 Wow it works! Thank you so much.
19:50
@tibanez AFAI remember it keeps them for statistics or stuff like that
@nikita2206 I assumed after all tests in a case were run the instance of the test case would be nulled and GC
@tibanez if you keep the user, and the user in turn has reference to other entities, then you got your problem
struct {
    zend_bool allows_null; //this would be padding on 64 bit system anyway; may as well optimize
    uint32_t count;
    zend_uchar * types;
    zend_class_entry ** entries;
};
I was thinking something like this, @JoeWatkins.
@nikita2206 Okay thanks. I'm so happy now! I can move forward with my development
@Ocramius It turned out that It was a reference held to Client for each test case which needed to be nulled and GC
@tibanez I think you have a misconception regarding how tests are run. You are assuming that it goes roughly like this: $tc = new SomeTest(); foreach ($tc->tests() as $testMethod) $tc->$testMethod(); . But in reality it looks more like this: foreach (testsOf(SomeTest::class) as $testMethod) (new SomeTest)->$testMethod(); - as you can see it creates a new TestCase instance for each test in your test case (and it also stores them for later use)
19:55
@LeviMorrison it looks okay to me .. and maybe the mask thing does fall down because of all the branching ...
but then similar branching has to go on somewhere ...
Roughly the memory layout: i.sstatic.net/TBLJC.jpg
(not as nasty)
mask better
yeah I think it might be too ...
@nikita2206 Thanks for that it's good to know. I was going crazy trying to find out what was going on. I tried everything except set Client to null
19:57
@NikiC To clarify, instead of zend_bool use a zend_uchar and masks for primitives?
Are our primitive types distinct bitwise?
Or would have it have to have a different mask that gets mapped to the zend_uchar of the type?
@LeviMorrison We have MAY_BE_* flags that are intended for use in bitsets
at this point, I want to see any implementation, even if it's bad, we can see how bad it is, and what it will take to make it acceptable ... anything that works is better than nothing at all ...
@LeviMorrison you can do 1 << type and use that as mask
I'm not finding MAY_BE_INT or MAY_BE_FLOAT; are those full names?
@LeviMorrison inside optimizer
20:00
@LeviMorrison LONG DOUBLE
Oh yeah.
they're not in optimizer
So... it needs to store a count of types in the union probably and the size of the array of the zend_class_entries. This is assuming order doesn't need to be preserved.
surprisingly ...
@JoeWatkins MAY_BE_LONG at least was once in optimizer…
20:03
yeah I fully expected it to be
@JoeWatkins I see no reason why
everything is
So if we try to smash them into the bitmask how should I know which ones should be attempted when type checking? You would have to iterate across all built-in types every time, right?
wow stas can go fuck himself
ugh
> In other words, somebody wrote code that is supposed to only accept ints
but does no checks. Somebody wrote tests that actually don't test
anything. Somebody signed off on code that was not properly designed or
tested to go into production. And the language is to blame. Right.
Are you referring to that?
20:06
yes
@NikiC woah, that escalated quickly.
@LeviMorrison you just have to iterate if there's no exact match (after all, that's the point of a bitmask…)
I'm still not sure that's better than the memory structure I proposed.
I guess it would do fewer allocations.
So that's a plus.
@LeviMorrison why fewer? you allocate them all at once in one single C array
If we end up needing to preserve original order for any reason (such as for error messages) then we can't do that bitmask approach anyway.
20:09
@MadaraUchiha Could you unfreeze chat.stackoverflow.com/rooms/108307/bugcache please?
@tibanez consider referencing just the identifier then
@LeviMorrison why would we have to preserve order for an error message?
Unsubscribed from internals
No need to deal with this stupid
Expected int | float got Traversable; but if it was defined as float | int then that would seem weird.
@NikiC you … don't have to read every single mail.
@LeviMorrison doubt that's an issue
20:12
@bwoebi Signal to noise ratio is very low.
@NikiC I ignore most mails except I have really nothing to do and want to facepalm a bit.
@bwoebi Using roughly this layout we'd have to be sure to pad the zend_uchar array out so it matches alignment for 32 or 64 bit pointers respectively.
(In order to fuse it)
@LeviMorrison or you could make it easy and swap primitives and classes
Oh, true.
Good idea.
@NikiC facebook.com/careers I hear HHVM could use some help...
duck
20:18
Maybe it is coincidence but 90% of the people on that page are female.
@Sara I thought we wanted to finish university degrees first though :-P
Yeah, they rotate through.
Pfft... Degrees...
NikiC: HHVM's hiring for both performance and open source ;)
This reminds me of a study where it was determined that if women spoke 1/4 as much as men in a meeting, the men perceived the participation in the meeting as roughly equal. But if it was actually equal, the men perceived the women as dominating the meeting.

No reason...
20:22
Nikita's just too smart … veryone wants him :-D
Nah, @NikiC is scared. He knows he won't be the smartest person on the team.
(mwilliams is spooky smart)
@Sara I don't know how to quantify spooky smart :-D
It's spooky.
@Sara The pictures seem to rotate through at different intervals, but I promise it really was like 90% female when I first looked ^_^
@LeviMorrison Well, if it helps. Only about 5% of engineering is female. Particularly in infra.
In fact, I think my leaving probably moved the needly by a percent or so.
20:26
@Sara spooky near or spooky at a distance?
@Sara were you just like a hundred people?
I don't care about gender balance. Maybe it's my white male American privilege speaking but I've always found it odd that for-profit organizations don't always hire the people they think are the best, regardless of that person's gender, race, religion, etc.
@Ocramius Conventional spooky. He's spooky whether you're observing him or not.
@Sara was there any stats on how women perceived participation of men?
20:28
@LeviMorrison For the most part, they don't. But they do make extra efforts during recruiting to find qualified people of under-represented groups.
Ugh is somebody tweaking the so main templates again?
@LeviMorrison yeah (as long as we can't use MAY_BE types)
shit yeah. looks different
@FélixGagnon-Grenier They said women perceived things pretty much as they were.
@PeeHaa what changed?
20:30
I think I see green things everywhere where they previously weren't
@PeeHaa You're having a stroke.
Oh shit is that what this is :|
PeeHaa: <reddit> get a CO sensor </reddit>
Not sure if acid or stroke
@Sara if you can find a link, I'd be happy to read the study
20:32
Are you horny?
'cause I find acid makes me horny as all hell
@PeeHaa Or just part of A/B testing?
Defak!? Seriosuly?
This went from weird to awkward.
@FélixGagnon-Grenier About to head out the door. Should be able to google it...
@Sara heh
20:33
I wouldn't not subscribe a trip as getting horny tbh :)
@Sara That does have the ring of truth ^^
@LeviMorrison I'm not tripping right now...
yeah, there's a lot of studies that come up. like this
@PeeHaa Different people, different brains...
ALso "subscribe"? wtf...
I think I am indeed having a stroke
20:34
@PeeHaa By green things, do you mean the "answered" blobs?
If so, we're probably both having a stroke...
Yes and on question detail page the broken green things on the right without any padding
anyway, outtie... ciao
20:38
@PeeHaa I'm not seeing what you must be seeing … Probably they at SE only tried Chrome and forgot the fox?
Or they think I'm just the perfect guinea pig for their experiments
So I attended my first php user group meeting yesterday. Wasn't sure if I would go or not but I saw there was free pizza.
Ekn
Ekn
evenings
Arrived too late for any pizza, but it was pretty interesting anyway
20:47
@Sara Wow, I didn't know Eric Lippert works on Hack as well
21:02
How do you clear out cache for Zend/zend_language_parser.y? I keep getting compile errors from another branch after I've done make clean and make distclean. :/
Crap - never mind. I'm a dummy. I think I branched from my WIP branch instead of master...
Crap again - Zend/zend_language_parser.c is in the .gitignore! ... Sigh
@SammyK are you looking for -X?
@NikiC I'm not sure. A while ago I started adding a new keyword to bison and now I can't figure out how to clean out the auto-generated files. Or at least I think they are auto generated. :)
@SammyK just rm them
@bwoebi Is there a script that does this or do I have to find them manually?
at least that's my typical quick and dirty solution for it
@SammyK not that I'd know
21:14
@SammyK There is ./vcsclean
Which does a git clean -Xf
@NikiC Oh nice! Thanks! :)
Going to add that to my "compile php-src script" :)
21:46
Hello, if i change my Apache listen port from 80 to something else ,say 8000, do i always have to put the new port in the url to acces it ?? when i am on port 80 i only need to type localhost, but with the new one i have to type localhost:8000 why ??
Not exactly sure about that, but my understanding is 80 is the default port. If your server is not listening on it, you have to specify the port so the server can catch it. Maybe there's some system wide setting that can change default port for different protocols
ThW
ThW
Here is not setting for that.
80 is the default port for http server, the port http clients will use if no port is specified
not for https btw
@FélixGagnon-Grenier exactly my question, can i change the default http port from 80 to something else ?
ThW
ThW
you input an url into your webbrowser without a port, so the browser defaults to port 80, no connection to the server, no option to change, ...
I realize as I say it that it's not dependant on the server, the port is chosen by the requester
ThW
ThW
21:56
exactly
the default port depends on the protocol
if i change the apache listen port to 8888 , what should my url look like to acces my website ?
hostname:8888
mngning
There are so many things to be learnt
@littlepootis that's ugly , sticking to 80 or 443 are the best options i guess :(
22:09
@bwoebi that's right, just pushed again.
Looks pretty slick now :-)
o/ merge before stas comes back
@marcio may you please include some case in the tests where the value exists and is non-null on the left?
sure
22:17
@marcio iirc you must also include constant folding
@NikiC can you give an example?
@marcio [1][1] ?? 0 << must return 0
(I think that's what Nikita meant)
@marcio I'm not sure what exactly would fail, but I have this vague memory that something would
php -a # Interactive shell

php > ini_set('error_reporting', E_ALL);
php > const A = [1 => 1];
php > var_dump(A[1][1] ?? 0);
int(0)
@marcio Try [][]??0
22:26
@marcio nah, const A = [1][1] ?? 0;
php > const B = [1][1] ?? 0;
php > var_dump(B);
int(0)
php >
good
The bit about the empty [] is important
@NikiC segfault :D
this should have been a Fatal error: Cannot use [] for reading in {file} on line {n}, right?
something similar to that, right
22:31
that's embarrassing =~ l'll fix, thanks
@NikiC speaking about vague memory, is there anything pendent about T_HALT_COMPILER yet?
@marcio I dropped it :P
Nobody noticed ^^
@NikiC I did, but saw no reason to complain
@bwoebi here's a toothpick to help you make a larger smile.
@NikiC they'll only notice this when a fuzzer becomes part of the test suite :P
@Ocramius now, that made me smile :-P
But … amphp.org/docs/aerys-session/session.html THIS is a session API. Not the crap we have in ext/session…
22:40
It could need some:
@bwoebi just use signed JWT cookies :P
they work and are much simpler than doing I/O
@Ocramius it depends on your use case
JWT cookies surely are a nice solution, but they don't allow locked writing for example
Eh, I went over the list of use-cases... most use-cases requiring server-side storage of session secrets are easily solved by storing a secret identifier in the publicly visible token
99% of use-cases covered :D
two concurrent cookies might be sent at the same time with different contents
it's now lottery what's gone through
Yes, but unless you are writing an app with concurrent websockets everywhere, I hardly see that as a relevant problem
the user always has a concurrency of 1 :P
@Ocramius not necessarily. He might abort and do a second request
(because the first one takes too long)
22:43
true, but I usually do CSRF validation for that
anyway, still better than ext/session :D
can we just deprecate it? j/k
@Ocramius where is the csrf token stored?
in the cookie/session usually…
that doesn't help here.
@Ocramius s/j\/k//
good point. Would probably need to hash a server-side identifier in those cases
sigh
@Ocramius and that's where you need intelligently lockable sessions.
Yes, but for that I'd still just use a DB that supports locking, and then block one of the two requests when fetching the secret identifier
@Ocramius well… that's exactly what the aerys-session module does
it uses redis to lock…
22:47
yeah, except that for me the locking functionality is something completely optional and out of the 80/20 use-case
that's why I switched to no-storage at all. I can still build the locking, if strictly needed
sorry, this turned into a debate, I didn't want to diminish the purpose of the lib: I know what it does
@Ocramius right, and that's why aerys-session supports a read() mode without locking (where you can't write to either)
@Ocramius oh. Nah, never felt you did that. I was arguing the general problems of JWT and serverside sessions...
Yeah, I know the limitations, I just consider them acceptable for pretty much every website
@Ocramius also, JWT still needs to connect to database if you want to be able to give people the ability to close one of the open sessions.
@Ocramius yeah, it's fine for most non-critical or security-sensitive sites
Yes, I don't need to clear user sessions. If a security issue arises, I change the signing key and reset all sessions
no, we're talking government websites here, tbh
used it for authorization there before ;-)
@Ocramius ah, you have one signing key per user … but then you need to look that one up though
22:51
no, I have a shared key
we just reset the key should a security issue arise. Much like "they downloaded your password hashes", please reset your password
you mean really all with all. Thought all of one user.
yes, all users at once
we just replace the RSA keys
@Ocramius gov websites are anyway insecure by default, nothing to secure there… :-D
or simply re-deploy everything with new RSA keys
@Ocramius so yeah, whether JWT is good enough depends on your requirements. :-)
22:54
I just don't see 2 non-GET requests coming in at the same time EVER on any common management app
or CMS, or blog, or similar
@Ocramius but anyway, I'd happily replace ext/session with something sane like the aerys-session interface
different if you are writing a space-fighter game
I'd rather not have something like that in core again, heh... The number of things to configure to make it "secure" (and that cannot be changed without breaking BC) is enormous
@Ocramius they are rare, but they exist. At least I experienced them a few times … just a few times, but they exist.
@Ocramius Yeah, if you start with crap, it doesn't get better when you patch around.
Yes, but anything added to core ends up being crap anyway (see latest ext-openssl API additions)
@Ocramius depends on who adds them
23:07
and who votes on RFCs :P
Remember that a board of "highly valued" software development teams gave us PSR-6
@Ocramius yea………
seriously… a link interface?
No, no, nooooo…
heh, always these session api tests breaking the build
oh, this is so satisfying:
23:22
lol
@marcio thanks :-)
@marcio ah, that was not quite the fix I had in mind there
@marcio Try something like null ?? __LINE__
@Ocramius is that the HTTP one? I went to a user group once, and the talk sounded like it was going to be good, and it turned out to be "I'm responsible for PSR-X"... good job there was free beer.
@Leigh no, it's the caching one, which has basic SOLID design violations
btw, if it was Beau, they did a good job at PSR-7
Oh. Never heard of that one.. ... ... ... ......... \o/
My favourite bit about PSRs, are the way the S and the R are kind of self contradictory :)
Oh, don't pull that shit up
they are useful documents, regardless of whatever the acronym means
23:36
can't help it, I'm me
@NikiC arghs
and I already merged :x … fixing :s
@Ocramius jokes aside, the style and organisational stuff has been great
time for peaceful slumber :)
will somebody complain if I put this on my website's 404 page?
nvm
dammit, of course they cloak the URL -.-
hmm, ctrl+c aborting a git checkout is quite destructive…
Exception Codes: KERN_INVALID_ADDRESS at 0x0000400000000000

chrome crashed :-(

« first day (2013 days earlier)      last day (3157 days later) »