« first day (3906 days earlier)      last day (1036 days later) » 

user4717133
12:37 AM
@hakre I have never used it in production, I developed it to give myself a support in the development environment. It is assumed that in production the environment should give an error 500 and the error log would have to be rebised
 
well I can imagine turning every error into an exception can lead to faulty behaviour of a system.
but this is merely something I currently ask myself honestly, as I left it on the server a couple days ago and will check the logs on monday.
E_NOTICE is not in the error reporting, just standard E_ALL, so only these will be converted in my case.
(I hope so, didn't check php.ini)
 
user4717133
1:10 AM
@hakre ok any bug / suggestion you can add to github soon I will be doing a rework of that packages
 
that would be a different package :/ - just exchanging practical matters from operations.
 
 
6 hours later…
7:36 AM
no rule for make_ppc_sysv_elf_gas.S ・ Compile Failure ・ #81202
 
8:13 AM
@Trowski ping ^
check it please
 
8:32 AM
@Girgias Yeah at this point I'm trying to see what function it makes most sense to add the check to. I'm not very familiar with those functions and where they are used.
 
 
2 hours later…
10:40 AM
WHY ARE THERE SO MANY STRING FUNCTIONS??
 
10:53 AM
Why are there so few string functions?
 
11:35 AM
@hakre counterpoint, always turning every error into an exception leads you to getting rid of all of them really quickly.
 
12:20 PM
@Danack this is true for errors. quickly hiding E_NOTICES only to restore the operational side and then not learning about bug clusters they may be part of might not pay so well on the maintenance account.
and also what I just learned is that an uncaught exception does not make every error visible. the HTTP status 200 on uncaught exceptions somewhat told me a lesson.
 
> when display_errors is enabled
 
sure it's a configuration problem, but really one I didn't knew about earlier. If I would have just throw on error and the configuration is not right for that, it may have lead me to the false assumption that now finally things are right - while they weren't
@Danack yes, exactly that. had to be fixed first.
which meant the code had to be checked for places where exceptions where just caught and swallowed and then to remove try {} catches {} there so that all exceptions go through and can hit hard.
(and for where this has security implication, catch, clean and throw a new one)
my current understanding is you have to turn all errors into exceptions, uncaught. and for the existing exceptions, they also need to be uncaught so that you can streamline the error handling.
and with the error_reporting level you can control how deep you want to go for the errors.
e.g. in development on the highest level, perhaps in CI as well if the codebase is ready for that.
on production my current understanding is to keep it on the runtime default.
 
> the code had to be checked for places where exceptions where just caught and swallowed and t
uh, yeah. don't do that.
 
well if it would have been me, I would at least know the places because I don't do it.
:)
 
There's a good doc I'm in the process of archiving here: Exception-Handling Antipatterns
Print that out and staple it to whoever did that their forehead.
 
12:35 PM
yes, a lot of educational work currently. but somehow I like it.
but that link is for java, does it apply to PHP that way?
on the PHP internals side, would it be possible to have a fatal error as an exception as well? or was it that with throwable already all those places where it could have been possible straight away they turned into throwables?
obviously there is a reason not all errors are throwable, so this perhaps answers kind of itself.
 
@hakre most of the things that were previously fatal errors are now exceptions.
I'm not sure if there is a list of the remaining ones....if there is, then converting more of them to be exceptions would be a good long term goal.
 
well one can't: fatal error of uncaught exception ;)
 
meh - set_exception_handler is your friend and mine.
 
nah, I just let them bubble up. they are handled in the logging then.
maybe not in a cli utility but on the server.
 
12:51 PM
@hakre for me, there's quite a bit of value writing code that pulls data out of the exceptions in different ways, to make it easier to debug both in cli and api
That's particular true when there are custom methods on some exceptions.
 
1:09 PM
@Danack just curious: in your console fork did you fix the problem of symfony console with argument parsing (e.g. --help is always detected even if after --). ?
 
@hakre never encountered it, so no.
 
@Danack makes sense, does your console project accept contributions?
(you can say no)
 
@JoeWatkins Looks like this line also should have been fiber_asm_file_prefix="ppc32_sysv"
 
@hakre sure - I mean it's been stable for ages, so I haven't worked on it much...but yeah, go for it.
I mean also that I've not been pulling from upstread, so it probably misses a whole load of new features. That's just to set your expectation.
 
1:25 PM
@Trowski ack
 
@Crell Did it make any more sense when looking at the source code?
 
"""due to the use of Interned Strings, an optimisation used by RETURN_CHAR that re-uses single character values. While this could be used as a way to intentionally fake a literal string, it's unlikely to be used to create sensitive strings"""

"We acknowledge that the notion of literal is flawed, but we're going to let users believe it isn't anyway."
Fuck, man. Vote ALL the noes.
 
@Trowski can you check last push, I think bit better now ...
 
@JoeWatkins Yep, thanks.
 
1:45 PM
merged, ta
 
2:05 PM
@Sara Hm, what, huh?
@LeviMorrison Haven't had a chance to look at it yet. Will try to do so in the next few hours.
 
2:33 PM
can I run a cron job from php script
????
 
@Crell Oh, just grousing about an RFC I already distrust being crap in a new and exciting way.
 
specifically from codeigniter.
 
@NomanJaved this should be possible. the cron daemon normally uses the same shell as php for example with passthru()
the cron daemon does some extra things like emailing the output if there is any or executing the command under a different user.
you should be able to find more details when you execute man cron in your terminal.
 
3:07 PM
I am looking into the documentation. @hakre
 
4:05 PM
PHP.net sends an automated email to the note author when I delete their note?
:O
 
It does? o.O
 
I don't know, but it looks like it as I just got 3 mails in spam
 
I suppose it makes sense, but I didn't know that.
 
when the email doesn't exists then PHP sends a spam mail to me
Hi. This is the qmail-send program at lists.php.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
 
Yeah, I've deleted comments in the past, ones that were either not relevant to a page and/or outdated, comments where I've rolled their info into the manual, or outright spam
Huh, I wonder if I have any of those
 
cmb
4:09 PM
Deleting shouldn't send mail; rejecting is supposed to, though.
 
What is the difference between rejecting and deleting? Rejecting gives the author the opportunity to improve the comment?
 
Which button is which?
The UI isn't very friendly
 
It'll say if you mouseover the buttons, I think
 
Oh, no hover, but the link is GET (nice!) so I see I clicked delete
delete with GET, such an amazing idea
 
4:26 PM
thanks
 
4:40 PM
What do you think about the wording in my recent PR? github.com/php/doc-en/pull/737
 
github.com/php/doc-en/pull/736 I have mixed feelings - on the one hand, yes, the syntax should be lower-case because we know it as match, not Match. On the other hand, the first letter of a sentence should be capitalized, and the list items are sentences with a period. The PHP manual is a representation of technical documentation which must have correct English.
Match is also technically and syntactically correct, even though it's not the usual code style. On the other hand, later on in the page, it says "match expression arms may contain multiple expressions separated by a comma."
So it needs to be one or the other :/
There has to be an official ruling on this, can't be the first time it's come up
 
@Tiffany Throughout the documentation keywords are not capitalized even when they are the first word. So to be consistent we need to follow this style
 
4:55 PM
thanks
 
If there's anyone here with a good knowledge of the FPM status page contents, if they could review github.com/php/doc-en/pull/738 and let me know of anything amiss (or any improvements that they'd like to see), that'd be great
 
Hello guys.. new to chat,, first time chatting on stackoverflow!! :)
 
5:48 PM
@Raveendra welcome. btw It's often busier during the week, and not so busy on a saturday night...
 
6:11 PM
@Crell I can find time to pair sometime in the next 8 hours. I'll check in periodically.
 
6:57 PM
@PatrickAllaert Everything went well. No problems.
 
7:27 PM
@IluTov The issue is more all the stupid ZPP tests, in that case you can delete them...
Do you have the implementation somewhere?
@IluTov thought on the reply on list? (to also deprecate explicit casts?) I completely disagree with the changing of the value of false tho...
 
7:54 PM
@Girgias Going from coercion with no error to deprecating explicit casts seems a bit sudden. There's no migration path for changing the output of casting false to string so no from me.
 
@IluTov Yeah, I mean I suppose you could say you need to force to do a ternary buuuuuuuuut
 
@Girgias What I mean is we can't change the output without removing casting completely first. Otherwise the user never has..
Never noticed the behavior was changed.
 
@IluTov Oh yeah obviously
I mean I would imagine if we deprecate the explicit casting case we wouldn't reintroduce it
Can casting ever fail :thinking:
 
@Girgias Right now? Yes, casts to arrays can fail.
 
Huh
How? Enums?
 
8:01 PM
Wait, I might be wrong. I'm on mobile, I'll check later.
 
No worries, I'll be up for a while :D
 
I guess cast to string can? For objects that don't implement toString.
 
TIL: you can cast to arrays. Also, this is terrible.
 
8:16 PM
@Danack Makes no sense for strings, ints, floats, etc to cast to array. I don't mind the null cast as much, because it's somewhat common to have nullable objects and casting objects to arrays is... well, at least more logical.
 
Casting from arrays to int/float is also Fun
 
@LeviMorrison more than a negative amount of logic.
 
8:36 PM
@IluTov Good point, so at least there is precedence
 
 
2 hours later…
10:12 PM
@LeviMorrison Good evening!
 
:wave:
 
So I think I've done the first half of what you describe.  I now have this:

	|	expr T_PIPE expr
			{ $$ = zend_ast_create(ZEND_AST_PIPE, $1, $3); }
 
Good step.
 
I'm not entirely sure what you mean with the compiler part. Interpreting the AST into opcodes is where I am still largely lost.
Hm, wait, the logic we want is super-similar to the > operator, no? At least at a compiler level.
 
Most binary ops.
But then you'll want to look at how it compiles functions too.
 
10:22 PM
zend_compile_greater has a comment (what a concept) that it doesn't use binary op in order to ensure left-toright evaluation, which sounds like the thing we're trying to do.
What's a good place to find basic function calls?
 
Yep. You'll zend_compile_expr left and right.
 
For copy-pasta purposes.
 
Then do the function call.
Something that uses zend_compile_call_common
Trying to see which one is the best.
 
I can't really tell which of these are supposed to be AST interpreters and which are utility functions.
 
zend_compile_call_common is one of the utilities.
 
10:29 PM
Is there a way to tell the difference?
Other than the massive switch statement in zend_compile.h...
 
I think we want to look at the ast and compile code generated for a dynamic call like f()($a)
 
Hm, so I want to cannibalize zend_compile_dynamic_call?
 
that'd be the path for $invokable()
f() is compile_call, o->m() is zend_compile_method_call
 
So... I think $invokable is the closest equivalent here?
 
I don't know, I don't think expr looks right, but I don't have context, and I'm not sure
 
10:38 PM
Basically, the code expr |> $b should have roughly the same opcodes as $a = expr; $b($a)
Except, that a is a temporary and not a var.
 
Or more specifically, $ex1 |> $ex2 ==> $a = $ex1; ($ex2)($a)
Which I... think just doing zend_compile_expr() on left and right, then doing the call, will do correctly?
 
Right, but there are quite a few different kinds of calls.
 
Because of course there are. :-)
So does that mean I need to detect what kind of callable it is on the right? ('foo' vs [$o, 'm'] vs $foo, etc.) And then handle each differently?
 
No, that's why we need a dynamic one.
 
Would it make sense to structure the inputs correctly and then sub-call to zend_compile_dynamic_call(), or is that not a thing?
 
10:50 PM
function call(callable $f, $a) {
    $f($a);
}
^ This call to $f is probably what we want.
 
Will this approach then also give Xdebug a place to hook in, or does that require additional work as well?
 
Probably helps.
We still may need to leave that flag on the call, though.
 
It would help if these functions had docblocks...
 
Dunno if we can backup the line info on both sides somehow.
That's what I was asking Nikita about on the PR a week or more ago.
 
OK, I am going to assume this won't work, but maybe it will help form the right question:
void zend_compile_pipe(znode *result, zend_ast *ast) /* {{{ */
{
	zend_ast *left_ast = ast->child[0];
	zend_ast *right_ast = ast->child[1];
	znode left_node, right_node;

	zend_compile_expr(&left_node, left_ast);
	zend_compile_expr(&right_node, right_ast);

	zend_compile_dynamic_call(result, left_ast, right_ast);
}
/* }}} */
 
10:58 PM
You can inspect opcodes with phpdbpg -p* file.php
 
Hang on, I'm pretty sure I'll need to do a full rebuild for anything to have a hope of compiling enough to give me errors.
 
@Crell Definitel won't work ^_^
 
I expected it wouldn't be that simple... What about it won't work?
Is it even a viable angle to approach the problem from?
 
Nah, not really. You need to emit the same-ish opcodes as zend_compile_dynamic_call, but it's designed to consume an AST, and what you've got are compiled opcodes.
 
Hm, I should have used left_node and right_node. Though... if I were to give it AST nodes, wouldn't that give it what it wants?
 
11:05 PM
No, because the AST isn't an fcall of some sort.
Probably would just sigsegv or fail.
But, maybe. I didn't look at what asts it's being handed.
 
... So that approach would require taking right_ast and mutating it into a function call AST.
 
Yeah, don't do that.
 
:-)
 
diff --git a/Zend/zend_ast.h b/Zend/zend_ast.h
index 0e3468ebde..f274ed20d4 100644
--- a/Zend/zend_ast.h
+++ b/Zend/zend_ast.h
@@ -147,6 +147,7 @@ enum _zend_ast_kind {
 	ZEND_AST_MATCH,
 	ZEND_AST_MATCH_ARM,
 	ZEND_AST_NAMED_ARG,
+	ZEND_AST_PIPE,

 	/* 3 child nodes */
 	ZEND_AST_METHOD_CALL = 3 << ZEND_AST_NUM_CHILDREN_SHIFT,
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index dade906f4b..df90b28269 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5797,6 +5797,16 @@ void zend_compile_match(znode *result, zend_ast *ast)
and so on ...
<?php
echo "Hello"
    |> strlen;

echo "World"
    |> strrev
    |> strrev;
?>
 
Wait, huh?
 
11:09 PM
oh god, pretend I didn't say anything
 
Wait, huh?
 
nothing, I showed the guidance patch thing and then I just stopped talking
 
We need to emit zend_emit_op(NULL, ZEND_INIT_DYNAMIC_CALL, NULL, name_node); I think?
 
@JoeWatkins I am more confused now.
@LeviMorrison I... do not know what any of that means. :( I can extrapolate that it means, er, emit an opcode into the stream, but beyond that I have NFI what the arguments mean.
 
And then we need to use the same opcodes as zend_compile_call_common(result, args_ast, NULL); as a 1 arg call.
 
11:13 PM
zend_emit_op(znode *result, zend_uchar (or something) opcode, znode *op1, znode *op2);
that creates really ugly syntax, you don't really want a callable on the right ... parse it like I did, and add the extra cases ... you only want to use dynamic on the right when it's actually dynamic ...
you don't want |> 'strlen', you want |> strlen
 
Eventually, sure, but I wouldn't start with optimizations. He barely knows internals, baby steps :)
 
As long as it supports strlen, the return value of foo(), and $bar, I'm cool with it.
@LeviMorrison baby crawls at this point...
Well, right now I can successfully segfault...
@JoeWatkins The zend_compile_pipe function there is using name_ast without defining it.
So far what I'm learning is that php-src really, really hates invoking functions...
 
	zend_ast *name_ast = ast->child[1];
 
Oh! It did. I skipped past that line thinking it was the same as I already had.
And... that works. For everything except the AST printer (which I expected to be separate). So... you CAN compile an AST node into other AST nodes?
 
11:32 PM
Dur, although that approach has the same not-left-to-right-evaluation problem we were trying to avoid.
So, I think that just replicated the original all-lexer version, just with an AST node in the middle.
There's no way to do zend_compile_expr() on the left first, and then use that in the zend_ast_create() line, because by then it's no longer an AST.
I presume?
 
no I can't make sense of that ... the left being the result of the previous function call after the first pipe, I'm not sure if that can work
@Crell it's the difference between |> [$this, 'method'], and |> $this->method
 
I tested and $foo |> funcName still doesn't work this way. It gives the usual "not a constant" erro.
 
huh?
 
$res1 = 5 |> _test1 |> '_test2';
Fatal error: Uncaught Error: Undefined constant "_test1"
 
11:48 PM
Yes, please, that's what it should be.
No special casing symbols, please.
 
Then... I don't understand what you're saying.
 
Have you looked at opcodes from something similar yet? It would be really helpful to see the goal. The compiler takes in the AST, matches based on AST type, and compiles it into a series of opcodes.
If you know the sequence of opcodes you need to emit, it becomes easier to see what you need to do and to find examples of how of existing things do what you want, so you can see what functions to use to get the result.
 
3v4l.org/GpVDE/vld#output - I guess I am aiming for something kinda like that.
 
Yes, exactly.
Well, more like this: 3v4l.org/VZ8KA/vld#output.
One key difference though is that we aren't assigning variables (because no var exists) -- we'll just compile it to a temporary. I think zend_compile_expr will already do this for you.
Been a while since I looked at the details, so that exact part might be a bit off, sorry.
But we compile the lhs to a temporary, then compile the rhs, then use the result of the right-hand-size as the thing being passed to the INIT_DYNAMIC_CALL target, and the result of the LHS as the arg.
 

« first day (3906 days earlier)      last day (1036 days later) »