« first day (1398 days earlier)      last day (3775 days later) » 

15:00
@ircmaxell how can a PHP written compiler can outperform php?
I don't get it?
if you compile it?
Perhaps what it generates outperforms PHP?
well if you write it in assembler
it can totally outperform php
You don't simply write things in assembler.
Well I have in the past
it just takes time
me too .. using the 21H interrupts was awesome =D
15:03
:D
right on
The only assembler I ever wrote was to overwrite every file on the hard drive with a blank txt file
Oh, and a menu system at uni
ah yeah, I did elevator
and traffic lights
for uni
Elevator as well, but we didn't write it in assembler heh
I enjoyed it actually
but not much code, like 2000 lines but most of the things were separated in subroutines
well we had this simulator where you even had outputs and input switches for the chip that runs the assembly itself
15:05
we used the keil c51 compiler :)
haha we used c70 I think
our uni network was still strung together with bnc, so that allowed some interesting networking experiments :D
good times
alright guys! dinner time! later :)
yep
me too
@Jack see ya, sorry for leaving you
but I gotta run
run!
15:09
@PeeHaa :P
Imagine you are building a CompositeValidator, that is, it's a validator object comprising of multiple other validators that you can add / remove at will to provide specific validation to another object. How do you build / DI this into your objects that require validation? I'm guessing factory pattern that builds dependant on some parameters that you pass to it from the class being validated (abstract factory perhaps)...
Each object that requires validation is going to have different requirements and it wouldn't be feasible to build all these in the bootstrap separately first
I'm thinking abstract factory that states each of the factories for each different type of object requiring validation are built in a certain way. Anyone? :-)
@Jimbo something like github.com/symfony/Validator ?
@Patrick Yeah, almost exactly like that (haven't seen that before. Except it's going to be my own, very simple implementation
@Jimbo Sounds to me more like you want named filters
@Jimbo if you create a better one that is using SOLID code, ping me asap :)
15:17
$validatorFactory->create('filter_1', 'filter_2', 'dave_the_filter' /*, ...$filters */);
more like a builder than a factory imo
^ this is true
@DaveRandom My current response validator does: checks status is not 404, checks body is json, check exception key doesn't exist, checks certain keys exist and on each key that doesn't exist throws an exception
It needs refactoring and I was thinking this
@DaveRandom I wasn't wanting named filters though, each usable filter would be an object that returns a bool defined by it's interface to say whether or not it passed validation
Or maybe throws an exception or something
Better for IDE debugging anyway
$validatorComposite->create(
    new MyCustomValidator,
    new StringLengthValidator /** etc **/
);
$validatorComposite->validate($thing);
@Jimbo Looks to me like callables would be a lot simpler...
Verbosity looks good to me there though
15:21
idk, kind of smells of objects for the sake of objects to me
I'd rather have objects in the oo code I'm working with that non-oo code though :P
But like I was saying, I'd need something like an abstract factory / builder / something to have an individual validatorComposite for each object requiring validation...
(as they'd have different validation objects in that create method)
They pay you to overthink it? :P
@webarto I enjoy this thought provoking stuff :-)
is anybody using brackets here? (or any other code editor with code highlighting support)
@Jimbo This is a very rough skeleton of what I would do pastebin.com/rZWAgtQz
@AwalGarg <[({no})]>
15:30
@DaveRandom the code editor, I meant. Brackets IDE by Adobe.
Seriously, what kind of question is that? nm
Well, also no
not me, anyway
@AwalGarg No. Nobody. Never.
I missed his question, ohhh, tiny person
I actually lol'd
15:31
@ircmaxell LOL
//well, I was using heredoc as below
$pageContent = <<< EOPAGE
    <!DOCTYPE html>
    <html>
    //some stuff
    </html> //but there is no code highlighting here for the html
EOPAGE;
//*************************but
$pageContent = <<< EOPAGE
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html>
    //some stuff
    </html> //magically, here is code highlighting for html
EOPAGE;
The loss of Arrested Development is one of the saddest losses television has ever experienced
Woah, PHP dropped windows support! \o/ windows.php.net
that makes me a happy PHPster
why is that so?
(yes, it's the same line, but I think the tag name is funnier)
@ircmaxell Sometimes the best defense is a defense_exists()
@DaveRandom foreach (func_get_args( ... WUT
What's wrong with that?
15:37
Fuck variadics until we have variadics ;-)
@DaveRandom Would you say then that a ValidationSet is a newable?
@ircmaxell hahahaha
also, does that happen in other code editors too?
You know, the "screw DI and new all the things" object?
@ircmaxell Also that project as well as the fork / successor should die
15:39
@DaveRandom Apart from that, I like it. It was the sort of thing I was thinking... except the builder takes in named validators. I guess I could then put these validators in a config file?
@Jimbo newable/injectable is most easily described as transients/services. The ValidationSet isn't really a service, it's an aggregate of ValidationObjects, so I'd say it's newable.
;'( nobody uses code editors here...
Fine. @DanLugg Here comes my ValidationSetFactory
@Jimbo Well, you don't need one of those; you may not even need an interface.
It's really just a typed collection, no?
Yeah, I still build them as Set objects, implementing iterator arrayaccess etc
15:42
Well, Set, List, Foreachability, whatever. I doubt you'd need a factory for that.
The unfortunate fact that we don't have generic checkable collection types stinks, but it doesn't necessarily require that you interface all the variant types, moreover, that you factory all of them either.
@Jimbo Why not? You can always add a factory if you like, and you could always make the builder signature take an array instead of a variadic if you prefer
@Jimbo tbh you could turn it around the other way. Have classes that are hard-coded to use certain filters/validators, and then make different versions of those classes, and just inject the appropriate single class, rather than trying to make the individual validators be injectable.
e.g. SignupFormWithEmailValidator vs SignupFormNoValidation
If the collection were doing something worth writing an interface for, then it may also be worthwhile writing a factory for, to simplify the building of various implementations with type safety
> (17:36:03) RP: i think they need a test to test their tests for testing tests
15:48
lol
@webarto TestTestingTest::testTheTests()
What's the difference between E_STRICT and E_DEPRECATED?
@ircmaxell Man that is going into the commit when I find it!
Slightly wrong vs. slightly old. Nevermind.
> E_STRICT: Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.
15:52
@LeviMorrison STRICT is things that aren't recommended, but may or may not be removed later. DEPRECATED is things that will be removed later, and this is your last chance...
> E_DEPRECATED: Run-time notices. Enable this to receive warnings about code that will not work in future versions.
@Jimbo The named thing just makes it easier to deal with. You could have a config file with names to static class members or something, personally I'd probably just have a big file full of closures though, it depends exactly what's required. It would be easy enough to refactor it so that the "registry" holds objects instead of callables and the set calls whatever method on them, it's just that to me this seems like an over complication.
The point is more that by having the things named it's easy to see which filters any given consumer uses
So if in PHP "7" we remove a feature, theoretically in PHP 5.7 we could add a warning for that feature, and the correct warning would be E_DEPRECATED. Correct?
^ I would say so
@DaveRandom Well, the names will be the same names as the class though. "StringLengthValidator" would be the filter name, and also the name of the object
15:55
Let's say we remove a feature in PHP "7" that currently issues E_STRICT. In PHP 5.7 should we move that to E_DEPRECATED?
@LeviMorrison yup
@LeviMorrison yeah, that's good
E_STRICT could also be for undefined behavior, that "hey, this works now, but it's not specified, so don't count on it", even if there is no plan to change the behavior later...
@Jimbo Filter effect and implementation should be distinct, but name is arbitrary string so whatever. I'd rather have string_length or something as the name of the filter though
Finally! #PHP is dropping Windows support! http://windows.php.net/ \o/
Why is it down? Running on Windows?
16:03
ddos
posted on August 14, 2014 by kbironneau

/* by max */

@ircmaxell Really? Well if there's need for another host, khmm, khmm...
user2286243
Is it possible to check through code if PHP IMAP extension is build with SSL support or not?
@ircmaxell just put a cloudflare there in between…
@philsturgeon I summon thee
16:18
*poof* *atmospheric stars and dust*
/me farts
Needs that magical gif.
Dear Room 11,
I have updated the RFC for multiple default statements in a switch block (https://wiki.php.net/rfc/switch.default.multiple). Please review and provide feedback.
3
@JoeWatkins Deliver him through the aether, like a Phoenix rising from Arizona.
user924016
@LeviMorrison very readable, much reasonable
user924016
16:24
nice php handle btw (le vim)
Losing my mind over this, probably making a very stupid mistake, but can anybody make sense of this? pastebin.com/a1wTfiAs
how can two identical floats be different? :/
Displayed precision vs internal precision
Oh. Sounds complicated. :) It does only happen on my server though and not locally so it must be something quite tricky.
It's not uncommon to do if (abs($a - $b) < .001) // they are 'equal' enough
Would that be a recommended solution for my use case?
16:33
Maybe.
@LouisBataillard What do the values actually represent?
What should I do if I just want to compare two values, let's say $some->method() and $someVar, and I don't know what type to expect? It's always a unit of money though. I just thought adding floatval() would help... :)
DaveRandom: Money
@LouisBataillard Then stop using floats
Use a money pattern lib, or at worst use bcmath
Didn't @Lusitanian write a money pattern lib?
@LouisBataillard floating point numbers are never suitable for representing money. Like, ever.
user924016
@LouisBataillard have you var_dumped the values before they are go trough both floatval and sprintf ?
@DaveRandom Unless it is homework for a class.
user924016
16:37
your formatting the string
Situation is this. I'm trying to fix some code that is provided by an external developer. Locally it works fine, but on the server it thinks that "18.9 < 18.9". I don't/can't change too much in the code. I just want to make the comparison work reliably. No single-line solution I assume though... :S
user924016
just try and dump the values before the sprintf
user924016
=]
user924016
and before floatval, it is a super fast test, no harm can come from that
do you mean as a solution? or to see what the actual values are?
user924016
16:39
just to see what the actual values are
@LouisBataillard bccomp((string)$a, (string)$b, 4)
It's pretty horrible but if data is already float and there's nothing you can do it's better than nothing
I think sturgeon might be too busy for me ...
(where 4 is number of d.p.s you care about)
wimp ...
Thanks Dave!
16:41
@JoeWatkins What do you want from him?
Aside from sweet, sweet lovin', obviously
public talking head thing ...
@LouisBataillard np - try and work towards replacing every part of the codebase that handles money with something that is actually suited to handling money though, or you will get properly bitten eventually
@JoeWatkins What for this time?
I said we'd work together on an rfc and I found something maybe ... he's good at the public talking head and this is unicode, so much talking to be done ...
not something we can throw together in a day, something he'll have to research and think about, but I have go ahead from clued up people that I'm on a useful track ... so I want him to help ...
I haven't forgotten that I have @LeviMorrison's to patch up still and am slowly getting back into being able to throw together lots of code in short times, so it's coming, (sorry Levi)
:) No worry. I'd like to get working on it but I have other RFCs too.
@JoeWatkins auroraeos might be amenable to doing some public facing stuffz, she's got quite a decent level of public respect, doesn't seem to shy away from the general public and it looks like she already has a reasonable understanding of the problem
16:47
she's the one pushing the idea forward, I'm sure she'll have to be involved too, this is not something I know all about ... but I do want phil to be involved if he's got time, if nothing else he should work for his voting rights !!
he's coming tomorrow, he got a job offer so he's understandably busy today ...
Liz offered to help with coding and implementation too ...
maybe in 5 years the background unicode noise will disperse ... we can dream ...
stupid human body is wimping out for the second time today ...
must bail :(
17:43
Seems like a slow day for every chat channel/room I'm in.
it is a slow day :|
Earlier we thought it was a fast day but no it was just marketing linking an image in a newsletter that in reality is a poorly-coded bit of PHP from a decade ago causing server load, not actual customer traffic...
@mabe.berlin sure thing
> I don't have any clear overview on the topic right now: the entire ResourceManager logic is a bit obscure to me.
:) It's called manager with reason
17:54
@PeeHaa pls
@Ocramius I currently don't have a ggod idea how to solve that or on which level it should be solved.
so right now a new resource manager is built for every config?
any idea where that is happening?
Should it be done in *ResourceManager means adding a static variable which is a bad idea I think but fixing it in a factory needs some special checks which should the factory not know about
no, the static var is no-go for sure
so right now a new resource manager is built for every config? -> yes
it's because the *Options class are instantiating a new resource manager automatically if no one was set explicitly
17:58
aha
call path: ServiceFactory -> StorageFactory::factory() -> new adapter -> new options -> new ResourceManager
can we know what resource manager will be needed in the StorageFactory?
Hey guys I need help. I want to call page example.com/script.php from my script.
I need about script.php to write some stuff in db.
How to call that page?
I was trying curl
even file_get_content if is it working like I will load it and I will execute it
we can, bat only because we know the adapters build-in - external adapters are unknown - so this is a now go for the adapter pattern
curl_exec exactly
$ch = curl_init($url);
$result = curl_exec($ch);
curl_close($ch);
return $result;
18:03
What is the question?
1 message moved to bin
@mabe.berlin yeah... wondering if resource managers could be shared into a registry that is local to the app
Let me rephrase: what's the problem?
I said mine if it was for me...
@mabe.berlin we can pass that registry down from the factory to the options, and the registry is a shared service
@Ocramius you means adding a new complexity level to outline the static var into a static class?
@Ocramius Isn't it possible by the service factory to hold instances of the resource managers and let the instances be referenced by configuration?
something like:
array(
'Zend\Cache\Starage\Adapter\RedisRecourceManager' => array(
'redis1' => array('server' => 'redis1')
),

'caches' => array(
'users' => array(
'adapter' => array(
'name' => 'redis',
'options' => array(
'resource_manager' => 'Zend\Cache\Starage\Adapter\RedisRecourceManager',
'resource_id' => 'redis1',
),
),
),
'articles' => array(
'adapter' => array(
'name' => 'redis',
'options' => array(
'resource_manager' => 'Zend\Cache\Starage\Adapter\RedisRecourceManager',
'resource_id' => 'redis2',
),
),
18:14
@mabe.berlin Could you please use pastebin for code more than a couple of lines
@PeeHaa sorry yes
If your site is e2.example.com/script.php
Ok, I will make a question here...
@mabe.berlin no worries :)
@mabe.berlin no static classes
@mabe.berlin the registry would be only an instance stored within the service manager. The resource managers get added/pulled from it eventually
I just don't want yet another CacheBlaBlaPluginManager
18:26
@Ocramius than the service manager needs to be passed down into the options class
not the service manager, just this registry
public function createService(ServiceLocatorInterface $sl) {
    $config = $sl->get('blablaConfig');
    return StorageFactory::create(ArrayUtils::merge(
        ['managerRegistry' => $sl->get('ManagerRegistry')],
        $config
    ));
}
@mabe.berlin ^ something like this, with ManagerRegistry being just a dumb map of what already exists
@ircmaxell How's it look now? wiki.php.net/rfc/switch.default.multiple
Any more complaints or suggestions?
@LeviMorrison short, simple, to the point
perhaps break out the "proposed changes" into an unordered list, instead of a sentance
PHP 5.7: Raise E_DEPRECATED error if multiple default blocks are found
PHP 7.0: Raise E_COMPILE_ERROR error if multiple default blocks are found
@Ocramius I don't see the difference as on pass the resource manager instance directly
18:33
@mabe.berlin wasn't the problem that a new resource manager gets built every time, and that we don't know which one we need? (different storage types)
@Ocramius it would require the knowledge of option keys of the adapters itself
@Ocramius I currently think about passing the service manager as optional third argument to the factory and the method "setOptions" method. it would be your way but let the adapter itself instantiate the the resource manager using the service
does the resourcemanager have an identifiable name? Is that name hashed from the options?
@LeviMorrison BTW, is the stuff in there about 5.7 because there's going to be a 5.7, or just in case there's a 5.7?
@Ocramius it would be the class name
only that? D:
18:40
Wow, are people still so strung up about the PHP 6 thing that that version number's off limits for good?
or what you like - it's up to the user
where exactly does it get instantiated, @mabe.berlin?
@GordonM There was a (poorly-run but mostly legit) RFC vote and everything.
18:42
Does anyone know of a custom function for manually filtering and sanitizing superglobals (eg $_GET $_POST $_COOKIE) in PHP? I've seen one before but have forgetten about it and now I cannot seem to find one... I'm aware of the filter_ functions but I'd like to do this manually.
We'll never get PHP 6.6.6 now :(
4
I truly appreciate any help I get on this.
@W3Geek Are you saying filter_foo isn't manual?
@mabe.berlin need to think about about it, but I think we're on the right track if we have a small registry of resource managers
Morning
and yay for shiny silver badge
18:43
@Ocramius Or do you have an idea how to move the resourcer manager stuff completely into the service manager for zf3
@Charles it isn't a manual way of filtering throughout superglobals.
@GordonM all versions of PHP are 666
@mabe.berlin moving it completely to the service manager is easy: converting all them in factories and moving them into a custom plugin manager does that. It just is a slight BC break
can probably even be done in 2.x
@Leri GreetingFactoryManager::getInstance()->createGreeting("G'mornin'");
I found something once where somebody was using a foreach loop to cycle throughout the superglobals.
18:44
@W3Geek Can you explain what you're trying to filter?
I mean, what content.
@Ocramius the resource manager also handles changed AFTER instantiating it
ah, didn't know that :|
@Charles just user data that has is contained in the superglobals. I want to filter through it, validate it, and make sure it is safe.
tbh, I still have no idea about what they are and what they do, as my only entry point for the caches was the StorageFactory so far
never digged further
@Charles I'm aware filter_foo would be the easiest.
18:46
@W3Geek You need to do this on an input-type-by-input-type basis. There is no magic wand you can wave over all user data and say "you are now to be made safe"
@Ocramius that's the only think preventing me from running insert-super-secret-project-name-here on HHVM...
Hahaha I know! :D @Charles Damn I wish I could come across this function I once looked at that did all of this manually. Sure it was quite long but I don't know if there was something similar or not. I guess going over it input-by-input would be the only.
yeap. and he/she's been working on it for 2 months now..
and now this comment :\
@Charles Some of PHP's biggest fails on the past have been due to things that were supposed to be magic wands, like magic_quotes_gpc
18:48
@GordonM Exactly.
@Ocramius "Facebook has posted a $200 bounty on this issue." That's a high level of commitment from them there.
@GordonM Yeah it ends up being insecure and inefficient.
@Danack it's probably a 10k issue :\
PHP was a easy language to learn but digging into more advanced concepts such as security is not that easy.
It seems like PHP can be exploited worse than a sex doll.
wrong
18:53
Never ever trust a user or what he / she might do.
Let's put it this way: few month ago I decided to see if there are things I can learn from languages
@Danack I added $100
I picked Ruby as focus and watched a lecture on "advanced security" from one of the latest RubyCons
It was covering the new thing called "sql injections"
disappointment doesnt really cover it
Seen plenty of SQL code in Java that was just built up strings and totally exploitable too.
Then again Java's SQL interface is so awful that everyone just goes "fuck it" and just uses Hibernate instead.

« first day (1398 days earlier)      last day (3775 days later) »