« first day (2905 days earlier)      last day (2268 days later) » 
01:00 - 20:0020:00 - 00:00

01:23
@bwoebi Something like:
--TEST--
Using parent does not create compile-time warnings
--FILE--
<?php

trait P {
	public function m(parent $arg): parent {
		return $arg;
	}
}

class A {}

class B extends A {
	use P;
}

$b = new B();
$a = $b->m(new A());

print "OK\n";

?>
--EXPECT--
OK
Do I need to add --INI-- and ensure that E_ALL and error reporting are set?
Wes
Wes
01:35
why is max line length in psr 80, rather than 92 like the rest of the world?
Uh, Python's is 79.
80ish is very common, mate.
Wes
Wes
79? lol
that's the offset, not the length? :B
it is very common but looks like 92 is more common... are them arbitrary though?
or is there a reason, like the old 80 columns displays of the '80s
 
1 hour later…
03:06
this is php chat
What makes this statement unique?
<?=echo 1;?>
 
1 hour later…
04:23
that would throw an error wouldn't it? <?=echo it's like saying echo echo
as for the pasta thing, it sorta makes sense, that it's technically braided. Braided strings aka rope is much stronger than a bunch of strings in parralel.
04:47
posted on September 21, 2018

News will be more than 14 minutes late.

05:19
Night
 
1 hour later…
06:40
hi all! I use medoo db library which uses a pdo connection. I have Auryn injector sharing medoo instance. I want to use Delight authentication which constructor accepts a pdo connection. I can get that pdo from Medoo db (it has a method for this)...but in the last instance...would I end with 2 db conn? Ty!
how to call javascript function inside php code
<script>myfunction();</script>
<input <?php if(isset($results)){ echo 'checked'; } ?> type="radio"/>
I mean...I have Auryn sharing $medoo_db object. If I construct something like $auth = new \Delight\Auth\Auth($medoo_db->pdo())
i tried this but it does not works
<input <?php if(isset($results)){ echo 'checked'; echo "<script>myfunction();</script>"; } ?> type="radio"/>
will be shared the conn?
@hearthacker hi! js code is rendered in the document. You can manipulate that render with php. Like: php is the pencil writing the document (including js) then, the document will be rendered and js executed as it was writen by php
07:05
morns
 
2 hours later…
08:52
morning
@Wes have nothing to do with neutron star but while watching this video and come across some of delicious food names... i am feeling more hungry than insightful now :D
09:32
mornin
 
1 hour later…
10:34
Morgen
Sam
Sam
hello
Morning.
Sam
Sam
Anyone here familiar with JWT auth?
11:02
this my codeigniter controller
$plant_name = $this->login_model->get_plant_name($fact_name);
echo json_encode($plant_name);
In my view file contains ajax response.
success: function(data)
{console.log(data);}
when i print this console.log(data) it displays as the following
[{"id":"18","name":"Nelcast","plant":"Plant1"}
,{"id":"19","name":"Nelcast","plant":"Plant2"}]
but i want to store it into as a php array.
11:30
Does get_plant_name return an object or an array?
can i ask mysql question over her e
?
Don't ask to ask, just ask. If someone can help they will.
@Tpojka get_plant_name it returns array
Print out console.log(JSON.parse(data)) to check structure. For now it is string passed from PHP.
11:46
@Tpojka then people start like this is not mysql group go get loss noob junior developer etc etc
i want to get the updated record from multiple row regarding update datetime column in multiple join
@Tpojka on discord there are few developers i asked them php question in laravel community they treat me like hell bro i leave that group because of their behavior
@Tpojka when i print this console.log(JSON.parse(data))
it displays as the following
0: {plant_id: "18", factory_name: "Nelcast", plant_name: "Plant1"}
1: {plant_id: "19", factory_name: "Nelcast", plant_name: "Plant2"}
@Noni I am pretty mighty but can't change the world immediately.
@hearthacker What says of type, is that an array in console?
in a github project , i found this line of code :
$request = HTTP::create($url);

is it any library ?
also this :
use rdx\http\HTTP;
Did you think about googling "rdx\http\HTTP"?
no , i google this thing : $request = HTTP::create($url);
but could get satisfactory answers
11:52
You googled wrong
hmmm
will google rdx thing
when i print_r($prime_array);
the following displays
Array ( [0] => Array ( [plant_id] => 18
[factory_name] => Nelcast
[plant_name] => Plant1
[plant_address] => aaaaa
[1] => Array ( [plant_id] => 19
[factory_name] => Nelcast
[plant_name] => Plant2
[plant_address] => bbbb )))
but when i pass into foreach
error occurs like this (Message: Invalid argument supplied for foreach())
how to print the plant_name and plant_address from this array
foreach($prime_array as $k => $v) {echo $v['plant_name'], ' ', $v['plant_address'], "\n";}

This wouldn't work?
again same error occur Message: Invalid argument supplied for foreach())
SELECT a.cl
FROM test1 AS t1
JOIN ( psotid. MAX(DATE) FROM testtable ) tt ON tt.userid = t.userid
column tt is undefined error mysql 5.5
12:07
hi all! I use medoo db library which uses a pdo connection. I have Auryn injector sharing medoo instance. I want to use Delight authentication which constructor accepts a pdo connection. I can get that pdo from Medoo db (it has a method for this)...but in the last instance...would I end with 2 db conn? Ty!
SELECT t1.cl
FROM test1 AS t1
JOIN ( psotid. MAX(DATE) FROM testtable ) tt ON tt.userid = t.userid
I mean...I have Auryn sharing $medoo_db object. If I construct something like $auth = new \Delight\Auth\Auth($medoo_db->pdo()). I will have 2 db conn then?
@Noni Step 1: stop using useless aliases
peehaa its just
case not actual query
I am willing to bet your real query also uses useless aliases
12:10
@hearthacker Paste full code. Not here in chat but somewhere like in question or on pastebin.
@BoteaFlorin So you inject the connection into the medoo instance right?
what us useless aliases could you define
?
@Noni yes, then I share the medo instance
so i would change it and share it
12:14
$injector->define('Medoo\Medoo', [
':options' => [
'database_type' => 'mysql',
'database_name' => 'test',
'server' => 'localhost',
'username' => 'root',
'password' => ''
]
]);
$injector->alias('Medoo\Medoo', 'Medoo\Medoo');
$injector->share('Medoo\Medoo');
this is my dependency about medoo
So medoo, whatever it is, creates the pdo connection?
I think so...medoo accepts an array as constructor arguments which contains db info
$database = new Medoo([
'database_type' => 'mysql',
'database_name' => 'name',
'server' => 'localhost',
'username' => 'your_username',
'password' => 'your_password'
]);
@BoteaFlorin Whether it will return a single of multiple connections all depends on whatever Medoo::pdo() does and is unrelated to auryn
medoo instance have a method which return a pdo conn
12:21
Auryn can only control things made by auryn
Whatever other random classes do it has no control over
good to know. Thanx!
@Tpojka i pasted here...
You are doing it wrong. You need to pass only array to view file (I am not certain if you are using AJAX or plain HTTP redirect) and form select element there.
im using ajax
Sam
Sam
12:27
Is it normal to store refresh tokens in a database along with the user which it was created for? By doing so I feel will add an extra layer of security should the refresh token be stolen by an attacker?
@Tpojka i updated here please check pastebin.com/UQ5p2H5a
This is something you would need in your view. Try to extract what you need from this:
https://pastebin.com/Uf1mFtzS
I added those if checks but you would probably like to sort it bit different.
okay
but invalid argument passed foreach error occurs
12:43
You have to debug your code. What is returned from every method. What is passed to every file or function. You need to be sure that you are getting array before you make foreach. But generally, this is how you (sh|w)ould populate select element.
my doubt is i got json array response into ajax when i print console.log(data) i need to pass into php array i dont know how to change json into php array i tried json decode but it display nothing...
Also, way I posted means creating that element on first page load.
Why would you like to create that element with AJAX?
because without refreshing page i need to get the value from db..i completed all steps successfully but i dont know how to parse ajax response to php
You don't
ajax is handled by the frontend,not php
12:52
Morngins
Morning.
@hearthacker You need select element created on page at first. Later (maybe), you can use AJAX to get some additional data regarding selected option. Code I posted works that first part - getting variables which are needed for initial select element creation.
Then after you have that element prepared, check this question stackoverflow.com/questions/16902820/… which I think that should solve your issue there and that should be the way of how would I make it.
13:20
Evening.
2
A: Send selected value to PHP via Ajax

MurifoXAjax calls accepts a JSON object to be passed to the server via the data options like this: var your_selected_value = $('#select option:selected').val(); $.ajax({ type: "POST", url: "your_url", data: {selected: your_selected_value}, success: function(data) { // Stuff }, error: ...

I dislike how the associated question got so many downvotes. SE-ers can be prickly.
@MisterGeeky Before posting link here, I deduced question has -3 but answer is pretty much what would be sufficient for use here.
@MisterGeeky part of the problem is how the question is worded... "Can I do <this>?" not "I'm trying to do <this>, but my PHP script is not receiving the data. My code is this: <blah blah>, I have errors turned on E_ALL, but I am not receiving an error message or this is the error message I'm receiving..." even that's a weak question, though
cause it's still a "debug my code for me please" question, and while those aren't inherently bad, but if they're poorly researched, they can be
14:09
evenin
Wes
Wes
14:27
i barely remember php has that stuff
do people use it? makes sense with arrays, but objects?
not even js has it, which is very anon-object based :B
let x = {};
x.a.b.c.d = 123; fails miserably
@Wes Given the fact that it throws a warning, it's probably not used much
Wes
Wes
right
ugh we need php 8 soon :D
@NikiC waaah
14:43
@NikiC ...ouch.
@LeviMorrison btw, I don't think that deprecation warning is worthwhile
it's kinda confusing because it will usually also trigger a runtime error
I need to hard-error it for variance.
This seems like something we should just do once php 8 comes around
or earlier if you need it, sure
I wouldn't worry about just breaking it
Well, I technically don't need it to error. It's just seems sane to do so because as you said: if you ever try to use it at runtime you'll get an error.
It does make things simpler for the variance logic, though, because there isn't an invalid "parent" lurking around.
does anyone know how to make sublime/emmet stop making space when enter tab? i must have entered some shortkut by accident
14:48
@NikiC Not a warning in 7.X -> error in 8.0?
@LeviMorrison that should definitely be fine
I wouldn't even be concerned about having the error in 7.4
@NikiC essentially the fix is to just apply the same mechanisms than we have already for ZEND_FETCH_DIM_WRITE, just for objects ... But it's annoying
it is
we should really just make it fully error
hard null deref error
and be done
I'm not sure whether I even want to fix this
instead of just changing behavior @NikiC
@bwoebi but can we do that in 7.4?
15:01
@NikiC Promoting warnings to errors should be doable in any minor
IMHO a Warning is anyway already stronger than a simple deprecation
@bwoebi it should be doable in any major
That definitely, but minors should be fine as well
in particular if there are actual gains from it (simplifying the implementation)
Wes
Wes
15:17
@PeeHaa regarding code style, is this acceptable for you?
$eatRemnants = function(Traverser $traverser){ return null; };
or would you write it on 3 lines anyway
For me 3 lines, but 1 line should be like (it's not some JS...):

$eatRemnants = function (Traverser $traverser) {return null;};

:B
Wes
Wes
a space between the function and its arguments is a giant wtf for me B:
Yup, sorry. You are right, But curly braces need space. And arguments and what is in curlies don't need it for me.
$eatRemnants = function(Traverser $traverser) {return null;};
Wes
Wes
and that is the problem with code style
are you sure? :P { return null; } vs {return null;}
Yes, I'd use latter. Either way, I use 3 lines.
I mean I stick with PSR coding styles with simple philosophy: If I am doing something wrong it is better to be systematic.
Wes
Wes
15:31
yeah, i'm doing the same. i will reconsider it when bob does ($his) => magic();
^ deliberately and/or systematic (late edit)
15:44
@tereško around?
the problem resolved. sorry for pinging you because of no reason
sure
/me goes back to reading
15:57
@Wes Of course 3 lines
Wes
Wes
16:28
// phpcs:disable does not actually work, right?
16:58
Sure it does
Either disable/enable for blocks or ignore for individual lines
@Wes the standard maximum length for braile 'displays' is 80 characters.
which may be a coincidence, or based on earlier standards.
Also, apart from getting up to receive an Amazon package, I just slept for 16 hours.
Wes
Wes
lol. nice
@Sara if you're around, I find this very interesting:
Array
(
    [title] => gmpi
    [taken] => 0.7584
    [value] => 322210387461053.8845010153894136480987071990966796875
)
Array
(
    [title] => decimal
    [taken] => 1.3195
    [value] => 322210387448553.8859687617
)
Array
(
    [title] => bcmath
    [taken] => -
    [value] => 322210387448553.88596876170000000000
)
Wes
Wes
anyway picking line length it's a no brainer for me, as 80 characters is not enough for basically anything, and 120 is way too big
i think i'm gonna go with 92
@Wes fwiw I've been on 80 forever
Wes
Wes
17:07
yes but you probably overflow 80 all the time? :P
@Wes honestly never, or very very rarely.
Wes
Wes
1 param with type and return type and there you are really close to 80 already
Hmm looking at some C of mine I do overflow with method headers.. github.com/php-ds/extension/blob/master/src/ds/ds_htable.c
Usually with JS and PHP though I'm crazy strict: github.com/FiguredLimited/vue-mc/blob/master/src/Structures/…
@Wes Go with Hex-ish length of 96
92 seems good to me these days.
I like 80 because it makes Github code reviews a lot easier.
Lookling at things side-by-side
Wes
Wes
17:11
92 is the default in phpstorm, or it was the default
maybe it's 80 now because psr
all right, 80 it is then
@bwoebi Seeing bugs.php.net/bug.php?id=63668 I wonder if the fact that we're going to return resolved class names is going to be a problem
@Wes go with 80 and try your best, if it goes over sometimes, it's not the end of the world. That'd be my vote. 😊
@Wes something you might enjoy youtube.com/watch?v=GNrS9RHMc-I
Wes
Wes
i know that :B @mega6382
Wes
Wes
17:23
i think my problem is more with 120 than 80
i hate code that develops horizontally
18:16
@Wes Still around?
Wes
Wes
yes
While you are there, is there rule for skip line before return statement?
PHPStorm regarding.
Wes
Wes
like an empty line before return?
That.
Wes
Wes
dunno, i don't have much set in the ide, because that's not portable. i work on two computers and i hate when they behave differently
18:19
I think (or at least I would surprise if there is no) export settings.
Wes
Wes
yeah but it's a bit of a mess with versions... i stopped relying on that
Seems legit.
Wes
Wes
they should make the settings format open and stick to it... instead they change it frequently and it's not easy to find "things that don't work anymore"
I see checkbox for "Return type on new line" but doesn't seem differently on example on the right.
Going to test though.
Well it worked (in testing preview didn't)
Wes
Wes
^ i think i'm going with 1, as that works in JS too
18:39
@Wes I like 1 as well, 2 maybe
@NikiC I don't know...
18:55
@NikiC What's a good error message for the incdec issue? Cannot increment or decrement a property %s::$%s of type int past its minimal and maximal values
Though I feel like that error message is confusing for the typical PHP user even if its technically correct
@Wes 3
It's way better when you have sign in front of variable name in new row because on first glance you can conclude it is tied to upper line.
&& || ?? ...
Wes
Wes
so

if(
    $aaaa
    || $bbb
)
Didn't say that. When too many parameters only. And not new line after/before parenthesis.
But

`$aaa
|| $bbb`

is more meaningful than

`$aaa ||
$bbb`
To me.
19:13
@Tpojka or with 1, you can see the operators at the end, and know that it continues to the next line. It's easier to read.
but I guess if I was scanning code, I wouldn't notice it at first
I disagree.
If I am Arab that could be easier for reading to me.
Not knowing Arabic way of reading this is lot easier.

My point is when I look at single line to know if it is tail of some code line above.
@Wes I'm a bit horrified if 80 characters are not enough.
Except for function signature lines, anyway.
@Tpojka what about hanging commas?
Wes
Wes
@LeviMorrison and function calls, for the same reason
No, function calls should fit or wrap nicely.
No need to extend beyond the gutter for that.
19:16
@Tiffany I use those.

Easier to add new element afterwards.
Wes
Wes
i can fit everything in 80 chars ofc
Especially when you c/p new element.
Wes
Wes
but while with 90 i almost never have to wrap, with 80 i almost always have to wrap
it's pretty annoying
but not contesting it, i believe in standards... i just need to change some code :B
@bwoebi sounds reasonable to me. Would be even nicer if it would say specifically which case it is (without the or/and)
A lot of PHP's coding style has symbols (braces, brackets, parentheses) on the same line: if/then/else, loops, try/catch, closures.
19:21
@Tiffany But fun fact, almost always I write arrays as this
Very rarely in same line.
I do that too, but your bracket is on the same line as the assignment
Yup. \o/
Wes
Wes
@LeviMorrison
public function __construct(String $hexDigits, ?WhitespaceToken $terminator){
81 characters
2 params only
legit naming
and that doesn't even have the return type
19:33
it looks like a constructor can only return an object? but original point still stands... if it wasn't a constructor :P
Can someone help explain password_hash and password_verify functions? I read the docs but still dont understand.
@Tiffany TBH, I am not even sure what to suggest. And I can't just throw some book or blog-post at you, because those all assume existence of some classes (even if singletons) in the codebase
@JBis what part do you not understand?
I currently use these three things:
$salt = bin2hex(random_bytes(16));
$pass = hash('sha256', $salt . $_POST['p']);
----
hash_equals($realpass, $pass)
@Allenph I basically only have one "alternative histories" channel in my subs. I find it too hard to sift through all the "ancient aliens" type of bullshit to bother
19:43
@Tiffany First off, I am a bit confused on how the salt is generated for these functions.
@tereško yeah, that's fair. @Allenph gave me an example class that I'm going to try refactoring based on that. He deleted the message because he couldn't paste the code in a code-share site and it was lengthy. Assuming I don't begin receiving specifications next Monday...
@JBis The salt is generated automatically and part of the hashed password
@JBis don't roll your own crypto
204
Q: Why shouldn't we roll our own?

PolynomialWhy shouldn't we create our own security schemes? I see a lot of questions around here about custom crypto and custom security mechanisms, especially around password hashing. With that in mind, I'm looking for a canonical answer, with the following properties: Easy for a newbie to understand....

@Tiffany if you get really bogged down in that clusterfuck, I could look at that codebase next weekend (or one after that). Because without actually seeing code it is really had to give any suggestions.
And right now I am almost at the bottom of my wine bottle
@Tiffany I'm not really. I am using pretty standard stuff. Two fields in the db. salt and hash. Hash is hashed password and salt. When comparing I take the salt and hash the inputed password with it and then compare it. Whats wrong with that?
19:46
@tereško for your sanity... it's better I don't
@JBis how are you generating the salt?
@Tiffany bin2hex(random_bytes(16))
I can guarantee it's not as random as the salt included with password_hash
@JBis The problem is that you're not using a hash that is suitable for password hashing
@Tiffany I actually have worked on a lot of "deep legacy" projects :D
Your salt generation is fine, but your use of sha256 is not
19:47
it's a good mid-priced wine (16€ ... about 19$)
@NikiC ok then which algorithm would you suggest? sha256 is used throughout so I figured it would be secure.
@JBis sha256 as a primitive is fine, but you need to combine it with a construction such as PBKDF2. That said, you should be using password_hash+password_verify and not worry about the used algorithm.
@NikiC Well back to that, how does is know the salt used? Is it the same salt for each password? I dont think it describes it well.
You write $hash = password_hash($password, PASSWORD_DEFAULT) and store it in the DB. Then you retrieve it from the db and write if (password_verify($password, $hash)) on login.
can't you see that you are dealing with a real security expert, @NikiC
19:51
@JBis The salt is part of the hash
he knows what he is doing and all
> The used algorithm, cost and salt are returned as part of the hash. Therefore, all information that's needed to verify the hash is included in it. This allows the password_verify() function to verify the hash without needing separate storage for the salt or algorithm information.
@NikiC From the docs:
echo password_hash("rasmuslerdorf", PASSWORD_DEFAULT);
// output: $2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a
Wheres the hash?
possibly vGA1O9wmRj is the salt and then the rest is the hash bit.
@JBis The vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a part contains both the salt and the hash. I don't remember in which order they are
19:53
Anyone here who's familiar with seo?
$2y$10$ indicates what type of hashing was used I believe.
But as nikic said, "You write $hash = password_hash($password, PASSWORD_DEFAULT) and store it in the DB."
SEO is a scam ... kinda like those mails with Nigerian prince who needs access to your bank account
idk why @tereško hates me....
@tereško :-)
@JBis Don't worry, he just hates everyone ;)
And most of all himself
19:55
You know, I want to introduce 2 million links to google via a sitemap. Won't be known as a spammer?
@NikiC am very fond of myself
@tereško :P
@NikiC well how online dictionaries should make a sitemap? Should I ignore all those valuable links?
@Shafizadeh your first question should be "should a dictionary make a sitemap"
@Shafizadeh oh sorry, I misread
Still sounds pretty useless
19:57
@tereško yes, shouldn't ?
I honestly don't know - I would send a mail to google-support asking about that
Ok. Next question I am confused on. What is the "count"?
@NikiC well how google will crawl us and index the words on our dictionary?
From the docs:
cost (integer) - which denotes the algorithmic cost that should be used. Examples of these values can be found on the crypt() page.
This doesn't explain well
@JBis how slow the hash is
19:58
3
A: What is the "cost" of hashing?

Stephen TousetThis is a parameter used in password hashing, not for reversible encryption. Passwords typically have low entropy. If an attacker has your corpus of hashed passwords, they can simply try hashing the most common passwords with each user's salt to quickly find login credentials. A GPU, FPGA, or AS...

@JBis See also example #4 in the docs
@NikiC So why is that needed/used? And who says what that is? Do I choose?
Same answer, example #4 ^^
@tereško actually there is a schema for dictionaries. Recently we've used it, but we also need to say to google crawl our pages
Though just sticking with the default will serve you well enough
01:00 - 20:0020:00 - 00:00

« first day (2905 days earlier)      last day (2268 days later) »