« first day (2867 days earlier)      last day (2095 days later) » 

12:00 AM
@JBis enough mate. it's off topic and you're just talking to yourself.
 
Fine
Last one: similar to the denial of service No. Not at all. Running SQL queries to drop a table and running a Denial of service attack are in no way similar. Thats like saying a Ferrari is the same as bicycle because they both have wheels.
</rant>
 
Wes
what characters are accepted in the heredoc label?
because if it's any characters, it could be even
preg_match(<<<@/[a-fA-F0-9]{1-6}/@, ...)
 
@Danack Sorry. Just annoys me with the bullsh** many news agencies put out against tech things.
 
Wes
no
 
@Danack I don't know how efficient that would be.
 
12:07 AM
@JBis i) Paper has worked for centuries ii) if it needs to be more efficient; voters use a touch screen. Machine prints ballot with votes on it, and paper is put into box. At the end of voting, all ballots are read with ocr. Completely auditible, really hard to stuff ballot boxes with fake votes, really fast.
nn.
 
@Danack Counting would take much longer but it is doable. I like the WORM idea better though. Either way, I see im annoying you guys and its off topic for the most part so ill shut up.
:)
I think we should create a room dedicated to ranting.
 
Wes
12:23 AM
firefox is ded
imagine if i used it every day
i would spend my life fixing it
 
Wes
12:35 AM
had to create a new profile
 
12:48 AM
I decided to comment on the article
 
 
2 hours later…
3:09 AM
nn
 
3:26 AM
array_reduce leaks memory if callback throws exception – #76778
 
 
2 hours later…
5:30 AM
Morning All
o/
 
 
1 hour later…
6:45 AM
@Shafizadeh probably, because you have a 32bit windows installed
 
7:19 AM
 
7:45 AM
Good 'noon
@Wes then why does my 11 yr old brother keep using it over the chromes.
php sucks :/
3
 
@MisterGeeky yes
 
morning
 
morning!
 
o/
 
raffish mildly or sometimes engagingly disreputable or nonconformist; rakish: a matinee idol whose raffish offstage behavior amused millions.
 
8:01 AM
Hi all
Someone please help me in my problem
0
Q: Why do I get an empty array when I do print_r($_ENV); and get proper output when I do phpinfo(INFO_ENVIRONMENT);

user2839497I'm using Windows 10 Home Single Language 64-bit Operating System on my laptop. I've installed the latest version of XAMPP installer on my laptop. XAMPP has installed PHP 7.2.8 and Apache/2.4.34 (Win32) From the Description of 'what' parameter of phpinfo() function I come to know the meaning ...

 
because phpinfo() is not printing $_ENV
documentation; do you read it?
 
@MisterGeeky: Yes, I've read it. Then how does phpinfo(INFO_ENVIRONMENT); able to get the appropriate result?
 
@webmaster777 : I did exactly the same. The 'E' was missing from the value which variables_order contained. I added that missing 'E', restarted the Apache web server and then checked the output. Again I got empty array in output. So, I'm asking for some help here.
 
you should use getenv() anyway.
especially on windows, as getenv gets the env variables in a case-insensitive way.
 
8:14 AM
@webmaster777 : getenv(); works even when the value of variables_order is 'GPCS'
 
yes
have you verified the new ini value is working with echo ini_get('variables_order');
?
 
@webmaster777 : My problem is why the print_r($_ENV); is printing an empty array even after making necessary changes to the respective php.ini file?
@webmaster777 : I just checked the value of ini_get('variables_order');. I have to say that to take the effect of new value restart of apache server is necessary.
What a surprise I finally got output of print_r($_ENV);
Thanks for your help and time you given to me.
 
rxw
8:42 AM
Hello everybody, i am using windows and everytime i call "composer install" from the command prompt it installs the required packages but it closes the prompt, how can i solve this?
 
I guess you could try a different OS or shell?
 
@rxw You could try and route the output to a log file and see what's going on before it exits
 
9:07 AM
please help me with this question stackoverflow.com/questions/51962873/…
 
why?
 
9:20 AM
hi , this code is working :
<?php
include 'conn.php';

$sql = "SELECT * FROM data";
$result = $conn->query($sql);

while (($row = $result->fetch_assoc()) != null)
{
echo $row['title']."<br>";
}
?>
how to make it prepare statement
$result = $conn->prepare($sql);
this isnt working
 
@Srinivas08 technically you don't need to prepare this one
 
^
 
Because you have no parameters
The reason this doesn't work though, is that prepare() doesn't return a ResultSet
It returns a Statement
 
yes , but all code is in prepare statements , so i want this also to be in prepare statement
 
Preparing a statement means you're separating the query into two "stages"
You first prepare it, then you execute it
 
9:22 AM
i need prepare bcos , i need to implement search function also
insert and update is working with prepare statement
only , need help with select statement to , fetch n read array
 
@Srinivas08 you need prepared statements ONLY if your query has parameters
 
@Srinivas08 Prepared statements have a relatively steep performance cost
You should only use them when necessary, and you should know when they are necessary.
 
actually , to make application secure , i am using prepare statements
as few people over here suggested me
 
@Srinivas08 Yes, but you should understand why, and what is the problem that prepared statements solve
 
sql injection i think
 
9:27 AM
@Srinivas08 Correct
And there's no chance for SQL injection in the query in your example
 
that can also be acheived with mysqli_escape
 
Because there are no parameters, no variables
@Srinivas08 Not entirely
 
rxw
@Sean the last piece of output is:Reading C:\aa/vendor/composer/installed.json
Executing command (C:\aa\vendor\rxw\hello-world): git log -n1 --pretty=%ct "39ca97bb5ddb3f6ae36032e9378f0897aa932ebd"
Writing lock file
Generating autoload files
 
i need to implement this also :
$sql = "SELECT * FROM coupons WHERE id = ?";
here , it has variable
 
mo' in, mo' problems
 
9:28 AM
@Srinivas08 that one will need to be prepared.
 
@Srinivas08 did you watch the video?
 
@tereško not yet , i am testing my code ... will watch now
 
@MadaraUchiha eh, (int)$id is fine
 
@DaveRandom o/
 
@DaveRandom Unless id is a guid vOv
 
9:30 AM
unless you have a driver with parameterised queries that don't need preparing
@MadaraUchiha I've been considering adding PDO::query(string $sql, array $params); with a default implementation of $stmt = $this->prepare($sql); $stmt->execute($params); return $stmt; but drivers can override it to do a proper parameterised query. Thoughts?
...by which I mean, "anything obviously dumb about that which I missed?"
 
@DaveRandom Prepared queries have a serious performance penalty.
Prepared statements are worth it (in MySQL at least) only if you execute the same prepared query 50 or more times
 
exactly, but at the moment there's no way to do unprepared parameterised queries via PDO
 
So if you do add that, I'd also like PDO::queryRaw
 
@MadaraUchiha existing PDO::query($sql) calls wouldn't change behaviour
 
@DaveRandom I know what I said.
 
9:35 AM
it would be like an overloaded signature
 
No, I'll correct
I want PDO::UNSAFE_queryRaw()
 
isn't that what PDO::query() is now?
 
@DaveRandom Yes
And PDO::query($sql) to slowly be deprecated
I want it to be perfectly clear that using this should only be done if you know what you are doing.
I want to prevent the fiasco of mysql_query() with every single crappy tutorial
 
and then rename it to PDO::real_unsafe_query()
 
If users see UNSAFE_queryRaw() in a tutorial, they'd think twice whether to use a function with UNSAFE blazened on it so quickly.
 
9:38 AM
@tereško we'll make it throw, and you have to catch the exception it throws as call execute() on the exception
that'll work.
j/k just in case not obvious
 
Just like with React in JS, React allows the escape hatch of using innerHTML if you really need to, but the API for that is deliberately ugly.
 
you are working under the assumption, that users actually read the code, that they copy from tutorials
 
<div dangerouslySetInnerHTML={{__html: '<span>Whatever</span>'}} />
You need to make a real effort to get here, you only get here if you "consent" to risking yourself.
 
can you pls tell me where the code gone wrong pls ,

<?php
include 'conn.php';

id = 1;

$sql = "SELECT * FROM data WHERE id = ?";
$stmt->bind_param("s", $store);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc()
print_r($row);
$stmt->close();
?>
 
$stmt is undefined?
You're missing $stmt = $conn->prepare($sql);
 
9:41 AM
I want to make sure that raw SQL queries are a low level API that should very rarely be used.
 
also you are using mysqli when you should be using PDO (imho) and you are using SELECT * which you basically never want
 
I think I will just ignore this user
 
yes , edited
still error
 
And ideally, if I had a way, I'd toss a big fat warning about using non-string literals in SQL queries
 
@MadaraUchiha that's not true though, sometimes you just have static queries
 
9:42 AM
i.e. not allow concatenation or other forms of variable embedding.
 
SELECT name FROM categories for example
 
@Srinivas08 Just to confirm, it should be $sql = ... then $stmt = ... then your $stmt-> calls
 
Actually, that's a much better solution.
If I had a type string_literal or something, which only applies to strings that have had no variables embedded in them, nor have been concatenated at any point
 
now :
$id = 1;

$sql = "SELECT * FROM coupons WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc()
print_r($row);
$stmt->close();
 
I could make PDO::query($sql, $params) work well
Because then I can eventually not allow PDO::query($sql) to have a string that has variables in it
Only allowing benign queries to be passed
If you want a query with parameters, you must pass a second argument
You can't embed it in your SQL.
 
9:44 AM
@MadaraUchiha you can check if it's interned, but stuff like WHERE IN (<variable length list>) doesn't play nice with that
 
@DaveRandom Right
That's what I was about to say, it's the only downside to this
But I'm fine with this requiring the UNSAFE version.
The one that does allow you to embed variables.
@DaveRandom Also, how do you check if a string has been interned?
Or is that not available to userland code?
 
the short answer is "I don't know" but it won't be available in userland, I'm sure of that
nor am I certain it's even reliable
 
Duckin' apostrophe...
 
nor do I think it's a particularly good idea tbh
 
@DaveRandom That's the ideal solution in my eyes. It allows for a nice API when it's safe, and an uglier API when you need to pay more attention.
Implementation details aside, of course.
 
9:47 AM
ok mornging
 
this is largely academic because you'd never get a majority on deprecating query($sql)
 
@DaveRandom You wouldn't
With this solution, the only BC break is that you get a warning or a notice if your query is unsafe.
query($sql) will continue to work the same other than that.
 
however I do think that query($sql, $params) would be an easy win
where passing a non-empty array of params will use parameterisation if available and gracefully fall back to prepare/execute and discard the statement handle
If nothing else, I'm a little fed up of explaining that there's a difference between prepared statements and parameterisation, and then having to say "...but you can't do that with PDO"
 
@DaveRandom Why is it that PDO can't perform parameterized queries by the way?
 
it just has no API for it
the only way you can pass parameters is via PDOStatement::execute()
and the only way you can get an un-executed statement handle is via prepare()
 
9:54 AM
hmm, yeah, I like it.
It's a good direction.
 
any updates pls , on where the code need to be edited ?
 
this is largely conjecture, but I'm guessing the reason it's like that is that PHP has been so MySQL-centric for so long, and MySQL doesn't support it at the protocol level
 
@Srinivas08 The parameter your binding to doesn't exist your query properly
 
morns
 
... WHERE id = :id
...
$stmt->bindParam(':id', $store);
 
9:58 AM
@StatikStasis What @FélixGagnon-Grenier said cc @JBis. OOP is not about taking your function and wrapping it with a class
 
@Sean no it's mysqli, it's way more retarded than that
the i means "integer"
 
oh o.O
 
yeh, just don't use mysqli
 
3 messages moved to Trash
 
Wes
10:25 AM
\o
 
Wes
10:38 AM
can brits explain this? youtube.com/watch?v=8Lff5W4OygM (slight nsfw language)
 
@Wes fyi that's an Australian accent.
 
Wes
no shit :B
 
Apparently taking footage from the 1970's....and then trying to be funny over the top of it.
 
Wes
the australian commentary on the british daredevil :B
what i don't get is the british daredevil
what is that guy doing?
you don't know ozzyman?
 
Riding his chopper.
I have no idea what the context it.
 
Wes
10:43 AM
@Danack it's what i don't understand too
anyway, we had choppers too. i think we called them bmx :B
 
@Wes No, BMX have low seats that make it easier to ride by standing up, and are light weight bikes for doing stunts. choppers are heavy bikes that make it easy to cruise.
 
Wes
i'm saying that we were confused about them :B
we generically called them all "bmx"
i think i never heard anyone using "chopper"
 
fun fact - the rear wheel reverse pedal breaking on a lot of BMX is not very good in the rain.
 
Wes
do they have a reverse gear?
 
10:58 AM
Some have reverse gear with direct chain drive I think. But the one I had, had a break that was activated by pushing backwards on the pedals.
 
Wes
i don't see how that can be useful on a bike :\
find the obvious bug gist.github.com/Netmosfera/673af602d33fcfcb3f6bea00efe32df0 ddaamnnnn i'd slap myself in the face
the realpath_cache_size trick changed my life
 
@Wes makes it easy to slide in the rain. and fall off.
 
Wes
lol
 
11:19 AM
@Wes Oh, I love this guy, I often watch his videos, his commentary is amazing.
 
Wes
if you like game of thrones you need to watch his episode recaps
they are funny af
 
I really liked his commentary on that soap soccer :P
 
@PeeHaa At a basic level creating classes and methods and using them I think is OOP.
I didn't just wrap my code in a class.
i thought about why i was creating it: instead of defining my credentials every time I wanted to connect to a DB I just defined them once and then call the class→Method to connect.
 
11:51 AM
@Wes We use chopper here in the States. I have a BMX bike myself.
I want a road bike but haven't broke down to spend the money on the one I want.
Oh- good morning!
 
Wes
mornin
 
@PeeHaa thumbs up
@Wes Ozzy man is hilarious. Have you seen the one he did on the cheese chasing video? Not sure what it is actually called.
 
Wes
i might have seen them all :B
 
12:11 PM
Can't find multibyte functions via string functions – #76779
 
12:29 PM
Scalar type hints in #2 on "Latest Ideas"
 
@DaveRandom can I annoy you with questions today?
 
yes
 
@Wes Well that got me watching Ozzy videos this morning. =p
 
Wes
lol
 
12:45 PM
@Gordon looks like an old site from 2014, which got refreshed a few weeks ago
 
Question about classes
If I don't create a class and just "free write":
<?php

echo "Hello World!";

?>
Is that in a class?
like main class?
 
@JBis No.
PHP has no concept of a main class or function like in Java or C
Because not everything must be inside of a class like in Java.
The PHP executable is called with a path to a *.php file as input, and it executes it from top to bottom, skipping the parts outside of <?php ?> tags.
> Everyone wants a better PHP.
I'm pretty sure that's factually false. :P
Can I ask for an unrecoverable fatal error whenever WordPress or Laravel globals are found by the PHP parser?
 
@MadaraUchiha Thanks. That clears some stuff up.
Question 2:
If I do define a class in the main doc how do I call it and tell it to run?
 
@MadaraUchiha No, but you may ask to change the semantics in a minimally invasive way so that everything still works except the current versions of Laravel and Wordpress.
 
@bwoebi I am confused where this came from, too
found it in some article about php8
 
@JBis Well, like I said, PHP files are simply executed top to bottom.
 
Wes
is jbis aaron whatever?
 
So if you have a class Whatever { public static function main() { ... } } You just need to call Whatever::main() after the class has been defined.
 
@bwoebi page is in gibberish
 
I know I can do this $conn = (new connector())->connect("login"); but that's after I already have it running.
@Wes ?
 
1:00 PM
@Wes No, don't think so
 
@Wes no
 
@Gordon Oh, somewhat not realized it was French. Just understood the text :-D
 
@MadaraUchiha I see. I didn't realize that once you use a class you can write outside of the classes.
ok thanks
 
@JBis Again, PHP is not Java
 
@MadaraUchiha Yep.
 
1:01 PM
You're allowed to have one class per file, N classes per file, 0 classes per file, you can combine code inside and outside of classes, etc.
 
Gothcta.
 
It's recommended to have one class per file, and rely on autoloading to require them automatically
 
@MadaraUchiha I gotta implement autoloading. I just include & require everything now.
Question 3:
 
@JBis composer makes autoloading easier
@JBis have you gone through github.com/PatrickLouys/no-framework-tutorial yet?
 
@MadaraUchiha You'll just have to write your code like this:
goto _end; _000: exit;
goto _000; _001: print "reverse!";
goto _000; _002: print "in";
goto _001; _003: print "PHP";
goto _002; _end:
goto _003; __halt_compiler();
 
1:05 PM
@bwoebi D:
 
@Tiffany No. But will do.
 
wartime correction for india is wrong – #76780
 
@bwoebi Madara Uchiha vs velociraptor. Round 1. FIGHT!
 
Is there a way to avoid calling the super global $GLOBALS every time I want to call a global variable?
(without passing it to scope as an argument)
 
@JBis that's best to be avoided
 
1:08 PM
@JBis global $var; in your function declaration
But globals are kin to goto in that they indicate bad coding practice
 
@Tiffany copy-on-write semantics and the $GLOBALS array can be quite fun sometimes
 
@Machavity so what should I do
 
@JBis dependency injection
 
watching...
 
@JBis I salvaged my example from Docs
 
1:14 PM
@Tiffany isn't this just passing it to scope as an argument)
 
@JBis what do you mean by passing it to scope?
 
I just gave up
 
$conn = (new connector())->connect("login");
removeTokens($user,$conn);
 
@tereško Heh, indeed. I've never however built a system that uses git commands in any working way, hence was not really up on explaining how it would / could go...
 
@tereško What's up?
 
1:18 PM
@Tiffany Just seems stupid to keep passing $conn to the function.
 
@bwoebi working and watching OxygenNotIncluded lets-play
 
@JBis it would depend where $conn is defined, and where removeTokens is defined. If they're within the same file, that's procedural programming, and I don't believe dependency injection applies (or doesn't apply in the same degree as it would in OOP)
 
@JBis Why? A far worse way would be global $conn and hope that nobody else uses $conn somewhere. DI means never having to worry about what variables are used where
 
@JBis the idea is keeping your code sane, clean, and easier to maintain
 
1:20 PM
@Tiffany removeTokens is in same file.
@Tiffany my code def not any of those
But its getting better
 
@Tiffany I don't think he cares
 
@tereško well that's rude... I am trying you know...
@Machavity fair enough
 
@JBis Consider this though. 1. Someone comes along and redefines $conn2. Your function, having globalized $conn merrily tries to treat it like a DB object, which it no longer is 3. Fatal error
 
So moral of the story is don't globalize it.
@Tiffany @Machavity Thanks! :)
 
o/
 
Wes
1:36 PM
most voted idea is php-vote.com/idea/7
do you feel php needs ideas? i think we just need a bunch of clones to implement stuff we already know we need
wonder how much time it will take before he notices without pinging him
 
> polymorphism for methods
You keep using that word...
 
Wes
dynamic dispatch
overloading
how do you call it?
 
@Wes overloading
It's not dynamic dispatch either
overloading is nice, but is somewhat difficult without slightly stronger types
 
Wes
overloading is impossible in an interpreted language
 
1:51 PM
@tereško he does, just inexperienced and questioning why things should be done, to try and understand the principles better
 
@tereško I've been watching people play that more than playing it myself.
@FélixGagnon-Grenier Congrats! stackoverflow.com/questions/51815763/…
 
@tereško I was in high school at one time, and was rather set in using global variables cause I didn't care, and struggled to pass parameters correctly (at the time), but I also didn't work on other projects. My homework didn't require a focus on local scope, and I didn't interact with other developers to have my views challenged.
 
@StatikStasis Thanks you!
upon posting the answer, I was quite unsure, then reread it this morning, and I am somewhat ok with having produced that.
 
Very thorough and got an extra 100 internet points which is nice!
 
yes, I was quite excited :)
 
2:03 PM
@StatikStasis Wasn't it @ircmaxell who said "Problem #1 with performance: You don't have a performance problem, your code just sucks"?
 
yeah, I kinda stole that
 
Wes
he didn't notice :( @bwoebi
 
@StatikStasis I have played it for 300-ish hours according to steam
 
@FélixGagnon-Grenier That's my motto. "You got eyes; plagiarize!" =D @MadaraUchiha
 
2:16 PM
lol it even rhymes
 
It supposed to- lol. I read it in a book one time.
See- I did it again. I plagiarized the motto. But the book told me I could. =p
@tereško You got me playing it. I needed some guidance so I started watching videos though.
 
careful it's... a deeper game than one'd think
 
2:47 PM
Yeah I've only played about 2.5 hrs maybe.
 
@StatikStasis it's actually quite simple
you just need to plan out a bit
 
@Wes hm?
 
Yeah I saw that after playing a bit. I just had issues with them pissing themselves and water overflowing into the floor and getting people to clean it up.
 
@Wes Ah, I saw that one on the site. But too lazy to shoot it from orbit with warheads
 
Wes
2:57 PM
keep reading :D
 
> overloading is impossible in an interpreted language
you mean "impossible with weak primitive types"?
 

« first day (2867 days earlier)      last day (2095 days later) »