« first day (3212 days earlier)      last day (1750 days later) » 

 
4 hours later…
3:52 AM
\o
 
4:17 AM
\o
I got a decent result with my AST hacking for how little I knew about it going in :)
 
excellent
 
Wes
le mornin
 
I have a bug that causes it to segfault when it prints out a rethrown exception; I think it has to do with my bad line numbers or something. Pretty mild bug compared to what I was expecting to happen :)
 
4:33 AM
yo wes
@LeviMorrison I've only dabbled with ast really, I wanted it to have a nicer api than it has (which is basically no api) ..
 
Yeah, you don't even have a lot of helper functions
 
maybe for 8 we could introduce a nicer api, I think the ast will become more important now that machine code is a thing, you can't just go and hack up opcodes anymore, you have to target the ast ...
 
Hmm, just hit a case I'm not sure what to do with, since nobody would listen to me about : void and how it was a mistake in the first place, and that it shouldn't require an empty expr child.
 
I dunno what it should look like, but it should be easier than it is to inject code
 
return ddastrace_span_end_void(); won't work on a function declared as void return.
I wonder if I can replace the return stmt with an AST_STMT_LIST, almost as if it was:
{
    ddastrace_span_end_void();
    return;
}
 
4:42 AM
not sure, do whatever it would generate for that code, I'm not sure what that is ...
 
I think it just flattens it, though I could be remembering wrong.
 
what happens if you just replace the imlpicit return with your call stmt ?
(without return)
that might be enough, I think it will compile to code without an implicit return, but think that doesn't actually matter maybe ...
oh oh
you need to return don't you ...
well, unless your internal function handles that ... which it could I think ...
(it can edit the previous frame, which would be the caller)
 
Maybe. We'll see if the { ddastrace_span_end_void(); return; } idea pans out.
 
you will be caching the result of transformation, or relying on opcache to cache them ?
it's pretty tricky to integrate with opcache, you'd have to re-implement invalidation, but it might be worth caching them, it's pretty expensive thing o do, and the code may disappear from opcache
 
4:58 AM
@JoeWatkins Ha, as if I'd even thought about it this far yet :)
 
Hi i have a VPS with Dedicated IP and Have a Registered Domain, How Point Domain to Ip Of VPS( Then when i try mydomain.com my site come up )
 
I'm trying to figure out if there is any way to handle recursion into children ASTs in a generic way, since I don't actually need to do any processing on 99% of them.
 
how would I add an if statement for an add_filter...specifically trying to add_filter only if the user is on a Wordpress post template is_single() rather than a Wordpress page...
 
@LeviMorrison not totally sure what you mean, got code to look at ?
 
@JoeWatkins Sure: github.com/morrisonlevi/ddastrace/blob/…. Don't want to enumerate all possible ast types just for recursion if possible.
 
Wes
5:11 AM
@user3696987 tried in functions.php on top, if(is_single()) add_filter() with max priority?
 
sorry very new still to php....max priority?
 
Wes
add_filter("filter_name", function(){ ... }, /* $priority */ PHP_INT_MAX);
 
@LeviMorrison look at zend_ast_copy for inspiration there ...
 
@JoeWatkins Perfect! I think.
 
No, or I may not be doing it right...for reference, I am trying to modify Answer #3 in this thread so that the suggested filter only shows on on posts rather than pages: wordpress.stackexchange.com/questions/61272/…
 
5:27 AM
I think I may have to re-build certain states as I go, such as active class, function, etc.
Maybe lineno too
 
Good morning
 
@LeviMorrison don't change existing line numbers, set the line numbers of nodes you create to 0/(uint32_t)-1
they should be ignored by other tooling, and it shouldn't create different debugging/coverage sessions (breakpoints, lines) when the extension is loaded ... and it should try not to effect those things ...
 
They are set to 0, but I'm wondering if that's one reason the stringification of an uncaught exception on a traced function is segfaulting.
Could be missing some other property, or some other such thing.
 
if you put up a reproducing test case I'll have a look
hmm
you know maybe it would be better if you weren't present in traces
 
I was thinking about that, but I'm not sure.
 
5:34 AM
rather than return call($returnValue); maybe do the call and return separately, that way you won't be visible in traces for exceptions
 
When re-throwing an exception, does it modify it at all?
 
Hmm, I wonder what's going on then.
function to_iterator(iterable $input): Iterator {
    try {
        if (is_array($input))
            return ddastrace_span_close(new ArrayIterator($input));
        else if ($input instanceof Iterator)
            return ddastrace_span_close($input);
        else
            return ddastrace_span_close(new IteratorIterator($input));
    } catch (Throwable $ex) {
        throw ddastrace_span_close_exception($ex);
    }
    ddastrace_span_close_void();
}
Something about that catch + throw segfaults if it goes uncaught, when I generate it.
function to_iterator(iterable $input): Iterator {
    if (is_array($input))
        return new ArrayIterator($input);
    else if ($input instanceof Iterator)
        return $input;
    else
        return new IteratorIterator($input);
}
^ original.
 
I'm unsure, I'd have to see it happen
 
Oh, I didn't give a throwing example >.<
 
5:45 AM
I think you need to set line numbers for the try/catch actually
 
I should probably copy the lineno from the first and last stmt or somesuch?
 
yeah anything will do I guess
also, I don't see any zend_ast_destroy and I should if you are replacing nodes :)
 
So far they are just moved.
 
okay good
there's no reason to treat trait methods differently to other methods is there ?
 
Well, for this proof of concept, no.
But when it comes to doing this to only pre-registered function/method names...
 
5:57 AM
right yeah, you need to process use
 
morns
 
Ha, Sammy wrote that one.
 
you want to intern all those strings on minit, they are unnecessary allocations
also you can create some of the ast in advance too I think ... it'll be quicker to zend_ast_copy during process than zend_ast_create
 
@JoeWatkins Definitely.
 
6:07 AM
don't use module globals for new stuff, use ZEND_TLS directly, it will be faster in ts and simpler in nts runtimes ... (your stack stuff is sensitive to that)
sorry I got bored and started reading the thing ...
 
lol
Okay, linenos guessed for try/catch; need to add them to a few function calls and the throw line next.
 
6:24 AM
@JoeWatkins already bored enough for the ptrace() attach thing?
 
\o/ segfault gone. Just needed a lineno on the stmt_list of the catch body.
 
@NikiC But, overall no complaints about the package declaration implementation (I wonder whether we're going to have a composer setting to automagically insert the package name into all files of a composer package…)
(and how doable this is without killing perf)
… because I can imagine opcache not caching that if you put a stream filter in between…
 
6:47 AM
Ah, false alarm. The segfault is still there.
 
@DaveRandom That orange-colored hair guy has dismissed anything about pollution
 
@bwoebi got a couple of other projects on at the moment, not forgotten though ..
 
7:05 AM
o/
 
8:00 AM
clarion brilliantly clear; also : loud and clear
 
@bwoebi yeah, I believe opcache only allows file+phar streams
 
@NikiC So there is no plug-in workaround for that? meh
 
@bwoebi Not with stream wrappers, but you could also just generate new files
 
I would've loved it if composer could've handled the package concept fully transparently
 
@bwoebi If we wanted it to handle it fully transparently, then the way to do that would be to pass the package name to include
 
8:09 AM
@NikiC technically true, but then you have to manage cleaning on update etc.
@NikiC possibly the way to go then
(I mean, additionally)
 
@bwoebi I suspect that people are not going to like it
 
@NikiC I wouldn't like it either - if this were meant for general usage
 
@bwoebi would it even have to be additionally?
 
but this is meant for usage in class loading libraries etc.
@NikiC yes, I think so. otherwise you're going to hear "I don't want to depend on composer" etc.
 
@bwoebi you can do the same in your own autoloader
 
8:12 AM
(and in an old-style including application it would be insane to pass that via include)
 
@bwoebi oooh that exists
 
:-P
 
@bwoebi I think overall I would like this...
The problem is convincing other people :D
There seems to be a completely irrational fear that people are going to take their code and then run it with the wrong config
 
Yeah, I think it's going to be hard to sell it to people who cannot actually see how this is going to play out with composer and such
@NikiC yeah I call bullshit on that
 
8:28 AM
@bwoebi It is bullshit and I really hope this view is not as prevalent as internals discussions make it seem
 
well, but I definitely would like to see it given a try at least
 
@bwoebi It might be a bit problematic for static analysis
As long as only composer does it, it's fine. But if people manually do it, it could be a problem
 
Are there known issues with regards to PHPDBG 7.4 and "declare(strict_types=1)"? github.com/sebastianbergmann/phpunit/issues/… does not really make sense to me.
 
@SebastianBergmann not aware of any
@SebastianBergmann Possibly strict_types causes an error that gets hidden for some reason?
 
@NikiC Maybe. That would make some sense at least. Thanks!
 
8:57 AM
It's Friday. Time for some math fun: is 8 ÷ 2(2+2) = 1 or 16
 
@Gordon Syntax error, unexpected '÷'
5
 
@Gordon impossible to say
 
Things which require me to remember precedence or associativity rules are not fun. Just use fucking parens :-P
 
@Gordon How so? Shouldn't it be 1? Why?
Good morning.
 
@Tpojka it depends on what has precedence. Division or Multiplication.
 
9:10 AM
I mean how is possible for division to be before multiplication?
I'd never expect. Damn.
One more time tests proved their necessity.
 
@Tpojka multipication and division have same precedence then you have to solve from left to right.
 
Thanks. Reading just now. Still strange to me.
 
@Tpojka actually, it depends: en.wikipedia.org/wiki/…
 
9:26 AM
Yup, I am implied multiplication kind. Any other personality tests?
 
9:57 AM
@Linus srsly... just use parens :-P
not on board with the precedence pissing contest, readability++
 
concatenation operation resolution in assignment – #78365
 
@Jeeves o.O
 
:P
@DaveRandom how will you use the parens??
 
10:13 AM
8 / (2 * (2 + 2))
8 / ((2 * 2) + 2)
(8 / 2) * (2 + 2)
(8 / (2 * 2)) + 2
whichever one of those you mean
idgaf which one you mean in this case, just make it so I don't have to think about the order of operations
math/programming is hard enough without superfluous cognitive overhead
 
@DaveRandom but but ain't answer in all four conditions differ?
 
exactly the point
If you write 8 / 2 * 2 + 2 there is a canonical order of operations, and that's fine, but don't make me remember that shit, I have enough stuff to remember already
 
@DaveRandom yeah, at least we can all agree that 230-220 / 2 is 5!
 
:P
 
@Gordon *rolls eyes*
 
10:26 AM
@salathe I know…
 
11:24 AM
@PeeHaa downvoted accordingly
 
11:37 AM
@bwoebi A possible problem are tests
If composer is responsible for including files with the right package, it's not going to include tests
Which are included by PHPUnit instead
 
@NikiC couldn't package work like some sort of special require, and that file hols the package definition? it would probably require directory traversal though to go up the stack until finding a init.php (like the python way)
you mentioend something about file io before, it probably causes some headaches with opcache
 
Stream wrapper and opcache
 
12:02 PM
hi all
 
who's all?
 
it's us
 
don't know him
is it the orange bloke with the stupid wig?
 
12:43 PM
ba dum tsss
o/
 
Morning!
@Gordon My God... has this made it to Room 11. The confusion is the multiplication and division are supposed to be handled equally. So you work from left to right. So first what is inside the parenthesis, then you have 8 / 2 (4) which would parse to 8 / 2 * 4 and you solve left to right.
 
it is, actually, an undefined behaviour, as the folks on math.se would say, at least
 
I would solve the way most calculators would solve it. A computer would parse it to 8 / 2 * 4
 
49
A: What is 48÷2(9+3)?

fdart17It's ambiguous, there is not one right answer in this case, other than possibly that it is undefined. You may have $$\frac{48}{2(9+3)} = 2$$ or $$\frac{48}{2}(9+3) = 288$$ Therefore, there is no point in debating this. Note that the reason you are get different answers from mathway and...

 
Another view would be 8 / 2 (4). I am multiplying everything to the left of the parenthesis with what is inside.
 
12:58 PM
another view (my view) would be that it's stupid and you should just write things clearly
 
...and if you don't write things clearly then I can't/won't help you clear up your stupid mess
> Therefore, there is no point in debating this
damn straight
 
1:34 PM
@DaveRandom that's what I kept telling my math teachers when they were marking my answers in tests wrong
 
@DaveRandom I agree 100%
@Gordon =D
 
@StatikStasis I'd consider it as 8 / 2 * 4 / 1 and therefore 8 * 4 / 2
 
lol
 
Never even thought about doing a hidden city ticket flight. lifehacker.com/…
 
2:04 PM
> have teams devoted to finding passengers traveling with hidden-city tickets
quick! we've setup our pricing to extort as much money as possible for customers, and now they're trying to resist us taking to much money! How can we solve this? Punish the customers!!!! great idea.
 
> intentionally missing one leg
don't cut off your leg, people
#protip
 
:-P
 
@Danack Exactly!
If I pay for a movie ticket and I don't go- I still paid for that seat whether it's empty now or not. They still have my money for that ticket.
 
2:27 PM
@bwoebi After thinking about this a bit (and writing things into an RFC...) I'm not sure the special include is a good idea. As mentioned before, there's the issue with tests, which are usually not handled by composer. Additionally, 3rd party tooling (analyzers, IDEs) will have to also handle composer autoload sections in order to determine what is part of the package and what isn't
That means supporting the different autoload types, things like exclude-from-classmap, autoload-dev (not sure how that should factor in even) etc
 
2:49 PM
make clean … Permission denied
sudo make clean … I said I wanted it clean!
 
3:01 PM
zmorgens
 
o/
 
Reload Bug – #78366
 
Can anybody here convince me to not deprecate the utterly broken and misused thing that is called strip_tags for 8?
 
@PeeHaa maybe. A brief simulation of the internals discussion: youtu.be/UDJGJ-_YBfA?t=6233
 
3:11 PM
:D
I am at least trying to get everybody on board in here (as in I didn't miss something)
 
3:27 PM
@DaveRandom #RaveBabe
So I'm guessing that since Sebastion is deprecating DBunit no one unit tests their mappers? Usually just test that e2e?
Either way I'm going to have to write my own harness because the business requires all files to be 90% covered by unit tests.
@StatikStasis I have done this many times. skiplagged.com
 
@Allenph "no one unit tests their mappers" - what's a unit test in general, and what's a unit test when a DB is involved.
aka - just test against a DB. That's the only real test of whether the code works or not.
 
3:55 PM
How can I generate .cert file from .key? any idea?
 
4:17 PM
posted on August 02, 2019

I'm not sure I like pizza anymore. It hurt to type that. First, I started cutting back on the toppings, then I cut back on the cheese, now I'm having a hard time finding a good sauce. I'm down to only liking the crust. Either I haven't had any good pizza in a while, or I'm starting to change my tastes. In either case, the teenager in me is disappointed. The teenage mutant nin

 
Despite the things being proposed being stupid, I think there is a problem in the RFC process that could be addressed. Anyone want to give me a reason why this idea is dumb: Improve visibility of RFC negative feedback before I send it anywhere else?
 
Incomplete CURL_SSLVERSION_xxx, missing CURL_SSLVERSION_MAX_xxx – #78367
 
@salathe ^^ would appreciate your feedback.
 
@Allenph Someone else had told me about that. I was just looking up some flights on it earlier but none of mine were able to find anything other than the normal flights.
 
4:40 PM
Does anyone know a source that mocks JSON API?
Aside from postman
Aside mLab also, which is giving me CORS headache
 
@Danack Imo it should be a section in the rfc itself
Not sure about the signing part though :)
 
@PeeHaa I don't entirely disagree, but that would have problems with multiple people editing one document and possibly not agreeing on the formatting.
 
Yep
True
 
@PeeHaa I'll explain why....if people like the dear departed Tony want to write some negative feedback, they're free to do that, and then I'm free to not put much value on that. If people who have more weight in the community are giving feedback, and they all object strongly enough to sign their name, then it behooves* everyone to read that feedback.
*I love that word.
 
It certainly does give more weight like that yes
 
4:55 PM
 
anyone working with mLab?
 
lol
 
cmb
@PeeHaa, strip_tags() can sometimes be useful for quick HTML -> plain text conversion.
 
@cmb Do you have some (public) example where it is used properly?
 
cmb
@Danack, well there is already item 5 in wiki.php.net/rfc/howto
It's useful to send multipart emails when you have an HTML body.
 
5:02 PM
@cmb I think one of the reasons no-one is doing that is that it's just too much work. Changing the responsibility of documenting the negative feedback from the RFC author to people saying that negative feedback would mean it's more likely to be done.
 
cmb
@PeeHaa, the fact that it is often misused instead of proper output escaping, doesn't disqualify it to be sometimes useful.
@Danack, I have to agree.
 
thanks for pointing that out though - I'll add something about it to the words.
 
@cmb My reasoning is. You either want to use a proper html sanitizing tool or a proper escaping tool
strip_tags is neither of those
As in I have never seen a proper use of the function
 
cmb
@PeeHaa, I think you can properly use it on any valid HTML (i.e. where stray < and > are written as entity refs)
using it on arbitrary user input is not unlikely to give undesired results, though
 
@cmb Have you ever seen it not used on untrusted input?
If you have control over the input you would still not use srtip_tags, but instead simply make sure there is no html in there
 
cmb
5:13 PM
sometimes you want proper HTML, but also a stripped version
I probably wouldn't vote against deprecating/removing strip_tags(),
 
Which would be generated twice.Not generate html that remove tags
 
cmb
given it's overly complex implementation
 
Maybe I am missing something and there is an actual huge valid use case I am missing
@cmb Not to mention tons of issues in the past
 
cmb
and current issues (fixed a respective bug few hours ago)
 
ugh yes. I know there has to be more :(
 
cmb
5:21 PM
@PeeHaa, externals.io/message/102394#102462 nicely summarizes
 
Yeah I forgot about that one
I will just add it to my 8 rfcs list and see how internals reacts
For the getting plain text variant it's a simple as domdoc::textcontent()
 
Does phpdbg trigger the zend_ast_process hook?
 
And for stripping tags you would just use a actual sanitizer
 
 
2 hours later…
7:09 PM
@Danack Is it really so simple to create a fixture harness for the DB that it doesnt make sense for a DBUnit to exist? How do you do it?
 
I probably could spit it up into smaller tests, and also I'm aware I lack code coverage.
> https://github.com/composer/composer/releases/tag/1.9.0
> Added a --no-cache flag available on all commands to run with the cache disabled
 
@JoeWatkins Thanks for the advice on this! Does this look about right? :) github.com/morrisonlevi/ddastrace/commit/…
 
7:37 PM
if($company_id = element('company_id', $filter) && $company_id !=0){
			$this->db->where('u.u_company_id', $company_id);
		}
this giving me an error of undefined variable $company_id
I dont understand why?
 
!!docs operator precedence
 
That manual page seems to be in a format I don't understand
 
ohh I see
then whats the solution on this
 
What do you expect company_id to be?
 
7:43 PM
non zero
 
Are you perhaps looking for ??
 
I didn't understand your point.
 
or are you trying to write "clever" unreadable code?
 
that is trap
 
$company_id = element('company_id', $filter);
if ($company_id !=0) {
}
That's how you should write that if I understand the purpose correctly
 
7:44 PM
i imagine same
 
Hello! Can someone please bring light to me about: what is the difference/benefits between flashing a message in session vs put that message in response?
 
I can not combine 2 statement in one line, right?
 
You can depending on what you are actually trying to do
But you should not
Prefer readability over well... nonreadability
Assignment inside a conditional is almost always ugly and confusing
As you have noticed because of the problem you are facing
 
yeah! that is also correct
 
@SammyK yes, but not sure why you moved the TSRMLS_CACHE_DEFINE
and yw :)
 
 
1 hour later…
9:09 PM
@BoteaFlorin you might be missing this: en.wikipedia.org/wiki/Post/Redirect/Get
 
9:38 PM
Anyone know if an internals function which returns by reference?
Preferably no extensions needed
How do I properly return by reference in internals functions? I'm getting a warning and I think that's where it is coming from.
 
10:28 PM
@JoeWatkins Technique worked, FYI.
 
10:54 PM
@LeviMorrison preg_match()
 
@bwoebi It has an out parameter; doesn't look like it returns by reference, though, right?
 
11:13 PM
can anything return by referene?
 
11:41 PM
@JoeWatkins Ah! I totally missed that. Do extensions only need ZEND_TSRMLS_CACHE_DEFINE at the bottom of the main extension_name.c file?
 

« first day (3212 days earlier)      last day (1750 days later) »