« first day (1682 days earlier)      last day (3266 days later) » 

4:00 AM
@Trowski use USE_ZEND_ALLOC=0 valgrind --leak-check=full ./sapi/cli/php your_script.php
 
@bwoebi well currently the only method i have of testing it is to tag a release and run composer update since it has so many dependencies. thought it couldn't hurt to ask here with all the "smart" people in the room.
 
anyway @r3wt hhvm is not just gold. it has problems as well
 
@r3wt why do you need a new tag? can't you just use a dev-branch in your composer.json?
 
@Worf no MultipleIterator support.
i just haven't learned that much yet. i've been coding < 2 years
i'm just barely using composer
 
@bwoebi Never used valgrind before. I'll have to install it.
 
4:04 AM
@r3wt That were nice times when a beginner didn't have to know about composer…
 
@bwoebi Boo, it complains because I'm on Yosemite.
 
@Trowski Unknown host, mach_msg… that?
 
Unsupported kernel version.
 
@Trowski what's valgrind --version?
 
@r3wt Their generators are a no-go for me.
 
4:09 AM
I was going to install valgrind, and doesn't get past configure because it complains the kernel version is unsupported.
 
@LeviMorrison What's wrong with then (I have no idea)
@Trowski from SVN?
 
@LeviMorrison that's way over my head so i won't perjure myself..
 
@bwoebi You have to call next().
(Like, on the first one)
 
urgs
 
It's like they forgot to match the iterator semantics.
 
4:11 AM
@bwoebi From valgrind.org
 
Few other odds and ends.
Nikita even gave them a patch: github.com/facebook/hhvm/pull/4915
 
They haven't applied it because Facebook can't migrate to it easily. Yes, that's the reason. And they claim it is open source…
I even clarified it with Paul Biss in IRC.
 
@LeviMorrison the issues with open source being run by a company… :x
 
(function () {
    "use strict";
    function factorial() {
        var jump = 0;
        goto_emulation:
        while (true) {
            switch (jump) {
                var var_n = arguments[arguments.i = arguments.i || 0];
                arguments.i++;
                zend_compare_function(cv_0, { type: 4, lval: 1 }, var_n);
                var cv_0 = { type: (result.lval < 0) ? 3 : 2 };
                case 2:
                // opcode ZEND_JMPZ wuz here
This JS is not pretty.
But, I'm making progress!
This is a really shitty compiler ^^
I'm basically just outputting equivalent JS for Zend Engine opcodes
Such JS is obviously not very efficient
 
4:26 AM
maybe you'll figure out how to optimize PHP by writing JS :-D
 
Oh sure.
In order to produce better JS, I need to do a lot of analysis on the code.
Infer the types.
 
And then next year PHP 8 with yet another 50% improvement :-D
 
heh
 
moin
 
you can do that, Andrea
xD
@JoeWatkins morning
@JoeWatkins How comes you're that busy all the time?
(well, bedtime.)
 
4:29 AM
my misses started to work full time, kids and real life are taking up all my time at the moment ...
 
funny that there are so many WAT functions in php, and you don't have stuff like lastIndexOf() which is standard in pretty much every high level language
 
@Worf define standard^^
 
@Worf It's because the standard library wasn't designed. It just grew piece by piece.
 
@Worf also, array_change_key_case is useful for normalizing e.g. headers in HTTP/1
@JoeWatkins oh, ok. I still have a few years until being full-time occupied with work and kids^^
 
@bwoebi it's nice, I enjoy the kids company a lot ... however, their schedule is so awkward, we are looking for a nanny/babysitter/carer to help us out during the week, so I should have some more free time in the next couple of months ... it's not easy to find nanny, because we live on an island that is 26 miles wide ...
 
4:34 AM
 
@bwoebi Thank you, installed now.
 
(function () {
    "use strict";
    function fun_factorial() {
        var jump = 0;
        goto_emulation:
        while (true) {
            switch (jump) {
                var var_n = arguments[arguments.i = arguments.i || 0];
                arguments.i++;
                zend_compare_function(cv_0, { type: 4, lval: 1 }, var_n);
                var cv_0 = { type: (result.lval < 0) ? 3 : 2 };
                case 2:
                if (zend_is_true(cv_0)) {
                    jump = 10;
                    continue goto_emulation;
More progress!
 
@Andrea Is there a specific reason you are using "use strict";?
 
what crazy thing are you doing @Andrea ?
 
@kaloncpu57 strict mode is best practice for JS
among other things: undefined variables are an error
Use it.
@JoeWatkins what does it look like? ;)
 
4:44 AM
I see that code, it looks like you're implementing zend in javascript, but that's crazy, so I thought I'd ask ?
 
@JoeWatkins Precisely.
 
I have been dealing with a lot of JavaScript since I started programming, and I have never seen it actually used before. d:
 
Compiling PHP to JavaScript the extremely lazy way: compile Zend Engine opcodes to equivalent JS
(then pipe the output through Closure compiler :D)
 
@bwoebi Some valgrind output for you: pastie.org/10205715
It would seem the GC is not deallocating some objects.
 
function zend_sub_function(result, op1, op2) {
    if (!((op1.type === 4 || op1.type === 5)
        && (op2.type === 5 || op2.type === 5))) {
        throw new Error("Can't handle non-IS_LONG/IS_DOUBLE op1 and op2");
    }

    var resval = ((op1.type === 4) ? op1.lval : op1.dval)
               - ((op2.type === 4) ? op2.lval : op2.dval);
    if (op1.type === IS_LONG && op2.type === IS_LONG && (diff | 0) === diff) {
        result.type = 4;
        result.lval = resval;
    } else {
        result.type = 5;
:3
God this is horrid code...
An observation: when I use PHP, I write worse code
(function () {
    "use strict";
    function fun_factorial() {
        var var_n = { type: 0 };
        var cv_0 = { type: 0 };
        var cv_1 = { type: 0 };
        var cv_2 = { type: 0 };
        var cv_3 = { type: 0 };
        var cv_4 = { type: 0 };
        var jump = 0;
        goto_emulation:
        while (true) {
            switch (jump) {
                var_n = arguments[arguments.i = arguments.i || 0];
                arguments.i++;
                zend_compare_function(cv_0, { type: 4, lval: 1 }, var_n);
 
5:11 AM
find someone you are afraid of or look up to and write code as if they will be reading it
2
 
@r3wt I'm scared of myself.
 
might i suggest purchasing a blindfold?
3
 
5:28 AM
// Why you shouldn't use isset() to check for key existence:
            // ensure there's a "case 0:" for the first opcode
            $jumpTargets[0] = NULL;
        }

        foreach ($oparray as $i => $opcode) {
            if (isset($jumpTargets[$i])) {
                $this->emitLine("case " . $i . ":");
            }
Spot the problem.
 
isset() will return false for $jumpTargets[0] :)
 
raises hand
 
@Trowski Yep
 
@Andrea what should be used instead
 
@r3wt array_key_exists, maybe? it's really verbose though
although you could do this:
use function \array_key_exists as hasKey;
:)
 
5:30 AM
how bout short circuiting like !== null && isset
 
then you'll get a notice if the key doesn't exist
 
perf of array_key_exists <=> isset ???
 
isset is probably faster but that's not important, really
 
oh, btw whatever happened with the spaceships?
 
premature optimisation is the root of all evil
@r3wt They got in!
 
5:32 AM
still coming in 7?
yay!
 
Spaceships... yawn
 
@Andrea i disagree. Wordpress is the root of all evil
 
oa-res-24-87:~ ajf$ ~/Projects/2014/PHP/php-src/sapi/cli/php -r 'use function \{ array_key_exists as keyExists };'

Parse error: syntax error, unexpected '{', expecting identifier (T_STRING) in Command line code on line 1
@marcio ^
@marcio this should work so you can import stuff from root namespace, right?
 
also use \{function array_key_exists as keyExists }; i believe
not sure if the syntax is supported
 
OK! ElePHPants Love Coffee can finally compile the whole file! - but it doesn't work (infinite loop! D:). If anyone spots the bug, they get a cookie. Goodnight.
2
 
5:53 AM
hi guys
can I do in function call as
function abc(trim($var)){
}
abc();
is that possible?
 
no
 
why not?
any reason?
 
in documentation of php it's allowed to do that @john
?
 
function signatures may not contain a function call.
 
@JavaFan Yes that is not mentioned in php documentation...
@r3wt In general also is that possible?
 
5:58 AM
Ah shit, it generated incorrect jumps
 
@Andrea go to sleep!
3
 
@John I don't know a lot about php, but always refer to API of the language, in java (OOP) it 's not allowed
 
you can call abc like abc( trim( $var ) ) sure, but you cannot have a function call in the function signature. --> 3v4l.org/8l8ud
 
Its giving an error "Parse error: syntax error, unexpected '(', expecting '&' or variable (T_VARIABLE)"
 
yeah, and you were just told why it gives that error.
 
6:02 AM
@Worf actually doing so now, goodnight everyone
 
:D gn!
 
@Andrea good night royalty
 
@r3wt Yeah!
 
@John stop trolling
 
@r3wt curiosity is the mother of invention dude.
 
6:11 AM
@John no, that's "necessity" :P
 
7:01 AM
MOOOOOOOOORRRRNNNINNGGGHHHRAAARRRRRGHHHH!
 
Anonymous
MOOOOOOOOORRRRNNNINNGGGHHHRAAARRRRRGHHHH!
 
7:22 AM
MOOOOOOOOORRRRNNNINNGGGHHHRAAARRRRRGHHHH!
 
@Ocramius monday?
 
NO, FUCKING AIRPORTSHGAAAAAAAHHHHH!
 
lol
i'm thinking to split functionality tests from exceptions testing :\ opinions? i'm getting sick of reading edge cases while testing normal functionality
especially unrecoverable stuff
 
7:53 AM
Mornings
 
yo
 
mornings
 
8:23 AM
Yay! for HHVM segfaulting with PHPUnit and GDB segfaulting with HHVM: paste.thephp.cc/pmwtduebf
 
posted on May 25, 2015 by kbironneau

/* by ivanalek */

 
Score one for reading comprehension. The compiled output of ElePHPants Love Coffee didn't work... why? ZEND_JMPZ does NOT jump when the condition is true. It jumps when the condition is NOT true!
It's in the name! Z. Zero.
AHA!!!!! IT WORKS!!!!!!!
Try running the JS!
@ircmaxell My awful hack worked. :/
It even supports integer-to-float overflow!
 
9:10 AM
yay
I see that JS is sorely lacking goto ^^
 
It doesn't need it. Relooper can convert goto into switch/if/while/etc as appropriate. I'm not using relooper yet though, because laziness.
 
Hey guys I'm having issue on sending emails via mandrill on server...
$mail = new PHPMailer;
        $mail->IsSMTP();                                      // Set mailer to use SMTP
        $mail->Host = 'smtp.mandrillapp.com';
        $mail->Port = 587;                                    // Set the SMTP port
        $mail->SMTPAuth = true;                               // Enable SMTP authentication
        $mail->Username = MANDRILL_USERNAME;                // SMTP username
        $mail->Password = MANDRILL_TOKEN;             // SMTP password
 
9:26 AM
use switfmailer instead
or disable tls and see what happens
 
oh god no
you can stack INIT_FCALL
;_;
 
@Andrea care to explain what you are doing? its kind of peaked my curiousity
or not, its cool. i understand you are busy
 
Yeah, i see that. but i'm from userland so i don't know much about PHP under the hood
 
The Zend Engine is the virtual machine at the heart of PHP (the normal interpreter, not HHVM)
 
9:31 AM
zend engine op codes to javascript? why? whats the purpose?
 
Its opcodes are the format it compiles PHP to before executing it
@r3wt Fun.
 
running out of challenges?
 
End game, though, maybe you could write PHP code and run it in the browser. Maybe.
 
@Andrea :)
 
@NikiC ;_;
 
9:36 AM
Do we have a list of all functions (of all extensions (that are documented in the PHP Manual)) somewhere?
 
@Andrea that emote looks like princess mononoke
 
there's an ebook that has an appendix listing every function in. think its called "programming php"
 
What does -> new
Mean*
 
@SebastianBergmann list of extensions: php.net/manual/en/extensions.php
 
either my computer has been hacked or my keyboard is severely fucked
 
9:39 AM
    function __main() {
        var cv_0 = { type: 0 };
        var cv_1 = { type: 0 };
        var cv_2 = { type: 0 };
        var fcallTargetStack = [];
        var fcallArgumentStack = [];
        fcallTargetStack.push(php_var_dump);
        fcallArgumentStack.push([]);
        fcallTargetStack.push(fun_factorial);
        fcallArgumentStack.push([]);
        fcallArgumentStack[fcallArgumentStack.length - 1].push({ type: 4, lval: 7 });
        cv_0 = fcallTargetStack.pop().apply(null, fcallArgumentStack.pop());
hope this works...
 
@SebastianBergmann list of functions: php.net/manual/en/indexes.functions.php
 
yep!!!
 
@Gordon Thanks, but I think I'll just parse svn.php.net/repository/phpdoc/en/trunk/reference**/*.xml for "<function name= ...
 
When is PHP7 coming out?
 
@BenjaminGruenbaum When it's ready :-)
 
9:40 AM
What does -> do?
 
@SebastianBergmann so no date?
 
@Gordon Aha! Now php.net/manual/en/indexes.functions.php is more useful. Thanks!
 
@SebastianBergmann that might include undocumented functions then
 
@IPAddress gets object property or calls method
 
Oh
Thanks
 
9:41 AM
@IPAddress it's like . in JavaScript, C#, Java or another object-oriented language
 
@BenjaminGruenbaum My guess is October/November.
 
when selecting text its like the right arrow is continuously being pushed. fucking weird
 
Oh, I remember you @SebastianBergmann we talked a few times here about PHPUnit iirc.
 
The reason it's not . in PHP is because that was already taken by string concatenation :)
 
9:41 AM
$ ~/Projects/2014/PHP/php-src/sapi/cli/php src/main.php ~/Projects/2014/PHP/php-src/sapi/phpdbg/phpdbg test.php > test.js
$ node test.js
int(5040)
float(1307674368000)
 
Let's say in JavaScript row.length
 
Just wondering, do you feel like there is a lot of community involvement in PHPUnit? That is, do you think it being open source and on GH brings in significant contributions?
 
But in php would be $row->any property
 
@IPAddress yes, that's what it does. There is a nice tutorial on php.net about it you should check it out.
 
$ ~/Projects/2014/PHP/php-src/sapi/cli/php test.php
int(5040)
int(1307674368000)
 
9:44 AM
I tried searching for the tutorial and it comes up with anything other than ->
 
there's a section on objects
 
So basically its the . in JavaScript
 
Thanks Andrea
 
It's similar.
 
9:45 AM
@BenjaminGruenbaum There is community involvement but it could be more.
 
@SebastianBergmann is it substantial? As in - do you think without it the library would be significantly less advanced?
 
Php has over 1000 functions
 
@BenjaminGruenbaum Hard to say. Depends on whether you only cound code as contribution.
 
@IPAddress yes, like in the C language.
 
So when programming you often use the php reference site
 
9:47 AM
@SebastianBergmann I certainly don't, if someone had a clever idea or opened a super detailed bug report that's a contribution IMO.
 
Correct? Or should you know most functions
 
@IPAddress generally I remember most of what I use - but when I need to: yes.
 
Cool
 
@IPAddress it's not about remembering everything, you just sort of pick it up as you go.
 
@BenjaminGruenbaum Then yes, PHPUnit would be siginificantly less advanced without the community.
 
9:48 AM
@SebastianBergmann thanks.
 
Thanks for your help everyone
 
note to self: always, turn off the wireless keyboard, especially if you are going to lay heavy objects such as a laptop on it
 
Does anybody know what twitter.com/wldgrlc is about? Looks like a bot to me.
 
@BenjaminGruenbaum if it wasnt on github, it wouldnt have gotten an xml schema. and we all know your code is not advanced before it got a schema for your xml. right?
btw @SebastianBergmann is anyone updating the schema? because I know I didnt.
 
@Gordon xml, lol :D
 
9:50 AM
@Gordon TBH, I don't know. There haven't been that many changes to the configuration, though.
My current task would be so much easier if PHP's built-in functions and methods would expose via Reflection whether they touch the filesystem or use the network.
 
Just one more question does => do the same thing as ->?
 
@IPAddress no
 
No. => is used in assignment when declaring arrays with key/value pairs. -> is for object resolution (methods and properties)
 
1729
Q: Reference - What does this symbol mean in PHP?

GordonWhat is this? This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list. Why is this? It used to be hard to find questions about operators and other syntax tokens.¹ The m...

 
does anyone know if websites like answers.unity3d.com use SE engine, or is it their custom clone?
 
10:01 AM
well on the brightside, i learned through deductive reasoning how to reassemble my laptop keyboard
 
@SergeyTelshevsky scroll down to the bottom of the page. It's using AnswerHub.
 
nvm, found the answer
@Gordon that's what they call QATO as I understand
 
Tried to do a composer update. Accidentally ran npm instead. #polyglotProblems
 
Anonymous
#firstworldproblems
 
#typos
 
10:08 AM
Hi, PHP'ers. What are your thoughts about this one
1
Q: LEMP - Magento displays blank page

sitilgeTrying to setup Magento2 on my LEMP stack. Was following the instructions here and here (did that after compiling from sources for multiple time since it was hard to fulfill composer requirements for Magento2) Installed composer Configured and run php, php-fpm Did some trivial tests (success) ...

 
Anonymous
ehh, the old blank page problem:/
 
Is the problem in configuration? Or could it in be Magento2 ?
 
did you check the error log?
 
Yes, keeps me bugging
well, there is no error log :O
I couldn't find it
magento is not using it system default logs, must be overwritten
but not able to find them in the respective dir as well...
 
Anonymous
does magento use exception/error handler?
 
10:11 AM
Not sure...
It should be.
IMHO
it would be nice if anything would be displayed/logged
but nothing
just a dead, blank page
 
Anonymous
had similar problem once with another cms. There was a database error which was caught by the exception handler, but somehow did not get displayed/logged
 
Ok, sorry, there is some HTML markup
but still blank
 
Is this correct syntax...
Class Apple {
function Mac() {//code}
function IPad() {//code}
}

Apple->Mac();
 
Anonymous
@IPAddress no
 
you have to create new object
 
10:14 AM
Oopa yeh
 
Anonymous
(new Apple)->Mac()
 
$apple = new Apple();
$apple->Mac();
@samaYo about the DB - i have not got that far yet
 
Anonymous
@sitilge check error_display is on first.
 
set to 1
did that instantly
 
Anonymous
and make sure you are using the right php.ini file
 
Anonymous
10:16 AM
phpinfo()
 
i am
 
Could I do new Class?
 
$class = new YourClass();
 
Anonymous
@sitilge did you see where the ini file is located in phpinfo()
 
Sorry I'm a beginner and just verifying my knowledge. I very appreciate your help. Thebphp reference is good for after beginner level I have found such as mysqli_query()
 
10:18 AM
located over here
/etc/php5/fpm/php.ini
@samaYo
 
Anonymous
then make sure to edit it, and check error display is turned to On
 
but i am setting the ini_set in index file
 
@SebastianBergmann For FS functions stackoverflow.com/questions/3115559/exploitable-php-functions might help
 
@samaYo thus overriding it on runtime
 
Anonymous
just do it from the main file for once
 
Anonymous
10:20 AM
also check nginx log
 
why do you see a botlleneck there?
nginx log is clear
 
Anonymous
setenforce 0 might help too
 
and anyway, it is overriden somewhere in Magento as well
 
Anonymous
which linux distro are u using?
 
ubuntu 14.04 LTS
64bit
 
10:24 AM
Syntax check... $apple = new array('mac'=>'£500', 'iPad'=>'£300');

And var_dump($apple['mac']); would display £500
 
Magento sucks. I don't care who disagrees
 
Why magneto sucks?
 
@IPAddress because he's not dr. x.
 
We are here to help, not to be rude
 
Anonymous
lol
 
10:25 AM
Dr???
 
@sitilge is steering someone away from a dumpster fire codebase considered helping?
 
Anonymous
@IPAddress you have confused programming with witchcraft-ery
 
Uhhh.... That's bad, right???
 
Magneto is a fictional character appearing in American comic books published by Marvel Comics, most commonly in association with the X-Men. Created by writer Stan Lee and artist Jack Kirby, the character first appears in The X-Men #1 (September 1963) as the archenemy of the X-Men. The character is a powerful mutant, a subspecies of humanity born with superhuman abilities, and has the ability to generate and control magnetic fields. Magneto desires mutants to dominate the human race as he views humans as an outdated species that no longer deserves its continual domination over the world. Writers...
 
not a fan of it also
just have to set it up :)
 
10:27 AM
Magento is an open-source content management system for e-commerce web sites. The software was originally developed by Varien Inc., a US private company headquartered in Culver City, California, with assistance from volunteers. Varien published the first general-availability release of the software on March 31, 2008, under the name Bento. Roy Rubin, former CEO of Varien, later sold a substantial share of the company to eBay, which is now the sole owner. According to research conducted by aheadWorks in October 2014, Magento's market share among the 30 most popular e-commerce platforms is about 30...
 
@r3wt no hard feelings
 
Oh no I understand
#late
 
@Gordon the Magneto seems to be OP :D
 
I'm on the train atm
 
Does anyone know of a namespace internal function in PHP? Or does anyone know how to declare a function in an extension to be in a namespace?
 
10:29 AM
Would this work... $apple = new array('mac'=>'£500', 'iPad'=>'£300');

And var_dump($apple['mac']); would display £500
 
@sitilge for sure dude. Maybe the new version is better than the one i had to work with. who knows
the one i worked on had like 5 billion files in random places and like 4 billion directories
 
@IPAddress The way to learn how to program is just to try stuff.....
 
I understand its a noon question
Noob
 
@r3wt i might say that the first insights are... not the best ones (who knows, maybe I am the faulty link)
@IPAddress why dont you give it a shot? :)
@r3wt haha, IT IS :D
 
I'm on the train lol
 
10:31 AM
@IPAddress yes, it works
 
@sitilge what version are you using?
 
@r3wt Magento2
 
BTW what's the best php testing config to have... I mean... Linux with xammp or Linux with wamp or windows with wamp or windows with web matrix or macintosh with.... You get the picture???
 
Anonymous
> Linux with xammp or Linux with wamp
 
Anonymous
;)
 
10:33 AM
@IPAddress vagrant, probably installed through puphpet.com to begin with.
 
Vagrant is a program?
 
Anonymous
@IPAddress linux, centos, nginx, php-fpm, postgres, redis
 
Oh its a VM
Linux with centos??
 
@IPAddress Windows: WPN-XM Ubuntu: Nginx + HHVM + MariaDB10 + Redis + Memcached + anything else you need
 
Anonymous
yes
 
10:35 AM
@r3wt thanks
 
Anonymous
@r3wt +1 for redis
 
i got an awesome 1 liner for Ubuntu but it installs npm and node too
 
Anonymous
@r3wt link?
 
oops, looks like it installs beanstalkd too
yeah, i'll post a gist
 
Anonymous
I have 1 liner for latest versions of each of the above I mentioned, but all are compiled and built from src, so .. it takes too much time like 30 mins for complete install.
 
Anonymous
I'm moving back again to rpm, because it's less painful
 
caveat: for 14.04 trusty
there's some cleanup steps too, but those are not covered. i assume you know how to configure hhvm and nginx from there
 
Anonymous
you should have bash-ed it.
 
shit, i don't know bash
i would be sitting there for hours literally
 
Anonymous
for simple tasks it's as easy as it can get
 
10:43 AM
yeah, maybe if you're an alien lol
 
my epic bashing skills -> askubuntu.com/questions/573725/…
 
Anonymous
@Andrea needs to be moaar newbie-friendly :P
 
Anonymous
@r3wt not bad :)
 
It's useless for anything practical
It only contains the bare minimum to compute a factorial
 
10:48 AM
Thoughts on PSR-7?
 
Anonymous
/o\
 
@Andrea pretty cool though still
 
^^
 

« first day (1682 days earlier)      last day (3266 days later) »