« first day (1586 days earlier)      last day (3584 days later) » 

15:00
yeah, well it is interesting that Zend Server has some profiling
which is quite nice since it gives you info whether a request is too heavy and slow
ah yes zend server has this toolbar thing
yeah
that also works in the background i think if you want it to
but for me it's still a bit foggy what is considered a normal request. I usually go by it has to be up to 500ms rule
Hello, if anyone has a couple minutes spare I would really appreciate it, I have a revision running on my local server (stackoverflow.com/a/28580885/4089378) the issue I'm having is I have a text file with three files I'd like the script to download but the script is skipping files #1 and #2 and downloading file #3
15:01
posted on February 18, 2015 by kbironneau

/* by Marwen */

it really depends, if the request is not so common, then 500ms may be ok, but if you have a specific request on your page that is done much more often, then this should be faster
> Actually, your example is partially invalid because strict-typing radicals now propose to add a (int -> float) exception to so-called strict mode (which proves the approach is flawed, IMHO).
user895378
"radicals" ... that's helpful language.
so type generalization is "radical and proves strict typing is flawed"?
@rdlowrey hey, I'm radical, dude
user895378
15:05
@Leigh I always thought of you more as epic or narly ...
radical gets a rep name these days
I always thought of gnarly as gnarled :(
@rdlowrey I always think about your eyes
your eyes
user895378
Is it gnarly? I never know gwhether the "g" is gsilent.
ಠ_ಠ
Yeah, silent like the c in gastrocnemius.
15:07
@NikiC there's a failing generator test in Andrea's patch about empty return being a compile error. Is that known in 7? or is that a bug here?
Sometimes when I look to room 11 chat - sporadically - I really wonder if it's devs room. Because, if I won't read couple of phrases above... it looks very weird
Seriously it's like someone typo'd.
@ircmaxell an empty return should not be a compile error in generators
@AlmaDo Devs just wanna have fun
not aware of any issues with that in 7
15:08
That's all they really waaaaaaant
I know, but is that a test failure of her patch... I'll try compiling master
@ircmaxell nice lecture
thanks
user895378
@NikiC Am I correct to assume PHP generators can't have non-empty returns (in the way a javascript generator does) because they're actually objects and wouldn't play nice with the existing internal semantics for return? Is it an implementational complexity issue or is it that something like Generator::getReturn() would just be weird and not applicable when Generator::valid()?
user895378
(sorry for asking like ten questions in one there)
user895378
15:13
I'm just interested in your thought process with regard to Generator and return ...
@rdlowrey Return with value is something that would be added in conjunction with coroutine calls (yield from)
user895378
I see. That makes sense.
posted on February 18, 2015 by rdlowrey

- Added `Reactor::coroutine()` method - Added `Amp\coroutine()` function - `YieldCommands` "enum" constant class removed -- yield keys now live in the reactor class - New optional `"coroutine"` yield key for self-documenting generator yields...

Because then the return value would have a meaningful use in syntax, like $ret = yield* foo();
user895378
So I wouldn't have to do the hacky things that @Feed's just reported about ;)
15:15
Of course one could also have it separately with the Generator::getReturn() you suggested, but it's probably not terribly useful without the yield* operator
but it would already be useful in some cases ...
hm, maybe we should add that independently from coroutine delegation
user895378
Right now I just fake it when resolving coroutines internally. If a generator does this I store it as the "return value" from that generator:
user895378
yield "return" => 42;
user895378
But it would be nice to have some standard way to access the "result" of a generator without resorting to key hacks.
throw new GeneratorDoneException($value);
:-P (totally kidding btw)
user895378
hehe
user895378
15:20
I used to just say, "whatever the last thing is that the generator yielded is the 'return' value" but that was too magical and ambiguous. So now I only assign "return" values if that key is explicitly yielded.
@rdlowrey Yeah, I use a wrapper object instead, but same idea ^^
so, I've got her proposal mostly fixed up from a code perspective (really tiny diff). using declare(strict_types=1), but must be the first line in the file.
i think we need a website that lets you build an allowed/disallowed conversoin map for type hints easily.
@rdlowrey return is like the final yielded value yeah?
user895378
@LeviMorrison That's what I used to do.
user895378
15:24
3 mins ago, by rdlowrey
I used to just say, "whatever the last thing is that the generator yielded is the 'return' value" but that was too magical and ambiguous. So now I only assign "return" values if that key is explicitly yielded.
@rdlowrey Maybe you want to make a small RFC for getReturn()? ^^
user895378
@NikiC I wouldn't mind doing the RFC. The implementation would be up to you if you're interested :)
implementation shouldn't be an issue
user895378
Okay. I'll write up an RFC in the next couple of days and get feedback.
cool
Be prepared for Lester rants about how he doesn't even understand what generators are and that return values are totally unnecessary. And we really should just put all our code in one file and do calls with goto.
user895378
15:27
hehe okay
I'm not sure I understand why return values are necessary.
zend_language_scanner.c is generated, right?
from the y isn't it?
Also, consider that it won't play nicely with the return types implementation we currently have. Actually I think you get lucky.
15:28
there was a couple mails to remove it from git...
@Leigh from l
/me is bad and will go away now
@LeviMorrison we'll have to nop out something, right?
got a merge conflict in it, so...
I think we no-op all the return checks already.
user895378
15:29
@LeviMorrison \o/
crap, how do I force it to regenerate?
ah you mean that it's confusing that return returns something else than what is type hinted?
@ircmaxell touch .l
assuming you have re2c
looks good
one more make test before pushing
user895378
@LeviMorrison They aren't necessary when you're using generators for iteration. But they're extremely useful when you're using generators as coroutines.
user895378
A generator return allows you to coalesce several async operations into what feels like a normal control-flow without callbacks or thenables.
15:33
if (UNEXPECTED(strict && Z_TYPE_P(arg) != IS_DOUBLE && Z_TYPE_P(arg) != IS_LONG && !(check_null && Z_TYPE_P(arg) == IS_NULL))) {
@rdlowrey This sentence sounds very smart :D
user895378
:)
./buildconf && ./configure --disable-all --disable-cgi --enable-debug && make -j16 && make test
the configure takes longer than the compile
@ircmaxell -j16
:)
15:37
--enable-zts-maintainer
My workstation has a nice CPU :-)
@ircmaxell And the tests take longer than the configure ... much longer ^^
@FlorianMargaine didn't that go away in 7?
@FlorianMargaine not very necessary to test zts nowadays
@NikiC actually, on this box, they are reasonably quick. Only 2-3 minutes
15:37
oh, maybe
well, the macros aren't necessary, but the thing still exists
@ircmaxell Hm, maybe ... I don't think I ever ran the full test suite on my new computer
@FlorianMargaine yes, it does. because zts is still slower mainly
I've got a bunch of test failures since merging master (mostly around the built-in webserver)
@NikiC if you run with --disable-all, it doesn't run everything, does it?
15:38
@FlorianMargaine nope
I mean, it won't run the 10k tests
@FlorianMargaine no, only 7851 tests
ah right, --disable-all is not so much probably
building and testing master to see if it's the branch, the merge or something else
15:39
hello, how do i read page like check.torproject.org/cgi-bin/… line by line
from an external server
@ShubhamNishad open it with file($url) which will give you back an array of lines
thanks :) let me try it
@NikiC worth adding a new "testsuite": make enginetest which only runs the tests in Zend?
@ircmaxell It's called make test TESTS=Zend
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Test fsockopen() function : error conditions [ext/standard/tests/network/fsockopen_error.phpt]
testing fsockopen() with udp sockets [ext/standard/tests/network/fsockopen_variation2.phpt]
Bug #61977 Test exit code for various errors [sapi/cli/tests/bug43177.phpt]
Bug #65066 (Cli server not responsive when responding with 422 http status code): 100 status code [sapi/cli/tests/bug65066_100.phpt]
@NikiC ahhh, I've always done sapi/cli/php run-tests.php -p sapi/cli/php path/to/tests
15:41
@ircmaxell sapi/cli/php run-test.php -P path/to/tests FYI
SY.
SY.
hi guys; I have a small question concerning XDebug:
I can set up the profiler to launch only when triggered by a GET or POST variable with the profiler_remote_trigger option. Can I do the same thing with the remote debugger itself? I want the COOKIE to be ignored and enable debugging only if the GET/POST field is set
@NikiC didn't always work for me on some setups
@ircmaxell we can do that? I did PHP_TESTS_EXECUTABLE=sapi/cli/php ./run-tests.php path/to/tests/
@ircmaxell it's since 5.4
user895378
@LeviMorrison Basically what generator return means is I can write an async "framework" that does the following. There are no callbacks, no thenables, nothing. Async operations simply yield promises and when they're resolved execution resumes. If the promise fails for some reason the relevant exception is thrown back into the generator where it can either be handled or allowed to bubble up. It's not unlike the async keyword you see in C# ...
user895378
15:42
$gen = function() {
    $a = 20;
    $b = yield myAsyncMultiply($a, 5);
    $c = yield myAsyncAdd($b, -58);

    return $c; // int(42)
};
@NikiC that may be why
user895378
^ Generator::getReturn() would make that possible (where the async operations wouldn't be so spurious ... they'd actually do non-blocking IO or generate results in other threads.
@FlorianMargaine maybe... dunno
SY.
SY.
correction: the option was called 'profiler_enable_trigger'; I haven't found a corresponding remote_enable_trigger option
@ircmaxell Thanks it worked. :) also now how do i check if the line starts with #. I assume that there can be blank space at before #
15:43
@ShubhamNishad how about you google...
this is programming 101 you're asking there
@FlorianMargaine, okay found. first i need to use trim and then check the first character
see? search first, then if you're stuck, tell us where you're stuck, what you tried, and then we'll be happy to help you
15:55
` if (!(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) && CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {`
eih, not particularly happy about that, but it works
OMG
I just saw the ultimate solution for scalar type hints
> Code indented with spaces is strict and code indented with tabs is weak. -- reddit
10
switch to golang?
yeah, isn't that genius!
Honestly, I think that idea is genius
15:57
@NikiC What happens when you use both?
@Danack you're sent to hell
@Danack You get what you deserve. We'll choose between weak and strict at random.
@FlorianMargaine But you're already there.
@Danack did you know that hell has a hell too?
can you even imagine what it looks like... ?
it has register_globals
+--TEST--
+Test nested function calls in strict_types=0 and strict_types=1 modes
+--FILE--
+<?php
+
+function takes_int(int $x) {
+    global $errored;
+    if ($errored) {
+        echo "Failure!", PHP_EOL;
+        $errored = FALSE;
+    } else {
+        echo "Success!", PHP_EOL;
+    }
+}
+
+declare(strict_types=1) {
+    function strict_calls_takes_int() {
+        takes_int(1.0); // should fail, strict mode
+    }
+
+    class StrictTakesIntCaller {
+        public function call() {
+            takes_int(1.0); // should fail, strict mode
16:01
@ircmaxell +1
I also added the int->float generalization
anything else needed before tweaking the RFC?
$ sapi/cli/php -r 'declare(strict_types=1); echo number_format(52) . "\n";'
52
<?php
foo();
?>

<?php
declare(strict_types=1);
?>
what's the behavior there? ^
$ sapi/cli/php -r 'declare(strict_types=1); echo substr(52, 0, 1) . "\n";'

Catchable fatal error: substr() expects parameter 1 to be string, integer given in Command line code on line 1
@FlorianMargaine fatal error
(maybe add a test, is what I meant)
@ircmaxell Couldn't that result in a loss of precision on 64-bit platforms?
16:04
$ cat test.php
<?php
echo "hi";
?>
<?php
declare(strict_types=1);
echo "bye";

$ sapi/cli/php test.php

Fatal error: strict_types declaration must be the very first statement in the script in...
@TheodoreBrown yes, but other languages do this exact type of expansion (Java, C#, etc)
@FlorianMargaine that's a good idea
@ircmaxell yeah… listening to it (annoyingly slow youtube :x) … thanks :-)
hi
<?php
declare(strict_types=1);
echo "bye";
@ircmaxell behavior there? ^
hibye
@FlorianMargaine error
You can dance if you want to
16:07
same as namespaces, I guess
@ircmaxell I guess I'm okay with this - it doesn't cause issues in the vast majority of cases.
@TheodoreBrown it's a lesser of evils really
@TheodoreBrown Yeah. I'd think differently about this if we had bigints, but now with Andrea gone that probably won't happen.
^^ my thoughts exactly
so, if we ever want to introduce bigints… will it be impossible?
16:09
of course it's not like the issue doesn't exist ... if you do number_format(really_large_int) it will garble the last few digits (~4)
And that may be the sign that for integers you shouldn't use number_format but sprintf instead ... or that number_format needs to be generalized
But in the end, it probably doesn't matter for many practical purposes
@bwoebi not at all, just that we'll need to revisit certain functions which accept floats today to accept a numeric type instead so it can be smarter about larger values
yeah… true. Most functions accepting float are either number formatting or math funcs… and of these not too many exist…
posted on February 18, 2015 by rdlowrey

This release updates the underlying LibDNS dependency to v1.0.0.

there's one "oddity" I've found
namespace Foo {
    declare(strict_types=1);
    function add1(int $arg): int {
        return $arg + 1;
    }
}

namespace {
    var_dump(Foo\add1(123));
}
^^ technically that works since namespace doesn't emit an opcode
but the declare affects the whole file
yeah, we currently do the check a bit weirdly
same issue with declare(encoding) I guess
16:14
yup
I just duplicated the check that it uses
Most people don't use multiple namespaces per file, fortunately.
hmmm, I wonder if we should check AST position?
@ircmaxell But if we forbid that, do we also forbid having a namespace (semicolon) declaration first?
and use statements before it?
Hm, yeah, we probably should
@NikiC well, yes
make it literally the first non-comment token in the file
otherwise error
@MarcelBurkhard Aha! Thanks for your answer, I'll take a look... although are there any non-js ways!?
16:20
@ircmaxell it should still be allowed to have another declare before it tho, right?
@NikiC yes
can I directly check CG(ast)->child[0] == ast?
@ircmaxell I guess you can
better way?
I can't think of anything simple
@ircmaxell Hopefully not another strict_types declare, though.
user924016
Morning
@ircmaxell dam?
@NikiC to gold
user895378
What is reddit gold anyway? I've never bothered to try and understand the concept. Is it just like someone giving you a bounty on SO?
16:26
CG(ast) will always be zend_ast_list, right?
@ircmaxell I'd say so
is there a simple check to perform? Or is assuming so OK?
@rdlowrey yeah, except it's money
and having gold gives you a few features
@ircmaxell use zend_ast_get_list. It will assert it
works
            /* Strict Hint declaration was already handled during parsing. Here we
             * only check that it is the node in the AST from the file. */
            uint32_t num = 0;
            zend_ast_list *file_ast = zend_ast_get_list(CG(ast));
            while (num < file_ast->children &&
                    file_ast->child[num] != ast &&
                    file_ast->child[num]->kind == ZEND_AST_DECLARE
                    ) {
                ++num;
            }

            if (num >= file_ast->children || file_ast->child[num] != ast) {
user895378
16:30
@FlorianMargaine oh, you mean people pay real actual currency to get reddit gold? And then they can bestow it upon posts/comments?
that's the new check
@rdlowrey no, people pay real actual currency to give reddit gold
user895378
Ohhhh I see.
@ircmaxell "Strict Hint declaration was already handled during parsing." was it?
gold is like $2
16:31
no, deleting that comment
user895378
Seems like a really weird way to monetize reddit, but hey, whatever works.
@ircmaxell will you do the same check for encoding too? I know it's technically bc, but ...
I'm sure that's how it was intended in the first place
@NikiC I would do that as a different commit
outside of this RFC
@ircmaxell k
good idea
@ircmaxell @bwoebi Should I watch the high perf php talk?
@Jimbo no, If your browser doesn't submit data what do you want to do about it server-side?
16:34
@MarcelBurkhard Of course, I commented on your post about updating hidden fields.. may do it that way
@NikiC I think you know most of it, but go for it...
@ircmaxell just watched the high performance talk, best compilers 101 I've seen, esp as it relates to the guts of php
@NikiC did anyone test encoding in 7?
@Jimbo I saw that now, thanks for accepting my answer :)
@ircmaxell yeah. as far as I know it still doesn't work as well as it did before
@MarcelBurkhard Np, thanks for helping me see how stupid I was :P
@NikiC I can't make a valid declare statement
16:38
@ircmaxell huh
well, that at least should work
@Jimbo you're welcome
the only thing I can get to not fatal (but issue a warning) is declare(encoding=1)
anythign with a real encoding fatals
what does it fatal with?
@ircmaxell did you use quotes ... ?
it's encoding="utf8" not encoding=utf8
16:40
yes
and this happens on master not your branch?
@NikiC yeah. It's nothing unknown, but interesting to hear in a resumed way.
@NikiC not sure yet, will recompile shortly
@FlorianMargaine added a bunch of tests that should make it explicit: github.com/ircmaxell/php-src/compare/scalar_type_hints_v5 (scalar_strict_declaration_placement_*)
interesting, in this case it's different
$ php -r "declare(encoding='UTF-8'); echo 'hi';"
PHP Warning:  declare(encoding=...) ignored because Zend multibyte feature is turned off by settings in Command line code on line 1
@ircmaxell yay :P
I get the same warning on both branches
let me try something else
16:45
@ircmaxell did you compile with --disable-all?
@FlorianMargaine yes
the warning is fine, I was getting fatals that indicated something else was wrong
@NikiC seems to have been a compile glitch, rebuilding fixed it
Are we honestly going to have even considering strict/nostrict for each individual file?
@NikiC FYI, I changed it so that it must be the first AST node. Because declare(encoding) supports block scoping
16:52
Hello, if anyone has a few minutes spare to help me with a problem I would really appreciate it, I'm running a posted revision on my local server (stackoverflow.com/a/28580885/4089378) the issue I'm having is I have a text file with three files I'd like the script to download but the script is skipping files #1 and #2 in the text file but downloading file #3
@ircmaxell it doesn't
or maybe it allows you to specify the block, but it's certainly not scoped to it
we should make it an error if it isn't yet
@NikiC yes it does
it must be first instruction
but you can do
<?php
declare(encoding="UTF-8") {


}
@ircmaxell yes, but it's not scoped to that block
imho it should be okay for the declares to occur in any order
well, considering it can be blocked, that would imply you can do the following
<?php
declare(encoding="UTF-8") {
    declare(strict_types=1);

}
since strict_types doesn't support block mode, I figured it was a good idea to mandate it come before encoding
nah
we'll just drop block support for it (later)
(or even not later) ^^
16:59
so for now, mandating it first (incase block support isn't dropped)... In the future that can be relaxed

« first day (1586 days earlier)      last day (3584 days later) »