« first day (1180 days earlier)      last day (3994 days later) » 

user895378
22:00
@ircmaxell Then it shouldn't be called an HTTP message standard.
@ircmaxell yeah, getting nice unicorns… and now a 500.
@rdlowrey then it's maybe not that
user895378
I guess I can't say anything else because the github unicorn is poking me right now.
user895378
My biggest problem with PSR (aside from creating make-believe standards out of arbitrary things) is that it's like public education: all they're doing is enforcing a standard level of mediocrity on everyone.
@Danack
> Session locking - If an application knows that it won't be writing any
> data to the session, it should be able to read the session data
> without ever locking the session data.
really ?
if you hold no lock at all, and someone writes while you are reading, what do you think will happen ...
that doesn't make good sense ...
user895378
22:04
@JoeWatkins I assume he means an exclusive write lock, right?
user895378
Oh ... well locking is certainly required for data integrity.
> There are also session write operations that just don't need any
> locking at all. For example if you want to just record the number of
> pages a user has viewed since they logged in:
this is all wrong
we cannot do that, in practice it would be unusable
you either need locking, or an atomic write operation
user895378
If someone is having problems with session locking why are they using the built-in file handler anyway?
22:05
and without locking, you could have 2 atomic writes overwrite each other
you want rwlocks, multiple readers are fine, but there must be exclusive writes
user895378
^^ definitely.
user895378
If locks are causing a problem in your app then you're very likely doing it wrong.
not in general, since you don't know (at the session layer anyway) if you need a read or read/write
otherwise you could write based on out-of-date info
well actually ... $_SESSION could be a Session Object with handlers that use rwlocks ...
it's definitely doable ...
user895378
22:07
Funny this comes up. Today and yesterday I implemented my own top-down userland web sapi session solution because ext/session is so awful.
using object handlers informs the session layer ... you could do it ...
Well, that's at the time of write
but what if you need to SELECT FOR UPDATE?
or read
meaning: read something, modify it and then write it back. It could have changed between the read and the write
you don't allow it, you don't allow the engine a zval_ptr_ptr
22:08
huh?
it calls the handler instead, you can stop such writes occuring in that way ...
you mean if someone changes a reference ?
no,
$_SESSION['foo'] = $_SESSION['foo'] + 1
assuming the write op triggers the w-lock, the read operation happens more than 1 cycle before the write op
write_property(read_property()+1) is called ??
hence there's a possible race-condition
right right ...
22:10
especially if you do something more computationally intensive
or requiring a DB lookup, etc
okay so it couldn't be the default implementation ...
apc atomics suffer the same ...
the current locking behavior is the only safe one. You can build a better system, but you need constraints that need to be enforced at the app level (the engine couldn't enfoce it)
you can only be so atomic without explciit lock / unlock instruction ...
user895378
Local storage + websockets = problem solved. Sessions are a hack in the first place: HTTP has no business diddling about with state.
part of me wants to retire my twitter account now :-P
@ircmaxell, New Jersey, USA
Pushing the boundaries of Programming and Web Application Security.
10k tweets, 3.9k followers, following 339 users
9999 tweets :-P
22:12
so we can either have some locks and expose them and would be targetting some distant version, or we have to have the current paranoid locking ... but we cannot in our right mind do anything that involves not having any locking at all ...
Well, but changing the existing behavior is dumb if you ask me
I wouldn't be bothering, there are better ways to manage such things already, nobody is really using the file based sessions unless they are crazy anyway ...
user895378
^^ It's a non-issue for that reason.
How would I copy the values of a column in one table to another column that resides in a difference table?
You still work a lot with Drupal @ircmaxell?
22:17
Looked all over SO, no answer did it for me
Both have a column named week
Need to copy the values from column "week" of table "schedule" to column "week" of table "scores"
@ircmaxell @JoeWatkins @rdlowrey tell him
@JoeWatkins yay! i am crazy \o/
@Gordon file locking is famously slow is the reason for my dislike of it ...
@JoeWatkins ramdisk all the things
well its not really about i/o, it's just not a very clever kind of synchronization, any more ....
user895378
22:23
And it wasn't made with lots of simultaneous accesses and ajax in mind ...
Joe, you okay with everything for tomorrow?
@rdlowrey neither was i
hehe
@Fabien yep, all set ...
@rdlowrey github is back up… and I now… after having read that… I wish it weren't…
Cool. The door requires a key card btw. You'll have to buzz, I can't remember which button but I think it's "works unit"
22:28
cool, I have many numbers, not afraid to use them either ... (read: expect phonecall)
Stupid question. But he knows your in Manchester right? :p
I'm in Kent
he knows that ... :)
user895378
@bwoebi I hope it's not as bad as I expect ... though it might be. Time to find out.
it's about 100 miles ... so 200 miles twice a week ...
fun ... I guess ...
You'd be coming down twice a week?
22:29
yeah, think so
@rdlowrey example which makes me wanting to cry: Psr\Http\StreamFactoryInterface
That must only be for the initial phase. Peter is in London most of the time.
user895378
@bwoebi StreamFactoryInterface ...
Peter likes to skype.
@rdlowrey or MessageFactoryInterface …
user895378
22:30
If you have "Interface" and "Factory" in the same name you're doing it wrong.
@rdlowrey that's my problem.
Wtf?!? HasHeadersInterface ?!?
I like skype too, I like skype text conversations better than phone ones ... don't like the phone ...
StreamFactoryInterfaceDecoratorStrategy ... now it's fully buzzword compliant
I think they are fundamentally, quite rude ...
@Orangepill niiiice!
22:34
Names are getting long though... should probably make a facade to simplify the api
> "If I walk into a room and say SPEAK TO ME SPEAK TO ME SPEAK TO ME, we would say that is rude" ... Stephen Fry
couldn't have said it better myself :)
No offices in London I guess. Still... At least you'll have a parking spot here.
Yeah I'm not a phone fan either
@rdlowrey if you have Interface in any name you are doing it wrong :P
$ git diff --shortstat
 35 files changed, 220 insertions(+), 414 deletions(-)
user895378
@Gordon Totally agree with that too.
22:36
Ah, the satisfaction of deleting more than I insert... such a wonderful feeling.
Greetings! I have very simple question: I need to get any string contains (a-zA-Z0-9_) between "." and ")" using reg exp in PHP. I can do everyone separately but I need to combine them. Sample string: $str = "class._filter1({x:1, b:2});
user895378
Well, @bwoebi I'm going to start commenting on the actual commit everywhere I have problems (HTTP protocol-wise).
@rdlowrey Actually, I use Factory in names all the time. I don't feel the same way about it as I do about Interface.
First pattern: /\.(.*?)(/
@Gordon No idea… I never write or use interfaces except the built-in ones… But that a) doesn't need a PSR and b) is the PSR not really fine…
22:37
Second pattern: /[A-Za-z0-9_]+$/
user895378
@LeviMorrison Right, but you don't create interfaces for your factory to implement like MessageFactoryInterface ... I know you don't :)
user895378
That's just idiotic
@rdlowrey that's the wrong commit?
@bwoebi I dont know many people who would openly admit to not using interfaces ;)
@DaveRandom close against what / for what reason?
user895378
22:38
@bwoebi Then where's the link? Can you paste it so we're on the same page
@rdlowrey Why is it idiotic?
@Fabien nope
user895378
@DaveRandom Because a factory is an implementation detail. It's not an interface.
^ still needs some DVs before Delvs can be casted.
22:39
@hakre Well the question is generally horrifyingly awful, but luckily I found a dupe so there's a legitimate reason
@Gordon Why? Is there a problem with that? Interfaces mostly are just a shiny OOP feature which looks nicely, but mostly isn't necessary.
user895378
You shouldn't say "your factory that builds your actual object must follow this interface" ... that's just pointless.
@DaveRandom you left a comment/CV there? I didn't see any so I was asking.
@bwoebi sure, if you dont care for loose coupling and contracts you dont need them
22:40
@DaveRandom ah okay, that looks better :D voted.
@Gordon I said mostly. I didn't say always.
@Gordon because at least 50% of the interfaces which exist out there are just superfluous. (I cannot prove that, but I'm sure that this is the case…)
@bwoebi people using interfaces wrong is not a justification for saying interfaces are mostly unneeded
Just as superfluous like the MessageFactoryInterface
@rdlowrey What if I have a thing that needs to make things? (not great but only one I can think of off the top of my head) example being extending PDOStatement - setting the class name sucks, I'd rather inject a factory, but the factory should probably follow an interface
user895378
@DaveRandom I think it's crazy to establish an interface for the factory, personally.
22:43
@Gordon Also sometimes people attach an interface to every class they have … and then 90% of the interfaces are unneeded.
user895378
Is there really a universal concept of "PDO Factoryness"?
1 message moved to bin
user895378
Just say "extend this class api"
@rdlowrey ?
user895378
And especially don't create a PSR standard to enforce it.
22:44
@rdlowrey ^ that.
@rdlowrey Well no, and the valid use cases are few and far between, but there are instances where you may have to make a thing defined by the consumer, and for me the only sane way to do that would be a factory with an interface
user895378
@bwoebi I was saying that in regard to @DaveRandom's point.
user895378
I don't know there's no right answer I guess ... but I feel strongly that defining an interface for a factory flies far past the line of over-engineering.
user895378
That's not the kind of thing you can make a PSR out of certainly.
user895378
22:46
Re: why PSR causes harm and isn't all rainbows and unicorns.
Is there any good (library) way to let users customize searches against a MySQL database? (i.e. "developer -ruby" is transformed into customers LIKE '%developer%' AND customers NOT LIKE '%ruby%')
Or do we just have to roll that ourselves?
Btw. @Gordon: mostly I just assume that a class has that API without defining an interface. I usually don't use typehints (except when using Auyrn *hust*).
@rdlowrey Got anything prepped for BC Break Thursday?
user895378
@LeviMorrison Wow is it that time already? Uh, I should be able to push up all the arya things with the "finished" ext/session replacement.
user895378
How about you?
22:51
@LeviMorrison well… only 9 mins left … in MEZ^^
@rdlowrey Yep:
$ git diff --shortstat
 35 files changed, 238 insertions(+), 417 deletions(-)
user895378
Nice.
@rdlowrey you mean lazy loading? true… but I'd rather recommend to just reject the whole PSR :-D
user895378
Well obviously, but I'm sure they'll push the thing through
22:54
@rdlowrey Problem detected.
Any thoughts on allowing better searching?
@LeviMorrison If array is every also Traversable, and you make 5.5 a requirement for Ardent, the world will be a far better place ;-)
Mostly the first part, cause a 5.4 dependency is fine.
Well, I might make 5.5 a requirement anyway.
Yea, I can see generators being quite the boon for it.
I wrote some fiendishly difficult iterator code that almost certainly would be simpler in a generator.
I don't think array will ever be Traversable; sadly.
23:07
@LeviMorrison I just think we need a strategy and a steamroller.
It doesn't need to be an object, it merely has to pass parameter type-checking and instanceof expressions.
That and array occurring as a type-hint would need to alias Traversable as a kludge to make the integration less painful for userland.
*shrug*, either way kudos on your lib.
@DanLugg because arrays are only traversable and nothing more ...
@NikiC Right...? (sarcasm?)
@DanLugg Yes, sarcasm
You know, $array[42] vs $traversable[42] ;)
Well, they could respond to ArrayAccess and Countable too.
ah, so now array is Traversable+ArrayAccess+Countable
could. I haven't considered the necessity of the latter two.
I've personally type-hinted ArrayAccess zero times; Countable, probably also zero.
@JoeWatkins "if you want to just record the number of
pages a user has viewed since they logged in" "you either need locking, or an atomic write operation", yeah or an atomic [increment operator](http://redis.io/commands/INCR)
Fuckdamn. Why does it all have to be such a mess?
"if you hold no lock at all, and someone writes while you are reading, what do you think will happen ..." The same thing that would happen if I:
i) Opened a lock on the session
ii) Read the data
iii )Did stuff.
iv) Released the lock.
@DanLugg :D
@DanLugg Because things are rarely as simple as they might seem at first glance ^^
23:16
The session data wouldn't change if you only read it once from where it's stored, and similarly if you open the session data with a lock, and then close that lock without changing the data.
The only reasonably nice way would be to make array an actual object implementing those interfaces. But - ...
@NikiC I never said they were simple ;-) I was merely proposing something that would likely reduce the complexity of such an implementation.
@NikiC PHP Parse error: syntax error, unexpected 'reasonable'
@rdlowrey You're probably wrong there. When you're passing a factory to another class as a dependency then it's absolutely correct for the behaviour of that factory object to be defined by an interface. Putting 'interface' in the name of any object is still stupid though.
@Danack which again is not possible for a generic session store implementation
user895378
@Danack I disagree. It's not a "right" or "wrong" argument but I think doing so is emblematic of overengineering.
user895378
23:22
If I see code with SomethingFactoryInterface I'm running for the hills.
@ircmaxell Yes - which is why I think using a generic session store is a bad idea, as there are far too many things that need to be decided at the application level.
s/good/bad ......
I think PHP has literally produced in me, psychological manifestations of depression, impatience, and ennui.
user895378
@Danack My problem with expanding the feature set to allow that is it's only needed for file session (which no one should be using anyway).
user895378
You can already implement your own session handler that acts how you want it to.
bad idea, sure. But what PHP ships with is a generic store, which is good for about 99.99% of cases
23:26
@rdlowrey i don't think just changing the session handler is still not powerful enough, as there are decisions to be made about locking at the app level. Also, there have been previous discussions about changing PHP's session handler to allow 'things' to happen when the user changes IP address e.g. either forcing re-authentication, doing nothing which also need to be decided at app level - can't really be done just through setting some ini settings.
@ircmaxell Again - yes. PHP's current session handler is good enough for most cases. But for people who need to be able to process multiple simultaneous requests without locking, or banking applications that need to be able to define security requirements about what happens when users change IP address or useragent, then replacing the built in session handler with a userland version is a better idea than trying to shimmy in even more config settings.
@rdlowrey I don't put Interface in my factory objects names.
Holy crap!
user895378
If I've ever done anything to help you (or if you are just generally intelligent) please upvote this: reddit.com/r/PHP/comments/1uqs7a/psr_for_http_messages_predraft/…
PHPPHP is only twiuce as slow as native PHP on my one benchmark when run under HHVM
user895378
@ircmaxell nice :)
(that's over 10 times faster than under normal PHP)
user895378
23:31
@Danack I don't see why that's necessary when you can easily set a flag in redis for your session (for example) to manually implement a lock as needed.
$ php benchmark.php
float(0.00013899803161621)
$ hhvm benchmark.php
float(9.0837478637695E-5)
$ hhvm php.php benchmark.php
float(0.049592971801758)
$ php php.php benchmark.php
float(0.15264892578125)
or perhaps not...
$start = microtime(true);
$foo = 1;
for ($i = 0; $i < 1000; $i++) {
    $foo = 1;
}
$end = microtime(true);
var_dump($end - $start);
well, not twice
@rdlowrey Do mean you don't see why completely lockless access to session would be required, or why lockless updates to session data would be required? (or just wtf Danack?)
Stupid question, but if I am already running a foreach loop to browse the contents of an array (the contents of this array were fetched from the DB before the foreach loop) and I need to get some more values from the DB for use within the loop, should I just retrieve them from the DB each time the loop runs or should I load all the values in an array (similar to the other array) and then just browse its contents from within the loop?
user924016
23:56
gn

« first day (1180 days earlier)      last day (3994 days later) »