« first day (1309 days earlier)      last day (3865 days later) » 

17:05
Oh noes! My TV remote has stopped working!
@PeeHaa Remember when you said to not use superglobals in classes? Imply you have a class where you handle storage (sessions/cookies), how can you set a new session without setting the value on the superglobal session array?
$foo = Something($_SERVER)
or
hey guys, is that possible to treat method as variable? I have a class and I want to use one method in another, but without calling it, just treating as variable
$cm = new CookieManager($_COOKIE)
@yonki What have you searched for in google?
17:07
.. or was it $_COOKIES , I can never remember
@BenBeri Sessions is the only thing that I access directly (in my dedicated session handler class)
All other things are immutable
I’m still searching, and didn’t find clear explanation
I see
@BenBeri Generally what you would do is have a session class, which is responsible for all access to the superglobal. It's obviously not possible to completely avoid the superglobals otherwise you would never be able to access the data, but for the read-only ones (basically everything except $_SESSION) you would inject them from the bootstrap (as shown by @tereško above ^^) and for $_SESSION, if you must use the built-in session handler (which you shouldn't) then wrap it in an object
@yonki how else you can use a method from a different class except by calling it ?
17:08
@tere
@tereško I can pass it to another function called in method
If you've already searched, I wont mock you with a 'let me google that for you" answer, however searching for "php function as variable" give the correct page of the manual as top result.
@yonki what the fuck are you talking about ?!?!
@tereško Closures, [$obj, 'method']
if you need some method to call a different method on an object, then you pass the fucking object
@DaveRandom no, I am quite sure he is talking LSB
"treat method as variable" == lsb?
17:11
ok, thanks, will no longer bother
@DaveRandom no, but he sucks at explaining himself
No argument there
@yonki , if you want to use PHP, then please learn PHP. Stop trying to pretend that it is Clojure with different syntax
@DaveRandom Well I have this storage object i am using for cookies&sessions: pastebin.com/yBBVWTVX
@BenBeri Personally I'd split that into two separate objects, they are two separate data stores
You wouldn't have one object that talks to two different SQL database, for example
17:17
Would it be bad to have a container for them, e.g Storage::getSession, Storage::getCookies ?
Yes
General rule of thumb: if you wrote :: that's probably bad code
No i didnt mean statics
That's like having a closet for your clothes and use the same closet for your horses :)
$this->session = $storage->getSession(); for example
17:19
Nope don't do that
Well it's probably bad because some services won't need to use Cookies or sessions, just one of them, so better to just pass one of hte objects
Exactly
pubtime, later all
Same here. Beer time
17:40
As much as fosters is piss. Their Radler lemon shandy thing is quite nice.
@tereško What's your thoughts on templating? If you've read the earlier conversation that is.
beer time
@PeeHaa I've switched from simple text editors to PHPStorm too. They each have a place.
Everyone's beer time it seems
@tereško Sorry I bothered you. I asked cause was trying to help a friend understanding some PHP code. I haven’t been using PHP last few years and wasn’t sure about PHP OO rules. I saw method initializing routing system basing on other methods within the same class. Instead of callbacks arrays were passed into routing methods provided by framework. It seemed weird to me, so I just wanted to know if PHP method can be treated and passed like variable. I hoped for simple answer: yes/no. Thank you
17:49
@yonki you can pass anonymous function as variables. You cannot pass object methods as variables.
@tereško You can.
@tereško Thank you very much.
If if(!!$bool) is the same as if ($bool), why do ppl use !! lol?
[$objectInstance, "methodName"] can be treated as a valid callable.
@BenBeri It converts the variable to boolean.
To force bool
17:50
Ah
same as if((bool) $var)
I see i see
Which is more readable imo ^
Agreed
@SecondRikudo that is kinda "thought the ass" approach
17:50
Aye. The not-not clause isn't seen much. Better to just declare the type.
@tereško Depends on the needs.
I don't get to do it very often either.
@SecondRikudo Thanks. I’m greatful. I didn’t want too use such syntax, but this is what I saw
here is thie thing: if you see router which also acts as dispatcher, then it is broken by design
What's a 'dispatcher'?
17:56
@RonniSkansing lol I received 18 notifications while I was working...
nm I got it.
> In a nutshell, a router dissects the HTTP request into it's constituent parts to figure out what the user is asking for. The dispatcher interprets that information and provides a response.
@HamZa My top's 23
dinner time
@SecondRikudo well those notifications were because there's another hamza in this room...
Yup
But there's no other Madara, so I double win :)
17:59
that's the point :P
18:15
Someone with 2000+ rep please remove personal text from this question (as per the site rules)
0
Q: php not taking into account by html

bluetieHullo :) I'm sorry if the title is not clear but I don't know how to ask this ( +, I'm not english native :/ ) So ! There, I'm trying to build a website with a php script that spit out a list of members. Everything works fine but the list is not taking into account by the html/css part. The th...

What do you guys think I need to improve in this pastebin.com/aUjMMqG4 ?
18:29
user924016
@HamZa sorry bout that
@RonniSkansing not your fault
@NikiC thx for some sanity in today's PHP-DEV list
yoo
is this the Hamza from my skype list :D?
yup
18:35
@NikiC very well said, and I don't disagree with any of it
as far as the ZPP changes, considering you're not passing the length directly (but instead as part of the zend_string struct), the concerns around segfaults are gone. So++
@NikiC well said, I'm fully okay with that.
@ircmaxell zpp is still mostly used with s, where you do pass the length directly
Though I hope we'll me moving that more and more toward S along the way :)
Well, in that case I'd make a point in the proposal to package and ship Johannes's static analyzer for use by everyone
we should at least run it once an all our exts ^^ and recommend ext authors to do the same
By the way… Is there any reason why we don't simply fetch zvals directly in PHP_FUNCTION() and just do the typecheck via zpp? Returning zvals is now a) very cheap and b) on undefined zvals we can just return IS_UNDEF.
18:40
Guys I got a tiny question: on my earlier php file I have $row['firstName'] (which shows a teacher's name). And when you click on update, then you go through the another page (update page). On this page I have a dropdownlist where you can select a teacher. But I want to show the selected teacher's name from the earlier page, that depends on which teacher I selected. I already had tried to use: $selectedOption = $_POST[$row['first_name']];
@NikiC Well, I just mean make it easy for ext authors to do it. Not necessarally package inline in php-src
But that doesn't work :p
I think Dmitry said that zpp is usually a major slowdown when looping quick functions.
it's a runtime state machine
@ircmaxell k
18:42
I think it may be cool to see if it could mostly be done compile-time
If I want to cache queried data between page requests, I assume sticking it in $_SESSION isn't the best approach?
@ircmaxell Well, in C++ we could ... :P
@NikiC yet another checkbox in favor of switching :-D
I was under the impression I wanted to use APC, but that doesn't seem to be the preferred approach, since I last checked.
@NikiC though, I'd like to see constexpr in C… I don't get why that doesn't exist there…
18:43
@bwoebi Because C is mostly a dead end :)
@NikiC only in Microsofts eyes maybe…
4 mins ago, by bwoebi
By the way… Is there any reason why we don't simply fetch zvals directly in PHP_FUNCTION() and just do the typecheck via zpp? Returning zvals is now a) very cheap and b) on undefined zvals we can just return IS_UNDEF.
^ @NikiC any idea why phpng can't do that?
@bwoebi I don't understand what you're saying there
@NikiC I'm asking about zend_parse_parameters() to only check the required args/types and accessing directly the passed zvals in the function. (Instead of that big slow thing we're having now)
I still don't get it...
code sample pls
what he means is instead of parsing to native types
just access the zval directly
18:49
^ yup
verify they are the right types (converting when necessary), and then just access directly
ah
I don't think that makes much of a diff perfwise
after all, that part is just writing into another memory location
what's then so slow there in the case where we don't need to convert the types?!
looping through that string to determined number of required args, handle variadics and stuff like that. I guess
generally there's quite a lot of logic in there
but I have no idea what exactly are the slow parts
@bwoebi profile it to see
did Zeev really just take a pot-shot at Pierre in your new email?
18:58
@NikiC can't that string be somehow pre-parsed to already figure out e.g. min arg number etc.?
@LeviMorrison not sure if that will be needed now, when Nikitas mail has success
@bwoebi success? Zeev took a shot in that very thread
@bwoebi Even if it isn't , it would be a good example of reinforcing success, rather than waiting for the next shitshow.
ThW
ThW
Hello
19:08
@Danack your answer to my mysql question was appreciated :)
@khaverim np....but you ought to get in the practice of reading the parse error messages better.
Also that UDF stuff is not at all related to your question - it's about defining functions in C code, and then binding them to MySQL through a DLL or similar.
@ircmaxell I know. I think it can only get better now.
good luck with that one
Well. I hope at least.
@ircmaxell How d'you mean?
19:11
@bwoebi Are you saying that as an optimist or pessimist?
I'm dropping it. I'll put it this way: I've seen Zeev enough to not have any faith in him at all (and same with Pierre)
profiler tells me that zend_parse_va_args is the function with most ran instructions after zend_mm_check_ptr
So I think lxr.php.net/xref/PHP_TRUNK/Zend/zend_API.c#836 is the very slow part here.
@bwoebi that sounds like you're profiling a debug build ;)
yes, I am.
damn. I ran a build in a directory named phpng-no-debug … and the build was a debug one, lol
19:15
@bwoebi I know that one ^^
If you have 20 directories with php builds, things can get confused at times...
12
Q: How To Slow Down A SQL Query?

David WAs strange as it sounds I need to slow down a SQL query. Currently I'm using Microsoft SQL Server 2008 R2 on an in-house development server with the AdventureWorks database. I'm in the process of testing some code and the queries that I'm running are too fast no matter what I try! Basically I'm ...

@NikiC pow(2, 32) + 1 < PHP_INT_MAX... so that is valid
@ircmaxell hm?
@ircmaxell ohhhh
I think I mixed up something there
yeah, just pointing out
19:23
or not
I don't think I understand the issue then
in PHP RFC: Return Type, 56 secs ago, by Levi Morrison
Here are some behaviors that are appropriate:
 - Asking members of the list to vote on an RFC
 - Politely disagreeing with someone's proposal
 - Leaving the voting window open longer than minimum

Here are some behaviors that are inappropriate:
 - Asking members of the list to vote in a particular way
 - Dominating a mailing list discussion
 - Engaging in a heated debate
Thoughts?
@NikiC you're limiting the number to signed 31 bit, right?
@ircmaxell to signed php-integer-type
currently it uses long
so signed 64 bit?
so after it would use zend_long_t or whatever we'll call it
@ircmaxell yep. llp64 notwithstanding of course
19:25
ah. then nevermind
19:44
:)
/var/root/phpng-no-debug/Zend/zend_hash.c:763:9: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
                if (h >=0 && h < ht->nNumUsed) {
                    ~ ^ ~
/var/root/phpng-no-debug/Zend/zend_hash.c:1220:9: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
                if (h >= 0 && h < ht->nNumUsed) {
                    ~ ^  ~
/var/root/phpng-no-debug/Zend/zend_hash.c:1241:9: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare]
^ @NikiC
@bwoebi I'm aware
Please fix them
I'm not having a clean phpng clone as of now
I fixed them in another branch, but discarded that branch later, so it never ended up in upstream ^^
120,999,879  ???:zend_do_fcall_common_helper_SPEC [./sapi/cli/php]
102,999,897  ???:zend_parse_va_args [./sapi/cli/php]
 80,999,919  ???:zend_parse_arg [./sapi/cli/php]
output of callgrind (3 first things)
for this script: $i=0; while (++$i<1e6) { chr(50); }
and it's this time not a debug-build :-)
20:35
Uncaught exception 'Auryn\InjectionException' with message 'No definition available while attempting to provision typeless non-concrete parameter cookies' Hmm
@BenBeri code?
$this->provider->defineParam($instance, [':userContainer' => $this->container]);
return $this->provider->make($instance);

It looks like it goes through the object $this->container, and check it's dependencies. I don't want to do that, I simply want him to place all $userContainer parameters with that object, why is it checking for it's dependencies?
$cookies is a parameter in one of the objects inside $this->container object
@BenBeri you're really sure?
@bwoebi Pretty sure
Also not defineParam, its define
Ill explain what I have in this 'container' object I am defining
Actually Ill just show how I initialize it
$userContainer = new UserContainer(
    new Request(
        $_SERVER['REQUEST_URI'],
        $_SERVER['REQUEST_METHOD'],
        $_GET,
        $_POST),
    new Storage(
        $_COOKIE,
        $_SESSION
    ),
    $_SERVER
);
And then it goes to this class (showing you just the constructor and the routing part, relevant now) pastebin.com/qpyDrTR6
20:53
and where is Auryn now invoked?
And finally in the method it's despatching, it calls this method pastebin.com/R7MR1Wr0
$router = new Router($route, new Provider, $this->user);
Oh invoked
Read above, the recent pastebin.
I nowhere see $this->container being set?
Sorry for the confusion, the recent pastebin method is located in the new Router class, it's constructor:
public function __construct(Route $route, Provider $provider, UserContainer $user)
and then $this->container = $user;
Just did var_dump on the userContainer object, shows correct data.
actually, where is cookies set?
pastebin.com/T1Egb9ct - Everything is starting there, as you see the userContainer is being set the first, along with the cookies, etc
Cookies are being set in the Storage object
For some reason, it doens't do that for other routes hmm.
Very weird imo, I'll debug it now.
21:11
no, where is the array key "cookies" set?
you maybe need $injector->share()?
21:37
hmm. That's interesting. My zvals are actually stored in xmm registers (when copying) with phpng @NikiC
That explains for one part why using the new zvals is so performant…
@bwoebi Sure
I always thought there wouldn't be any further optimizations after quadwords
I found the problem, and it's a big facepalm :P
@bwoebi And don't forget that avx introduced ymm registers as well ;)
just googled, yeah
And then presumable aamm registers.
@bwoebi The real question is what happens after zmm ;)
@NikiC %amm :-D
21:50
@bwoebi wrong notation.
@NikiC It's the notation I see with gcc -S
I know. That notation sucks.
why?
intel syntax ftw
meh.
21:53
more precisely: nasm syntax ftw ;)
nasm? That remembers me Windows?
s/remembers/reminds
In Auryn, does Provider::defineParam works with objects? or only values
Cause it' doesn't seem to function for me with objects.
@BenBeri both. prefix scalars with : I think
            $provider->defineParam('request', $this->request);
            $provider->defineParam('storage', $this->storage);
            $provider->defineParam('server', $this->server);
22:00
There is a lot of stuff in the readme
Tried both with : and without
Without the : it says No definition available while attempting to provision typeless non-concrete parameter url' - $url is the first parameter of 'request' object , and 'request' is the first parameter in the class I am making
You're just doing it wrong. You should be either be aliasing interfaces to class names for Auryn to construct, or you should be creating those instances and then sharing them via 'share'.
The readme is on the github page github.com/rdlowrey/auryn - you should read it.
But Share method shares the class, I need to define the actual object, as these 3 objects are already created, and are holding superglobal values.
In the readme, defineParam "Sometimes applications may reuse the same value everywhere." - Exactly how I need to use these 3 objects.
@BenBeri Seriously read the documentation:
...
$db = new PDO('mysql:host=localhost;dbname=mydb', 'user', 'pass');

$injector = new Auryn\Provider(new Auryn\ReflectionPool);
$injector->share($db);
It's even got a sub-title link directly to that bit Instance sharing
Yeah that worked for me, though these instances are now null everywhere.
Nevermind
Everything worked, thanks @Danack ^^
Night
22:26
@NikiC @bwoebi Do you guys think Zeev is being out of line? If so I would really appreciate it if you would say so.
On list.
grey zone I think.
I don't think so.
He keeps saying "8%" when there is evidence it is more like 4%
Secondly, initiating a mudfight is never appropriate.
Thirdly, this RFC requires 2/3 vote; it didn't have it when he started slinging mud and it most likely won't when the vote closes.
@NikiC actually, we get significant performance improvements if we can inline the parameter parsing. I got 20-30% performance gains (in a tight loop $i=0; while (++$i<1e6) { chr(50); }) when I write instructions to verify parameters and fetch them from stack directly in the function body.
The slowest parts are when we have to parse the string and to handle the va_list.
22:42
@NikiC I just have no idea how I could do that with macros (probably impossible).
As far as I know we can't really operate on __VA_ARGS__ in a #define.
the only thing one could try is something like PARAMS(1, 1, PARAM(zval, l)) (1, 1 are required and optional max parameters)
and then reserve current zend_parse_parameters for compilcated variadics…
You are trying to eliminate loop overhead for zpp, right bwoebi?
I'm just having some thoughts about it…
Sure, but that is what you are trying to accomplish?
Correct?
yes
PARAMS(TSRMLS_C, PARAM(zval1, l /* long */) PARAM_VARIADIC(zval_ptr, O /* object */) PARAM_OPTIONAL_SEPARATION() PARAM(zval2, s /* string */))
I could imagine something like that…
that'd then be comparisons compiler can eliminate for a big part…
I think I could try that… maybe let's hear what @NikiC thinks?
23:02

« first day (1309 days earlier)      last day (3865 days later) »