« first day (2850 days earlier)      last day (2323 days later) » 

00:21
so I made t His
PHP Parse error: syntax error, unexpected '&' – #76707
01:11
@PeeHaa Watching these 30 ton cruise ship propellers being fabricated in Netherlands.
 
2 hours later…
03:11
Night all
Wes
Wes
\o
 
2 hours later…
05:38
morns
05:52
mb_detect_encoding behaves inconsistenly depending on the argument type – #76708
 
2 hours later…
Wes
Wes
07:46
@DaveRandom yes but it's not a lsp violation
public function method(); accepts any parameters
method($a = null) also accept any parameters, and they are all optional like the one above
then going back to method() should give no errors... they are literally the same thing
@kelunik explained this to me once... it's not a lsp violation, it has to do more with how php checks signature compatibility
@Wes It should at least be consistent. It should probably be an error in both cases.
Wes
Wes
the bug request is "should be a warning"
because sometimes it's a warning, other times it's a fatal error
Should be a fatal error probably, because otherwise this is possible: 3v4l.org/94Lqc
Wes
Wes
this is possible how? of course that should be disallowed
class Foo {
    public function method(X|NULL $arg = null) {

    }
}

class Bar extends Foo {
    public function method() { // mixed $arg = null

    }
}

class Baz extends Bar {
    public function method(Y $arg = null) { // error, must be mixed $arg = null

    }
}
08:02
Something unexpected went wrong with the WOTD service: Allowed transfer timeout exceeded: 120000 ms
vespine of or relating to wasps.
Wes
Wes
assuming mixed includes null
i mean i get why php would reject that, optional parameters are a bitch. but from a purely LSP point of view all the signatures are compatible
08:31
@Wes Because we only check the signature of the parent for compat, because we assume it's compatible, because the parent is compatible to its parent.
Wes
Wes
we had this discussion already, remember? :B
I remember something, but not whether it was that specific case.
Wes
Wes
php just needs to pretend that
public function method()
was actually written as
public function method(mixed $arg = null)
so that derived classes can do the check themselves as well
although not worth doing
i would rather have non optional parameters. i am really not into that kind of stuff
 
2 hours later…
11:05
hi , how to use preg_split to break the json after ,

]
}
},
"responseMetadata" : {
i need array[0] till the last }
and array[1] to be ,
"responseMetadata" : {
11:23
@Srinivas08 If you have a properly formed JSON string, why not use the native tools to work with JSON? Namely, json_decode
Wes
Wes
11:39
\o
12:34
o/
evenin
Upgrade from PHP 5.3 to 7.2 complete. \o/
@kelunik Ooph, congrats, sounds rough
12:49
@kelunik congrats
@MadaraUchiha It was an old Mediawiki. After the Mediawiki upgrade and one deleted line, everything seems to run smooth.
I'm still working through that ;_;
@kelunik Wow, and they say miracles don't exist...
The one deleted line was in a custom skin, setting $title = $wgUser->getSkin()->getTitle(), which was entirely unused. :D
@kelunik Why did that cause an issue? Because of the new version of MediaWiki?
12:55
@MadaraUchiha Yes, they removed getSkin() on $wgUser.
Before the upgrade of the Mediawiki version I got a lot of PHP Warning: Parameter 1 to Class::method() expected to be a reference, value given warnings.
Wes
Wes
13:09
\o
bob
bob
I've set up homestead with a trusted https on my localhost, https://site.test:44300/ so when I go to this address I get 403 Forbidden error. however if i got to https://site.test:44300/public/ then It displays the site. Now here is what's strange in the the homestead.yamal file it's mapped to the public directory.. anyone know what issue this is?
14:08
check access log?
if it's a forbidden error, it should be logged
@Tiffany But in every iteration, $key gets reset
@MadaraUchiha ahhh
@MadaraUchiha and yet... 3v4l.org/OirrJ
@FlorianMargaine wouldn't it get reset at the beginning of the foreach?
@FlorianMargaine I'm kind of vexed that $key exists outside the loop
14:19
^ that's true, didn't think about that
But yeah, like I said, it would be reset on the next iteration
Since that was the last iteration, $key remains as is
@FlorianMargaine 3v4l.org/5C8oR
vOv
@MadaraUchiha that's my point, yes
@MadaraUchiha no, it gets overwritten.
@mega6382 Yes, that is what I meant
14:27
@mega6382 I think that's a nominee for Pedantic Comment Of The Day :P
lol :P
Pedantic Comment of the Day (which is pedantic too)
honestly I'm not sure it's even correct
"reset" is probably correct too
// About equivalent to

$key = NULL;
$value = NULL;
foreach ($whatever as $_key => $_value) {
  $key = $_key;
  $value = $_value;
  // You only have access to $key and $value, not the undescored versions

  // Your code here
}
very clear and concise code
14:29
after building that in 3v4l, and starting to include it into my file, I realized I should be reading the files from the directory instead of manually assigning their paths
Wes
Wes
14:45
?
@PeeHaa I did. Y'know what else I realized? I really need to 3d-print a pip-boy, put my raspberry pi in and kill it at comic con.
people got there already though thingiverse.com/thing:1313387
mr5
mr5
15:21
o/
How do I prevent PHP from making my long values like this: 1.302014111737E+17
the last 4 digits gets demoted to zero
@mr5 can you elaborate on how/where you are seeing that?
mr5
mr5
I can see in the manual that this is expected behavior in floating numbers but, does type long gets the same treatment as float?
I'm losing precision of value
<?php
var_dump(13020141117371234); // int(13020141117371234)
mr5
mr5
I got different result
maybe it depends on PHP version?
!!> var_dump(13020141117371234);
Does grades matter in I.T industry ?
mr5
mr5
This is what I am seeing in my database
what is the column type?
mr5
mr5
1.302014111737E+17 this is what I got when I print it
well, if we can trust the display in your database, the loss of precisison already happened, so php would print that when receiving it from the db
mr5
mr5
15:35
bigint(45)
@FélixGagnon-Grenier I printed the value before inserting it
just to get this clear: you print it before inserting it, and it's already less precise. At what moment are you printing it with correct precision?
@mr5 I have no idea what you are asking. Perhaps read sscce.org make an example, then ask again.
mr5
mr5
I am getting it from a POST request.
I store it in a JSON format. Maybe it's connected to how I parsed it?
@FélixGagnon-Grenier it doesn't get the correct precision
Please heed Danack's advice
!!> $json_long = '{"long": "13020141117371234"}'; var_dump(json_decode($json_long));
15:40
[ 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0beta1 ] object(stdClass)#1 (1) { ["long"]=> string(17) "13020141117371234" }
assuming I did it right
mr5
mr5
// example POST request
//
// [{"salesid":130201411173700750}]
//
//

// PHP code
$payments = json_decode(stripslashes(html_entity_decode(rtrim($jsonString, '\0'))), true);
$values = '';
foreach ($payments as $key => $value) {
	$value = (object)$value;
	if ($values != '') {
		$values .= ',';
	}
	printResponse(false, "sales id: $value->salesid");
	exit;
	//more code omitted...
}
> Notice: Undefined variable: jsonString in /in/21rOq on line 11
> Self Contained
It is important to ensure that the code given to others can be 'copied, pasted, compiled, run' so that they can help quickly and with a minimum of fuss.

This means that after the code has been copied, pasted and compiled by those helping, they can run it and see the results for themselves. It is the example of the problem.

You are much more likely to receive help if you do this.
$jsonString = [{"salesid":130201411173700750}];
I think?
the objective being that we don't have to guess :)
mr5
mr5
15:44
Oh I forgot the $jsonString
@mr5 yeah, I can reproduce it
mr5
mr5
// example POST request
//
// [{"salesid":130201411173700750}]
//
//
$jsonString = '[{"salesid":130201411173700750}]';
// PHP code
$payments = json_decode(stripslashes(html_entity_decode(rtrim($jsonString, '\0'))), true);
$values = '';
foreach ($payments as $key => $value) {
	$value = (object)$value;
	if ($values != '') {
		$values .= ',';
	}
	printResponse(false, "sales id: $value->salesid");
	exit;
	//more code omitted...
}

function printResponse($success, $data, $totalCount = 0) {
	header('Content-Type: application/json;charset=UTF-8');
mr5
mr5
I hope you can compile it now
@mr5 btw, you should use gist or something, instead of posting a big block of code
15:46
It indeed runs successfully this time!
@Danack Where did you quote that from? I may want to {put|link to} that into my GitHub issue template(s).
I can't reproduce however, this is what I get:
> {"success":false,"data":"sales id: 130201411173700750","totalCount":0}
@mr5 not able to reproduce via this
@SebastianBergmann sscce.org
15:47
@Danack Thanks!
It is apparently a difficult concept that is not taught as part of compsci courses...
mr5
mr5
hmm something is not right with my php
If you mean, the code you posted doesn't do what you said it does.....
I don't know how exactly (or even if) it applies, but is this not the kind of things we could observe when comparing 64bit vs 32bit version?
mr5
mr5
Yeah it didn't. I am losing precision in my long value there
15:52
@mr5 this is because, you are probably using 32 bit version of php, and the PHP_INT_MAX is lower than that of 3v4l, which is using 64 bit php version.
So, the problem you are facing is called, integer overloading
mr5
mr5
@mega6382 is PHP version 5.6.24 very old?
@mr5 depends on who you ask.
@mr5 the version isn't the issue, it is apparently that you're running it on a 32bit machine, but then trying to process numbers higher than it can cope with.
Although that shouldn't be your issue, as I said in C#, PHP's stupid handling of overflowing integers makes me think it's overflowing to a float, and it's not storing as a long at all
mr5
mr5
15:55
Okay. So what I can do now? Can this be solved my converting it to a string or something?
Tldr use 64-bit and it should work
It's time for the second coffee.
@mega6382 lol, I meant integer overflowing :P
mr5
mr5
Use a 64 bit PHP version?
@mr5 yes
15:56
@mr5 that could also work.
mr5
mr5
What if I can't do that?
You can
but it might need doing before the json decode, which might be hard.
mr5
mr5
I have no root access to the computer
If you somehow can't then there's much bigger issues than this issue
mr5
mr5
15:57
@Danack Yeah. I have no idea what conversion is that code does. Does it respect types at all?
Or does it convert all the data into string
Json doesn't store types
@LeeButler Not having root access is not a problem. There are countless valid situations where one does not have root access.
mr5
mr5
I mean, after type casting it
@FélixGagnon-Grenier Root access isn't the issue, its the 32-bit php which is
... I know. I literally said it first.
I was answering to your comment. You can see what comment I answer to when hovering over mine.
15:59
Yeah and that comment wasn't anything to do with root access
I see.
I thought it answered the one just above it.
@FélixGagnon-Grenier If it is due to sysadmin not allowing root access, than he should ask the sysadmin to upgrade it. But if it is because he is on shared hosting, then that is a real issue.
Nah I didn't even see the root access one until I sent it. It was a follow up to my previous message
@FélixGagnon-Grenier I thought I said it first, :P
mr5
mr5
So the best thing to do right now is just upgrade this to the 64 bit version right?
16:00
... no wait a sec, its you :D
5.6.24 is over 2 years old
I'd recommend upgrading to x64 5.6.37
mr5
mr5
Why can't I find this in the manual
mr5
mr5
If someone knows already the issue it's easy to find. But searching for lose of precision would not get me anywhere though
Just tell us, are you running x86 PHP?
If yes: That's your problem
mr5
mr5
16:04
How do I check>?
Run phpinfo()?
@mr5 try php -v command in cli
mr5
mr5
I'm sorry it's on another computer.
no ssh?
mr5
mr5
I'm going to upload new script
yeah no ssh :(
16:06
are you on shared hosting??
@mr5 JSON_BIGINT_AS_STRING might be your friend in this case: php.net/manual/en/function.json-decode.php But in general you really ought to move to 64bit php.
Run that and check the Architecture section in the first info block
mr5
mr5
I'm not sure. The client just throws me this FTP details.
@mr5 then try<?php echo phpinfo();
> the client
mr5
mr5
16:07
Printing PHP_INT_SIZE I get 4
So it's 32bit right?
print PHP_INT_MAX
mr5
mr5
@LeeButler just a side project :)
PHP_INT_SIZE is enough according here
So yeah. I'll wait for my client's upgrade
@Danack uhm is this a decoder?
@mr5 is json_decode a decoder? Yes. The issue is that the int you are being passed is to big to be handled as an int in PHP 32bit. Forcing it to be a string instead allows it to be 'handled', but just not as an int.
mr5
mr5
@LeeButler PHP_INT_SIZE: 2147483647
It's 32bit
mr5
mr5
16:12
@Danack do you think I would get into trouble using this method?
You can't reliably do what you're trying to do on 32-bit php (without additional libraries)
@mr5 for 64bit, it should be like 9223372036854775807
mr5
mr5
@mega6382 that's a lot of difference
@mr5 It's 32 bits of difference
mr5
mr5
Okay. Thank you guys for helping. I guess I'm already done debugging tonight
!!> var_dump(PHP_INT_MAX);
Sorry for the intrusion guys, I'll take him around the back of the barn now...
mr5
mr5
goes back to barn
jeez. there's lots of walkers there
16:44
Best way to read .XLSX file in PHP ? Pls suggest
@Srinivas08 github.com/PHPOffice/PhpSpreadsheet probably. Though depending on the size, a completely separate program written in Java using the apache office libraries is not an insane choice.
17:00
Good day
@Wes started watching TNG a few days ago
 
1 hour later…
18:13
!!xkcd 695
18:35
One of my goals when being the interviewee is seeing how they react to me saying "I don't know." I really don't want to work with someone who can't hear those words. https://twitter.com/jt_grimes/status/1025520205374484483
Something we are all too afraid to say in an interview, thinking that we would look dumb or something.
And I like how deep the quoted tweets go(or whatever that's called, I don't use twitter much) :P
19:07
Yay .. the forth paid question just asked in my website .. I feel good :-)
@tereško Noted that, your share is about 1$ by now :-)
@Shafizadeh now, if I answer will i get paid? :P
@Shafizadeh it says 3000 tomans, how much is that?
:D ..! you will .. just you need a Iranian bank card
@mega6382 it's the amount that the responder will get. The actual devoted amount is 5000 tomans
ok, but i meant how much, like when converted to usd.
oh .. it is nothing in dollar. it is about 0.5$
exactly 0.7$
hmmm
19:48
Congrats ^^
thx :-)
20:21
!!dad
I've deleted the phone numbers of all the Germans I know from my mobile phone. Now it's Hans free.
 
1 hour later…
Wes
Wes
21:35
\o
@Tiffany did you develop worf mania yet?
@Wes ?
what time do you go to bed? did you just wake up? o_O
Wes
Wes
it's hot during the day so i sleep during the day
i am on vacation
also i am a vampire
ah it's 5 august
22:16
@GabrielCaruso I'm tempted to say no, just to spite the person that opened that 'bug' report.
@Danack Although he was stupid, make it consistent to ZPP failures sound like a good idea to me
Yep.
@Danack he must be fun at parties
22:34
@Tiffany I'm not sure a guy who necks a bottle of vodka then tries to pick a fight with someone bigger than them before passing out drunk in the garden is my idea of fun.
22:53
@Danack met him in person?

« first day (2850 days earlier)      last day (2323 days later) »