I have one git situation- My feature branch (A) is merged to master and deployed I pushed that feature branch (A) changes into another ticket branch (B) and deleted my branch A from local and remote. Now when I tried to merge that branch B into master then I am getting a conflict issue.
most likely you have two versions of the commits from the first feature: the ones that got merged into master, and the ones that got merged into branch B; since git doesn't know that they're the same changes, you get a conflict when merging them together
Hi all! I'm having a very weird segfault with PHP 7.4.16/XDebug 3.0.4 that only happens when XDebug is enabled. It happens deep inside Doctrine ODM and, as far as I can tell, exactly during a function call to HydratorFactory::hydrate(). I'll try to upload the GDB stack trace. Does anybody have an idea about how to continue from here?
@cmb I thought a long header values can be split onto multiple lines with a CRLF followed by a single space... in the example you gave, the input contains 2 spaces, where the output only contains 1 space because the [\r][\n][ ] is removed during the un-folding process.
@CraigFrancis you want two kinds of benchmark for this, you want a micro bench sort of test, specifically written to test the impact of the changes on code not taking advantage of the changes ... if you identify anything terrible there, there's room for improvement (cost of complexity) ... and then you want a "wordpress" like benchmark, could be a symfony thing or whatever, but some "real world" app ...
what we're really looking for in an initial implementation is something that works and is tested, the fine details of optimizing the thing if it passes will fall to dmitry anyway
if you're going to include this information in an rfc, make sure the benchmark you took is repeatable ... make sure you do it in production like environment (with o+, warm cache, and so on for the app test)
@JoeWatkins Thanks, will be getting back to that in a bit... I've also found a small oddity with the ZEND_VM_HANDLER ZEND_CONCAT bit... where it's appending a non-literal to a literal... I think I've got it working with a if (Z_IS_LITERAL_P(op1) && !Z_IS_LITERAL_P(op2)) test, that removes the flag.
@CraigFrancis oh if you include test cases you can't get to pass, ping me, and I'll have a look ... it's possible we could be more precise when we output opcodes and have a specific ZEND_CONCAT_LITERAL handler ... but then you'd also want matching rope behaviour, and then it starts to get complex ... I'd like to avoid specific handlers if the perf isn't terrible in other words ...
Does anyone have much experience with Psalm? I'm just trying to get to grips with it and am looking for a way to specify dynamic narrowed types on an existing class that uses __get.
oh, and I don't think this is related, but micro_bench.php has a test that does the ever so useful $x = $_GET; and that seemed to cause a perf issue (0.071 to 0.092... as in +0.021).
@CraigFrancis well, apparently all whitespace are collapsed into a single space: 3v4l.org/ATLeA. That doesn't look right to me. Also, a single space is not removed: 3v4l.org/I5ZnQ; that's what I would have expected.
(all the other micro_bench.php tests, which don't really touch concat, were either the same, very slightly slower... or oddly, a bit faster, which I really don't understand).
I have a nicely reproducible segfault on PHP 8.0.3 when doing new ReflectionClass($specificClassNameThatCrashesEverySingleTime). Is there any guide for a noob to point out the bug in PHP source code?
@cmb Huh, you're right... I was sure it was more strict (I've just found some old email parsing code that uses ltrim() for the multi-line headers, rather than iconv_mime_decode or mb_decode_mimeheader)... that said, what emails contain is often a mess... so that behaviour is probably related to lines ideally being less than 78 characters, but still being allowed up to 998 characters?
I don't think this has anything to do with the line length for iconv (haven't looked into mbstring). Actually, this is about bugs.php.net/bug.php?id=80259, where the fix would be trivial, but would no longer collapse the whitespace after CRLF. I guess I should stick with the collapsing, at least for BC reasons.
Yep, agreed... and I wish the RFC's I've been checking were more clear on exactly how the unfolding process works... "Unfolding is accomplished by simply removing any CRLF that is immediately followed by WSP"... where WSP = "the white space characters" (Space, ASCII 32; and a normal Horizontal Tab, ASCII 9)... and I'm sure I've seen it be more than a single white-space character (hence the ltrim).
Alright, I recompiled PHP with debug symbols and now I can't reproduce it anymore. I might recompile it without debug symbols, it might still not be reproducible and the problem is going to be in the binary provided by Homebrew. It might make sense because I'm the only one on the team for whom it segfaults.
if interested, zend_jit_op_array + 473 is the addressof instruction pointer, and you see a partial disassembly of rip (+ a few instr) ... that's normally enough to tell whereabouts you are in code ... but not for someone who started using gdb/lldb 15 minutes ago
okay well I'd probably just open the bug report with as much info as you have at this point ...
if you wanted to try and find out where in code you are, you would have to find an executor frame in the stack to get access to the call frame, and read from it to determine where you are in php code
My details are: there's a foreach loop that creates a lot of "new ReflectionClass()" and it always segfaults with a specific one. When I skip that one it segfaults after some time with a different one (but not the immediate one). There's nothing special about those classes. The number of looped classes is in 1000s.
Not sure if this is actionable, probably not.
If I move new ReflectionClass($theCrashingOne) above the foreach, it doesn't crash, so something gets corrupted in a previous loop iteration.
@IluTov It's Slevomat's codebase, around 10k files, I probably can't reproduce it on a smaller scale. And yes, I'm sure, I've checked php -i afterwards.
Good morning folks, I can't seem to override the function handler for a userland-defined function, trying to use this technique - phpinternalsbook.com/php7/extensions_design/… - but I'm wondering if it won't work for userland stuff for some reason? Exerpt from my code here: gist.github.com/asgrim/2ffec166dfc4c1af9b21ae94f7100a8a - it isn't erroring , just the custom handler is never executed. Please send halp :)
@Asgrim No, that will definitely not work for a userland function as-is. It MIGHT work if you flip original->internal_function.type = ZEND_INTERNAL_FUNCTION; But I'm willing to bet there will be a nice little surprise hiding in there...
I did do this years ago for runkit_function_redefine(), so I'd look at that implementation and strip out the runtime volatile bits of it.
In that example, it's internal for internal, but in what you're doing, you're replacing a userland function, so original_handler_var_dump = original->internal_function.handler; isn't going to give you a useful way to call the old implementation, btw
Your best bet is to replace the zend_function entry in the table entirely, and use something in the zend_call_function() chain to induce your old function to run.
@NikiC sure, I'm trying to record when a function call started/stopped, figured the basics for internal functions, but I'm trying to figure out how to do the same for userland-defined stuff. For the scoutapm extension
I think that was my previous implementation (using zend_execute_ex) but we're only really interested in a small subset of functions (mainly IO-bound stuff), rather than everything :/
@NikiC yeah reading the transcript from Derick's podcast on it, definitely looks like what I need, but PHP 8 only. Maybe I can do both since I think they'll still want to support 7.1 through 7.4
> The Reciprocal Public License (RPL) is based on the concept of reciprocity or, if you prefer, fairness.
This doesn't look like the kind of language I expect in a license.
@Asgrim Good luck, mate. PHP 7 is actually worse than PHP 5 because the zend_execute_ex is more likely to overflow in PHP 7 because we stopped having things that turned it on by default in the ecosystem.
But yeah, for PHP 7 your main options are zend_execute_ex which is straightforward but will cause a stack overflow if the code goes too deep, or using opcode handlers, which sucks.
There are other options for completeness: 1. AST process hook 2. Doing something at compile-time with `zend_extension.op_array_handler` Using the zend_extension.fcall_begin_handler and end handler is also an option, but can incur quite a bit of overhead, so people typically don't use them for anything anymore.
If you want to be low overhead, eventually you will have to figure out how to do some things during compile time and rely on opcache. I have only experimented with these things, because at the time our overhead was high enough I had lower hanging fruit.
@IMSoP, tip for the bug tracker: if add a comment to bug #54321 with bug #12345, the 12345 ticket automatically gets a Related to: bug #54321 comment. That can be useful.
I like being able to have multiple replacements there (a la: foo(?, 123, ?) ) but I do which I could number them so they could apply out of order. $x = foo(?2, 123, ?1); $x(4, 5); -> foo(5, 123, 4);
I'm not sure what using ? instead of $ gets us, but... /shrug
.NET just got merged github.com/dotnet/runtime/pull/50980 DateOnly and TimeOnly types would it be reasonable to propose similar for PHP which in fact could be a built in type reflecting DB types the DATE and TIME (MariaDB, MySQL, PostgreSQL and others) ?
We don't have that debt as VB and could propose simple class names Date and Time, interesting could be overloaded operators in DateTime vs Date comparisons
not saying that's a bad thing, but it's not like they'd share a bunch of logic we already have or anything; maybe some of the formatting routines could be kind of kludged in?
yeah, at least the Jewish calendar's year zero is very different from the Christian one
(the mug is Thai, in case you're wondering)
@brzuchal only because the database doesn't have as rich a type system; the intention of the user is to store an instant in time, and then display it in a way meaningful to their users
I've certainly had use cases for some of those extra types; in the travel industry, an annoying amount of things are expressed in "local time" without an explicit time zone
I don't want to be the one responsible for getting the API wrong though :P
@DaveRandom slightly more maturely, but still off-topic, here's a rather comprehensively humiliating criticism of someone reviewing 'The Nostalgia Critic and The Wall', which includes a line I'm thinking about as the basis for a lightning talk "Certain things are going to take all week, no matter how half you ass them."
I'm just saying, "your flight lands at 10:30 local time" is a perfectly reasonable sentence; an API that says that doesn't need converting to read it, the "10:30" is all you're supposed to care about
but, yes, I'd love it if the industry switched to storing and sending timezone info
because sometimes, it does matter
realistically, though, I've got more chance of building systems that can represent "I don't know the timezone" than I have of changing the habits of 60-year-old multi-nationals
I once had the opposite: the API sent timezone information, but only because that's what their formatter spat out; the actual times were local wall-clock time
of course, I didn't discover this until after we'd imported several thousand bookings
"yeah, ignore the booleans in column 5; if you need to know that, look at whether the reference in column 2 ends 'FC', and whether there's a different row with the same reference without 'FC'; except if column 3 contains this value..."
@Danack Something that's a little annoying. class_alias resolves the original class immediately. Unfortunately this means declarations would become order dependent. Is that fine?
in fact, UTF-8 is only more compact for characters that are in ASCII, which is why I said it's just a hack to work with that; for anything else, UTF-16 either takes exactly the same width, or less
it's not like the fourth byte was added to the UTF-8 spec later; if anything, it's the other way around, because it was originally going to be possible to have six-byte sequences
I'm currently listening to a talk by someone who works for AWS. Any improvements on:
> It's great that AWS is building really powerful deployment environments based on open source software. To make this sustainable, where can open source projects apply for funding/sponsoring from AWS?