« first day (2755 days earlier)      last day (2208 days later) » 

2:00 PM
congrats @Danack \o/
 
bob, a signal handler has ucontext passed as third argument, and it has global and fp regs, should it therefore be possible to detect in a signal handler if the instruction that triggered the interrupt was add/sub, if not the next immediate, then at some offset to rip ?
dunno if I can read rip like that ? presumably there is something I can cast to unsigned char to get the next opcode ...
 
Something I've just discovered in Word, as long as I keep using headings as break-aways/headings for specific parts in my documentation, Word will create a table of contents in the Navigation pane. Pretty neat.
 
@DaveRandom thanks man. I will ask my sysadmin colleague to assist me a bit to check what's going on cuz i am really really really bad when it comes to understanding certs
i placed my cert on a very random location, perhaps i can try putting it in /etc/ssl/certs/ rather than /var/www/domain/keys ...
 
@FélixGagnon-Grenier Oh I looked further than that, I just thought it was funny to send :)
 
2:22 PM
@JoeWatkins you can do that … if you are able to decode it.
 
yeah I'm having some luck doing it ... I know what I'm looking for for x64, I think ...
and also advancing rip to skip past the thing I wanted to skip past when it returns ...
this is harder, I'm not exactly sure how far to jump ... trying to figure it out from disassembly ...
Program received signal SIGSEGV, Segmentation fault.
0x0000555555d3f6b4 in zend_gc_delref (p=0x7ffff387ee60)
    at /opt/src/php-src/Zend/zend_types.h:957
957		return --(p->refcount);
(gdb) disassemble
Dump of assembler code for function zend_gc_delref:
   0x0000555555d3f69f <+0>:	push   %rbp
   0x0000555555d3f6a0 <+1>:	mov    %rsp,%rbp
   0x0000555555d3f6a3 <+4>:	mov    %rdi,-0x8(%rbp)
   0x0000555555d3f6a7 <+8>:	mov    -0x8(%rbp),%rax
   0x0000555555d3f6ab <+12>:	mov    (%rax),%eax
   0x0000555555d3f6ad <+14>:	lea    -0x1(%rax),%edx
so I unprotect the memory in signal handler, do the delref, protect it again, mov refs into eax and advance rip to +29 ... or that's my current theory ...
Program received signal SIGSEGV, Segmentation fault.
0x0000555555d3f6b4 in zend_gc_delref (p=0x7ffff387ee60)
    at /opt/src/php-src/Zend/zend_types.h:957
957		return --(p->refcount);
(gdb) disassemble
Dump of assembler code for function zend_gc_delref:
   0x0000555555d3f69f <+0>:	push   %rbp
   0x0000555555d3f6a0 <+1>:	mov    %rsp,%rbp
   0x0000555555d3f6a3 <+4>:	mov    %rdi,-0x8(%rbp)
   0x0000555555d3f6a7 <+8>:	mov    -0x8(%rbp),%rax
   0x0000555555d3f6ab <+12>:	mov    (%rax),%eax
   0x0000555555d3f6ad <+14>:	lea    -0x1(%rax),%edx
 
2:37 PM
hi, __set_state() is something that we implement in an object ourselves?
this is not something "built in" / coming with an object (any object, lets say)
 
@PeeHaa almost 200k messages ;-)
 
@ten5 why do you want to use setstate?
 
I am learning php, I was doing var_export and I got to this
this is probably __set_state { //and we write the code here, within a class }
so it is magic, but we decide and create what goes into it?
 
@JoeWatkins sounds bit like x/y … you want to track the refcount changes, right?
 
As related to this - Note: When exporting an object, var_export() does not check whether __set_state() is implemented by the object's class, so re-importing such objects will fail, if __set_state() is not implemented. Particularly, this affects some internal classes. It is the responsibility of the programmer to verify that only objects will be re-imported, whose class implements __set_state().
 
2:41 PM
@FlorianMargaine ?
Did I miss something?
 
REimporting such objects? So it worked for the first time, and we doing it for the next time and it would not work, I dont fully get that yet, but this is the context, this is what I am wondering about
 
@PeeHaa 197k ^^^
 
oh god :)
 
@bwoebi yeah
 
2:42 PM
when EXPORTING var_export() does not check whether __set_state() is implemented, so RE-IMPORTING such objects will fail
 
I should rethink me life now :D
 
exporting, re-importing
 
Welcome @Danack
 
or a hundred thousand or so messages ago
 
anyway, this is what I am wondering about now, and I am a little tired, after like 9 days of a break :)
 
2:43 PM
:P
 
but going forward!!!
and "this particularly affects some internal classes", this exporting and re-importing thing
It is the responsibility of the programmer to verify that only objects will be re-imported, whose class implements __set_state().
:)
I've been trying to finish the Late Static Bindings page and I've gotten to this, like 2 levels down
and the Late Static Bindings are already like 2 levels down under what I was doing first
the call_user_func() :)
__set_state() - I've already read two good articles about it from the results of google.com
so this is not new
 
@ten5 why are you spamming again?
 
@ten5 "I am learning php". No you're not. You're reading the manual which only has a vague relevance to PHP.
 
@JoeWatkins yeah, either that or you install a breakpoint handler at the following instruction i.e.: sigsegv -> unprotect -> breakpoint at subsequent instr -> return -> breakpoint is hit -> re-protect, remove breakpoint
 
oh, that 15-year-old is back again (I assume that's what the ten5 meanse)
 
2:50 PM
1) __set_state() is something that we implement ourselves for every class 2) a class can have it or not
 
> and on another hand for some tools like PHP-CS-Fixer where compression is disabled they should by all means be excluded along with some unneeded composer related files :/
8 hours later
> I'm just sharing this information in case this might be a concern, not to say the composer.json should be included or excluded.
confused PH :P
 
@mega6382 Never forget
 
good morning
 
@JoeWatkins With breakpoint I mean 0xCC alias int 3
 
3) what does the "re-importing" mean; I mean we do var_export as the __set_state() is related do this, so what do we import or actually re-import
I guess I will ask on the site, it seems like it would make sense to ask there
 
2:52 PM
@ten5 No.
 
but this is basically the php.net, note - php.net/manual/en/language.oop5.magic.php#object.set-state
 
don't. It's not appropriate to just keep asking questions from going through the manual.
 
going through the manual is good, I value this
 
By all means do
 
Please just start trying to program something and just focus on what is actually useful knowledge in building that.
 
2:53 PM
but I wont be arguing about this here
 
But don't make us also go through it
 
Apr 19 at 18:04, by mega6382
@PeeHaa Please, make @ten5 stop.
 
@Danack - ok, I fully understand this point
 
@JoeWatkins at least that saves you from being overly reliant on what exactly is modifying that memory
 
I take seriously what people have been advising me here, and this was getting recommended from the day #1
the time for this will come, less theory, more practice
 
2:54 PM
@mega6382 He will just find another account again
 
Do you really John?
 
@DaveRandom apt install libcurl4-openssl-dev rather than libcurl4-nss-dev xD
 
:42366779 Stop reposting that over and over again.
 
@mega6382 the tiny avatar list is a powerful thing. you might try it.
 
wat?
 
3:01 PM
@mega6382 you should know the answers instead of bullying me ;)
 
@mega6382 click a username and use the bottom link in the popup
 
@PaulCrovella oh, ah, great thanks.
 
Good evening
 
I will be taking a break, thanks
 
\o
 
3:04 PM
When I am debugging my PHP script that creates a database and populates it from a .sql file, the database is created fine
However, when I do it over a local web page in /var/www/html/ it fails
Why would this be the case
Does it have anything to do with permissions?
 
That's a rather vague problem description
In general there will be error messages
 
@RonaldMunodawafa Can you post the code using pastebin?
 
@PaulCrovella until he shows up with another account, this is like the fourth or so
 
@RonaldMunodawafa Consider this. You call you garage and say: "My car won't start". Surely the garage can go on a guessing expedition, but it would get much better results if you explain the actual symptoms or even bring your car to the shop
 
@Tiffany and yet that link still has not stopped working
 
3:10 PM
@PaulCrovella I'm more annoyed about the using different accounts to dodge ignores. I mean, I get that he will have a question and will want to have as much exposure to the question as possible, but he hasn't taken any of the advice he's been given the several times he's been here. It just keeps going round and round and round...
 
I feel ya, it's not ideal. But it's what we got.
 
@PaulCrovella We also have a mod ban feature. Which should enacted on his IP or something.
 
The problem it creates is a newcomer comes in and asks a question, and may have similar mannerisms to him, and then we think it's him... but it ends up not being the same person... the ones who've engaged that newcomer are then seen as being rude because of it. We become jaded from it.
 
@mega6382 What if he's a world traveller and his ip change soften
@mega6382 Here is the gist of the problem gist.github.com/RonaldTinashe/6e390c053a23407865ebf2c071cc2e64
 
@RonaldMunodawafa He is first going to "read" the entire atlas before going anywhere so I don't think that will happen
4
 
3:14 PM
@RonaldMunodawafa That is why i also added "or something"
 
@mega6382 we ain't mods. if you want something more done you'll have to talk to them about it. what we have is the tiny avatar list, and it's surprisingly effective when used
 
When I debug setup.php with literals such as (localhost, user, pass), the database queries run successfully
When I add the web page, I just get the error returned by the setup_db function
 
@PaulCrovella You are right, but @MadaraUchiha have seen this behavior too, and he has banned this user a couple of times too(old accounts). I am just hoping there might be a more permanent solution.
 
It will tell you what is wrong
 
3:20 PM
o/
 
\o
 
2002 Permission Denied :/
 
@mega6382 c'mon.. let's not start banning people because they are annoying.. He won't listen to advice and is generally repetitive, but from that to banning someone.. at least he's always pretty much on topic
 
Thanks
I hate that on Linux the web directory by default is a root directory and not a user directory
It leads to permissions hell
 
Just saw this in the low quality queue i.stack.imgur.com/zU1A8.png
 
3:22 PM
what is the maximum number of decimal point precision in PHP, I can't find information on this anywhere online ...
Thanks in advance
 
@R1ddler Check you php ini
 
@pmmaga he used to spam, but he's cut back on that at least. Though, given the opportunity, I think he would still brain vomit.
 
@PeeHaa under what name is that in php.ini?
 
something something precision iirc
 
@Sara @JoeWatkins I'm sure you've seen this non-info site claiming PHP had "Allow for Arbitrary Code Execution", any truth to it?
 
3:24 PM
Also note. A big note. You are working with floats not decimals
Which depending on what you are trying to do may make a big difference
 
; The number of significant digits displayed in floating point numbers.
; http://php.net/precision
precision = 14 ?
 
I'm guessing the exif bug, and maybe the nul overwrite?
 
@Tiffany yep
 
@pmmaga Have you not seen the rants?
 
so ... isset() works with "AND" ... is there a same method type of function for "OR"?
or do I just write isset($a ?? $b ?? $c) <- this is not valid php?
 
3:26 PM
@Leigh Isn't that just listing all bugs closed in a release? :P
What a weird thing to do
 
Yea the site is dogshit, but the Arbitrary Code Execution is startling
 
@PeeHaa by decimals I meant decimal places. Thanks @PeeHaa @Tiffany
 
JUst know you are probably working with floats
 
because I am using this numphp library to compute regression and i was comparing the values with excel equations and I noticed slight differences
 
@Allenph Yeah.. But how is that grounds for banning?
 
3:32 PM
@pmmaga You are right to some extent. But he quite often spams too, and he uses multiple accounts. A couple of which have been banned. So, in a way he is trying to get around the restrictions, which is against the rules, obviously.
 
@mega6382 yeah, the multiple accounts is a good one.
 
@R1ddler Won't that use some specific extension instead of using floats?
 
There is no info in the docs on the precision on it numphp.readthedocs.io/en/latest
 
@tereško would this work? ( ( isset($var) ) || ( isset($othervar) ) )?
 
it would, but I was trying to cut down long if-statements
I think I will just define a function
 
3:38 PM
Sup
 
function has(array $array, ...$keys): bool
{
    foreach ($keys as $key) {
        if (isset($array[$key])) {
            return true;
        }
    }
    return false;
}
fuck it, good enough
 
@tereško Doesn't php have every?
 
@MadaraUchiha Of course not, not everything is as fancy as js.
:P
 
@mega6382 Well, there's array_map() and array_filter, so I dared to dream.
 
    protected function isValid($email) : bool {

        if (filter_var($email, FILTER_VALIDATE_EMAIL) == false) {
            throw new InvalidArgumentException("Invalid email address", $this::EMAIL_SYNTAX_INVALID);
        }

        else if (!$this->emailMXExists($email)) {
            throw new InvalidArgumentException("Invalid email address", $this::EMAIL_MX_NOT_FOUND);
        }
        return true;
    }
Seeking a bit of code review for a value object.
 
3:40 PM
@CoderDudeTwodee I wouldn't throw an exception here.
 
I would not
:P
 
It's a validation function, receiving invalid input isn't an exceptional situation, it's expected.
 
;)
:P
I still love you though
 
@MadaraUchiha I think that's actually what isset() does
 
3:42 PM
@tereško Hmm?
 
but I do not need for every value
I need "at least one"
 
some then
In JS it would have been something along the lines of
const has = (obj, ...keys) => keys.some(key => key in obj)
 
!!mdn some
 
[ Array.prototype.some() ] The some() method tests whether at least one element in the array passes the test implemented by the provided function.
 
Didn't know that was actually in the language
 
3:44 PM
[1,2,3].some(n => n > 2) // true
[1,2,3].some(n => n < 0) // false
 
@MadaraUchiha Erm it's being called from here
 
@PeeHaa Since ES5, at least 4 years.
 
public function __construct(string $email) {

    if ($this->isValid($email)) {
        $this->email = $email;
    }
}
 
@CoderDudeTwodee Your constructor might throw then? Oh boy.
 
As a vo that does some validation before putting it into the entity setter
 
3:45 PM
@CoderDudeTwodee But you never return false
It's either true or you throw
That condition will never not be met, it will either pass, or the whole thing explodes.
 
Oh shit.
I should make the ctor throw the exception.
 
I am a big, stupid doo-doo head. And my OO advice is generally to be avoided.
 
@MadaraUchiha So, not throwing any exceptions at all from the VO?
 
@CoderDudeTwodee When I code and consume somone else's objects
 
@MadaraUchiha so you would set an error message and display that to the user instead of an exception?
 
3:49 PM
I generally don't expect new Whatever() to throw
 
@MadaraUchiha Tell me what's wrong with a constructor throwing an InvalidArgumentException?
 
I do
I really do expect it to throw if the object couldn't be constructed
 
Hmm
That's fair, I guess.
 
@pmmaga Because he's asking the same question over an over again...a bad one.
 
I do
 
3:50 PM
@Izopi4a oh lol, so a very not-openssl problem :-P
 
And it's pretty much the essence of spam.
 
will put that one in the weird-edgecase bank
 
@DaveRandom Hey! I have a name you know!
 
@MadaraUchiha Woah, what?
 
@Allenph Nah, now that I get to think about it, I realize it was a moronic statement
 
3:51 PM
How do you validate scalar types in the constructor of a DTO?
 
@PeeHaa well sure, but I don't want to repeat it because of the whole end-of-days, fire-and-brimstone thing
 
:P
 
@MadaraUchiha ...wut?
 
@tereško how about without the loop? 3v4l.org/Vco30
 
it's literally the only way to bail out of a ctor
 
3:52 PM
@DaveRandom exit
/me ducks
 
@mega6382 that's the same loop, only less clear
 
@PeeHaa oh good point. brb rewriting entire codebase.
 
@PeeHaa Write the error to a file and pretend everything is OK.
 
can I skip the first part?
 
@tereško Magic of php, right.
 
3:53 PM
@MadaraUchiha I have to do this for an API import.
 
@PaulCrovella boostrap yoself
 
It makes me cringe every time I see a random logger call in my mapper.
 
wow 5 years ago
I wonder what Mr Desburg is up to these days
 
@DaveRandom Heh, back when I used to be called "Truth"
 
@DaveRandom Lusitanian?
 
3:55 PM
aye
 
@PeeHaa Don't you remember his mom?
 
I think he still does college. Not sure
college / uni whatever it's called
 
I think that's about the time he was leaving to go do that
 
It has books
 
[citation needed]
 
3:56 PM
:P
 
@MadaraUchiha That may be the most egotistical name I'm ever seen. Rofl.
 
@Allenph Like most of my names
It's from an anime
 
@MadaraUchiha I do but she is called miss desberg
 
I guess I can't really say anything.
 
:D
 
3:57 PM
@pmmaga using multiple accounts for the purpose of getting around a ban/ignore list.
 
I'm just glad I never had a stupid name
 
Repeating image background.
 
@PeeHaa But you do. <3 :P
 
@PeeHaa Well, at least I don't have an urban dictionary entry
 
3:57 PM
yeh @PooHaa
 
@Danack yup, mega also mentioned it. I stopped complaining about the complaints. :)
 
!!urban peehaa
 
[ PeeHaa ] A cowboy shouting peeee haaa! while peeing and swinging a lasso.
 
Anonymous
!!urban mega
 
4:01 PM
[ mega ] v. very, really, extremely. Sometimes used for more emphasis.
 
Anonymous
hello roomies
 
Does anyone have the low down on GPDR compliance since our European overlords have almost ended the honeymoon period?
 
@samayo yo, how have you been?
and where?
 
@Allenph oh its easy, you just block every IP range allocated to a European ISP and then call it done
 
Anonymous
@mega6382 In the same place and same situation as always, just feeling myself grow old
 
Anonymous
4:03 PM
how about you?
 
also throw a bunch of tea into the bay
 
Anonymous
@mega6382 I play games after work, are you into fornite?
 
@samayo I have not have had an opportunity to play games for a past few months. I am trying to set up a new gaming env.
But I have not yet played fortnite, I have heard a lot about it though.
 
@samayo after work? noob
 
Anonymous
@pmmaga lol ..
 
Anonymous
4:08 PM
I do my side projects while at work, so I can't play games
 
:D
 
Anonymous
@mega6382 let me know what your build is, I need to do the same
 
@DaveRandom Sounds like a plan to me.
 
Anonymous
@mega6382 I am noob at this, the first thing I looked at was the case, it's looks cool lol... but how much does all cost?
 
4:12 PM
@samayo My budget is around $1700/- and I have manged to set it all under that.
@samayo I too am a noob at this, I got quite a lot of help from a few forums and especially tereško.
 
@mega6382 16GB of RAM is fairly low
 
Anonymous
Yeah he game me some advice also, but I bought a Dell XPS 13, which is super nice for work but not as much for gaming. It runs Fortnite and Overwatch decently but you have to keep most of the texture below or around average
 
Anonymous
I ordered a cool keyboard and mouse for now though :)
 
Is it possible to run a .sql script from php?
 
Anonymous
yeah
 
4:21 PM
How Increase time in mysql `TIME` column?

I use this query ..but this query set my column time to `00:00:00`
 
I have been looking through the mysqli API and there doesn't seem to be anything I can find to do that
 
UPDATE orders SET want_time=DATE_ADD('$want_time', INTERVAL $hour HOUR) WHERE id=$order_id
UPDATE orders SET want_time=DATE_ADD('$want_time', INTERVAL $hour HOUR) WHERE id=$order_id
 
@RonaldMunodawafa What size script?
 
@Machavity 4,715 bytes
 
Help Please .......
 
4:28 PM
@RonaldMunodawafa You could always fopen it and parse it line by line to execute it
 
no one can help me?
 
Only the MySQL CLI can direct execute a SQL file AFAIK
 
@Mostafa stop
 
@PeeHaa HAMMERTIME!
2
 
Wow. Now I'm definitely not going to even attempt to help.
 
4:29 PM
@Machavity This is what I was fearing
@Machavity What does mysqli_multi_query if it does not execute all the queries
 
You could parse it as an almost as icky alternative to running an exec.
 
@PeeHaa OK but can you help me?
 
@PaulCrovella that's just a bandaid solution, it comes with a huge amount of visual debt in the form of having to look at Ron Paul and Sarah Palin's stupid faces centuries down the line
 
@RonaldMunodawafa You'd still have to parse the file first
 
@Mostafa No
 
4:38 PM
@Allenph seriously though, what's the nature of your application(s) and the data you keep?
like, a one sentence summary of each app
 
Anonymous
@Mostafa Ask for it on the main site, and if it doesn't get much traction, then link it here
 
@DaveRandom We have like 100 clients dude.
Anything from WP to custom code. Some of it good, some it egregious.
 
1
Q: How to Increment time by 15 minutes

ashwinbhyIn MySql database we have a column of type time and we need to increment the time by fifteen minutes in our php code. For example time is 09:45:00, it should become 10:00:00

 
@Allenph the main points are "don't keep any personal data longer than necessary", where "necessary" is subjective, not clearly defined and would need to be argued on a case-by-case basis if it even came to a point where it needed to be argued, "don't pass data to third parties without explicit opt-in consent" which is mostly just codifying and standardising laws that exist in several european countries already...
...and "don't use personal data for marketing purposes without explicit opt-in consent" which is (in my experience) the most problematic one, because people really don't like the idea of losing their cache of high-engagement targeted marketing data
I highly recommend outsourcing the problem to a compliance specialist, it will be much cheaper in the long run
and certainly much easier
at least, that is how my experience has been
I don't know if you have ever done PCI-DSS, but GDPR is very similar in the sense that a lot of it is very subjective, and the whole thing reads like the PDF/A spec, i.e. like it was written by 200+ people, none of whom fully understood the problem domain and all of whom had very important opinions, they produced a spec that was very fluffy and then gave it to a lawyer to obfuscate into legalese
@Machavity just go take a dump, works every time
 
/* zend_gc_delref %rip - 7 lea */
		if (*(((unsigned char*)context->uc_mcontext.gregs[REG_RIP]) - 7) == 0x8d) {
			uint32_t refs;

			mprotect(
				page,
				php_uref_pagesize,
				PROT_READ|PROT_WRITE|PROT_EXEC);

			asm volatile ("mov $1, %0"
				: "=r" (refs)
				: "r" (context->uc_mcontext.gregs[REG_RDX]));

			asm volatile ("mov %0, (%1)"
				: /* nothing */
				: "r" (context->uc_mcontext.gregs[REG_RDX]),
				  "r" (context->uc_mcontext.gregs[REG_RAX]));
			asm volatile ("mov -8(%0), %1"
				: /* nothing */
@bwoebi for that one single case, that works ... but might have to use the int trick for every other case (except addref, maybe)
I've never heard of the debugger thing before, can you point me at some info maybe ?
the problem is going to be that you can't just set the break for the next instruction ... the next instruction might still have a protected address in register ... I'm not sure how complicated that gets ...
 
oh it's him, I've read a lot of his stuff lately ...
 
@JoeWatkins dunno, just googled something quickly explaining it not too badly
 

« first day (2755 days earlier)      last day (2208 days later) »