« first day (3664 days earlier)      last day (1267 days later) » 

1:33 AM
Seems kind of ambitious, but maybe also cool.
> Our goal is to evolve WebAssembly from a compilation target that you compile monolithic applications to, to a modular ecosystem that you compose applications from.
 
1:59 AM
@Feeds When do I get my plaque? =D
 
2:13 AM
When you get 100k rep
 
 
2 hours later…
Jpv
3:55 AM
Hey guys, question on wordpress actions.
i know that if I have class "TestClass" and i have a public method 'method1'
i can hook the medthod to any action as " add_action('theHook', ['TestClass', 'method1']); "
now, from my understanding. If you don't initialize the class, your can not access its methods or objects (unless they are static)
Now, I would assume that wordpress has to follow this, and it must initialize my "TestClass", wich will fire __construct()
However, it doesn't.. I'm trying to figure out why. I know i can do a self initialize on my 'method1', but i would like to know why this is so with wordpress
 
 
1 hour later…
5:06 AM
mornin room
 
 
2 hours later…
6:41 AM
Good morning.
 
 
1 hour later…
8:01 AM
Math operation with precision in php.ini ・ *Math Functions ・ #80286
 
8:56 AM
hey @NikiC, check it out, an actual real legit bug related to floating point ^ :-P
presumably wontfix but still
 
@DaveRandom Yeah, but a won't fix one :)
 
yeh :-P
 
anyone (@Derick?) know offhand the config option to stop Xdebug catching exceptions and wrapping them in RuntimeException?
oh. it isn't Xdebug wrapping it. but it is adding an "xdebug_message", which threw me off.
 
9:40 AM
yeah, I need to check that one again
 
morns
 
10:19 AM
@NikiC Your timelib/asan thing is on my todo list, just not very high up :-/
 
@Jpv php (still) allows calling non-static methods as if they where static. It's deprecated and probably not recommended, but still possible. WP add_action just expects some callable and doesn't do anything like initializing an instance.
 
cmb
@makadev that's no longer allowed as of PHP 8.0.0 (3v4l.org/P0ORv)
 
10:47 AM
Good to know and probably for the better, it's a common source of errors.
 
11:17 AM
Morning
 
o/
How goes it, Joe?
 
11:33 AM
\o
 
 
1 hour later…
12:35 PM
o/
@Tiffany LOL!
Thanks @mega6382
 
:)
 
1:04 PM
Xdebug Simple DBGp client (0.4) Block itself after second request ・ *General Issues ・ #80287
 
1:22 PM
o/
 
\o
 
2:19 PM
@IluTov I don't know how you feel about the musing I just posted on enums...
 
3:04 PM
@NikiC I see no real benefit why we would stringify floats at compile time - at the very least I cannot imagine any performance benefit on non-contrived cases here - it's just plain surprising I'd say - but yeah not very important though
 
3:16 PM
Something similar to this has come up in issues with ArrayAccess, hasn't it?
 
 
2 hours later…
4:56 PM
Guys, see if anyone can help me, because I believe that many here use Mac.

I bought an app at the app store, but the app doesn't open, it always keeps asking me to login.

The purchase was made on the same computer that is opening, same login.

Is there any alternative, to open the app?
 
@Tiago contact the vendor
 
@Gordon I already did, but it doesn't answer.
 
contact apple support. they generally have an online chat support option for stuff like this
otherwise try asking on either apple.stackexchange.com (a SO sister site) or a Mac focused forum like forums.macrumors.com
 
Trying to write a stupid simple conditional in this htaccess file reminds me of how much I hate apache
<If "%{THE_REQUEST} =~ /regex/">
</If>
That causes a 500. That seems simple enough
 
5:12 PM
Translation of example is wrong on Turkish Language ・ Translation problem ・ #80288
 
@Alesana set trace level logging
 
mb_substr, 7.4.11 ・ *General Issues ・ #80289
 
I will do that. I am waiting on server credentials. It's a wordpress website so I'm just using some plugin to edit htaccess
 
@Alesana also what is your actual regex?
 
That
I mean, putting that literally causes a 500
 
5:20 PM
are you sure it's apache 2.4?
 
I was trying to check that right now actually
By putting an <IfModule mod_authz_core.c> in there with a special rewrite
It didn't seem to work, but then after I used <IfModule !mod_authz_core.c> with the same rewrite and it didn't work so idk. lol I'm just gunnu wait until I can get on the server
 
depending on what you want to do inside the if, either setenvif or mod_rewrite with one of the non-rewriting actions can probably do what you want, if it's only 2.2
 
5:59 PM
I wanted to set a robots noindex header
 
6:30 PM
Incident on 2020-10-27 18:29 UTC ・ Notifications has Partial Outage ・ Gists has Partial Outage
 
anyone got any experience with the Cisco Meraki WiFi controller? @StatikStasis or @MarkR maybe?
 
Nope
 
no drama
 
does "drama" mean "worries" ?
 
6:48 PM
Hi
 
Depends if you worry about drama
 
I have a java script Ajax code to post a number to php page and php should returns values I check my Ajax code and it correct but php code doesn't return values
 var Room_Id = $("#Roomnum").val();
     alert(Room_Id);
        $.ajax({
            url: 'getStudents.php',
            type: 'post',
            data: {Room_Id:Room_Id},

            dataType: 'json',
 success:function(response){
  alert("success");
include "database_connection.php";
 $Room_Id= $_POST['Room_Id'];
 $stmt =  $connection->query("SELECT * FROM students WHERE Room_Id =   '.$Room_Id.'   ");
 $students_arr = array();
 while ($row = $stmt->fetch())
    {
    $Student_Id = $row['Student_Id'];
    $student_Name = $row['Student_Name'];

    $students_arr[] = array("Student_Id" => $Student_Id, "Student_Name" => $Student_Name);
}
 
what's the result of alert("success"); ?
 
a window saying success
 
replace it with console.log(response) and check out the browser console log
 
6:54 PM
!!debugger
@PHPFan learn to use a debugger. Staring at code is not a good way of fixing problems.
 
php stan would of been a better name
 
All issues have been resolved!
 
@Shafizadeh Array []
 
echo $students_arr;
 
apparently, the result of your query is zero and no row selected .. Since you've shared part of your code and I have no idea what you return, then I cannot say something specific @PHPFan
 
7:02 PM
<?php
include "database_connection.php";

$Room_Id= $_POST['Room_Id'];
 $stmt =  $connection->query("SELECT * FROM students WHERE Room_Id =   '.$Room_Id.'   ");
 $students_arr = array();
 while ($row = $stmt->fetch())
    {
    $Student_Id = $row['Student_Id'];
    $student_Name = $row['Student_Name'];

  $students_arr[] = array("Student_Id" => $Student_Id, "Student_Name" => $Student_Name);
}
  echo json_encode($students_arr);
  ?>
all code
 
on chrome see what you are getting back from your ajax call
there is provably an error within this file.
 
true ^
 
if it gets an error it returns nothing back
 
go to the "Network" tab of Chrome, select XHR section, and see what that API cal returns .. @PHPFan
 
Do that and when you solve this. Learn to use a debugger like Danack said.
Xdebug
 
cmb
7:05 PM
$Room_Id= $_POST['Room_Id'];
 $stmt =  $connection->query("SELECT * FROM students WHERE Room_Id =   '.$Room_Id.'   ");
that is bad
 
lol
injection
 
cmb
use prepared statements, or at least some kind of sanitation
 
Response

<br />
<b>Notice</b>: Undefined variable: Student_Name in <b> getStudents.php</b> on line <b>16</b><br />
[{"Student_Id":"21","Student_Name":null}]
@Shafizadeh
 
first, write the query like this:
$stmt =  $connection->query("SELECT * FROM students WHERE Room_Id = '$Room_Id'");
 
> $student_Name
> $Student_Name
 
7:07 PM
is PHP case-sensetive ? @Danack
 
you should use an IDE like phpstorm. It will warn you about undefined variables.
 
@Shafizadeh Variables are. methods/functions are not.
 
I see .. thx
 
@Shafizadeh yes.
 
@Danack Good catch.
 
7:09 PM
@Tpojka ಠ_ಠ . Not really. People refusing to use an IDE and instead asking other people to find their typos for them is..........annoying.
 
Well... That too. In first place.
 
@Danack I believe you're completely right, but, tbh, I personally think, people will learn how to debug their code after a while and getting some experience in coding .. so, no need to keep saying it to them ..
 
Although PHPStorm can be considered as some kind of standard, any IDE and also editor with plugins will catch this typo.
@PHPFan What editor you are using to code?
 
Sublime text 3
Now I am opening phpstorm it somewhat heavy
 
@PHPFan There is some package for checking PHP code syntax I am sure.
 
7:17 PM
Is my php code compatible with PHP 7.3?
 
yes
 
Also it will help to go through psr naming convention and standards (i.e. what should be camelCase, what should be PascalCase what should be snake_case). Read every link on this page.
 
@Shafizadeh some things are case sensitive
Class names aren't....
 
yeah I'm reading about it right now ;-)
 
@Shafizadeh also, wat
"Yeah, well, that's just like your opinion, man"
 
7:24 PM
nothing important .. I just tried to say, sometimes helping others without advice would be much more useful and
 
7:50 PM
@PeeHaa I created a new PR
@PeeHaa also tag the topic "hacktoberfest" to the whole repository as well, also add it to the should-i plugin as well'
 
ThW
8:28 PM
@Tiffany but it still might matter depending on how the autoloader works.
 
8:39 PM
@ThW good point
 
@Shafizadeh yo, how have you been?
it seems like your English has improved quite a bit :)
 
9:33 PM
Probably a lazy question: is there a class constant that returns the name of the class without its namespace? I'm not sure if "class constant" is the right term either.
 
basename(__CLASS__); in almost all circs
or basename(Foo::class) obv
 
Circs = circumstances?
 
yarp
not sure if you might get screwed on *nix with a class in the root ns because of \ vs /
you'd have to test
pathinfo() should be reliable everywhere, but check basename() first, there might be a couple of edge-cases but I think it should be ok in the real world
it's leading slashes that will screw you there
 
basename still returns namespaced
 
E_BOLLOCKS :-P
 
Trump is going to lose the election.
 
@Tiffany ffs
you can strtr() \ in to /
windows will handle / quite happily
preg_match('(?:^|\\\\)([^\\\\]+)$'); might be easier tbh
 
I just need the class name, don't care what Windows handles happily
 
or whetever the correct regex is, didn't put a lot of though into that ^^
@Tiffany the problem is that it isn't that simple :-P this is one of those rare things that's actually easier on windows
 
It's not a matter of directories or anything. Trying to avoid using a string for a parent class and child class
 
9:42 PM
why would OS matter anyway?
 
the key point is: an fqn is a path just like a filesystem path, so you can use filesystem functions for it as long as the path separators are something the OS understands
 
why not explode and get the last element? :D I think it's faster at this point :)))
 
@BogdanUngureanu try basename('\Foo') on windows and *nix
(they don't give the same result)
then note that basename('/Foo') works the same on both platforms
 
@BogdanUngureanu probably will have to resort to that. Kind of annoying.
 
@BogdanUngureanu but yeh probably this
@Tiffany yeh :-/
I think these days (>=7.1) you can at least do end(explode(...)) without it complaining about pass by ref
not even sure about that tho
 
9:45 PM
yeah, but FQCN is not dependent of OS. Sure, if you assume that PSR-2 used, you could use basename.
 
@BogdanUngureanu ...except that *nix doesn't understand \ to be a path separator
so you have to strtr or whatever, which means you may as well regex/split
\ as NS delimiter is one of my least favourite things about PHP
 
What I'm trying to say is that you don't need to use the fs to find the class name because cases like you've mentioned happen :D
 
:-P
 
or you could use reflection to get the short name :D
 
AFAIK, what I would be using it for wouldn't involve a filesystem in this specific case. I think it's just an assignment to a property to be used elsewhere. However, there is a chance the property is used in autoloading. I haven't dug far enough into the code to know for sure.
But it's near the end of the day so I'm going to worry about this tomorrow
 
9:54 PM
@Tiffany ftr I'm not saying this has anything to do with the filesystem, merely that fqcn happens to be in the same format as file paths, so you can bastardise those functions to do this task for they weren't really designed
it doesn't actually touch the filesystem, even under the bonnet, it's just parsing routines
 
@BogdanUngureanu 3v4l.org/HeHVN
 
@Tpojka yup
 
From object or from string 3v4l.org/epOv0
 
10:32 PM
Can anyone help me? What am I doing wrong? 3v4l.org/26Il2
I mean why doesn't it throw JSON_EXCEPTION?
 
(facepalm)
thank you
 
not sure if you can skip with null, should be like that
@Dharman took me a couple of mins of staring at it :-P
json_encode() screws you up
@Gordon you only got 2 years on me so don't stress :-P
 
can anyone think of a good reason not to allow null to skip the $depth arg of json_decode()?
not currently permitted. not sure if on purpose for some reason I can't think of
 
Why would it be nullable? Also now with named params you could just skip it if you want the default value
I find it weird that assoc is nullable
 
also, related, quite a few built-ins treat null as "use the default value", in many cases the docs don't reflect that, could we add ? nullability to the types in the docs in those cases? /cc @salathe
@Girgias it isn't nullable, as such, but there is a de-facto standard that a scalar arg with a default value can be "skipped" by passing null
 
That's not true actually
 
it would be better to allow the passing the default keyword at call-time to indicate that
but it is what it is
 
10:59 PM
Most of time it just failed, Maté and Nikic spent most of this year making the args actually nullable to pass them
 
@Girgias it's not consistent, but there are a lot of thing (esp old things) that work like that in practice
 
@DaveRandom Again for PHP 8.0 it should be fine as most internal functions have proper default values now
 
@Girgias I will have a look into this at some points, there are some specific cases in the past where it has come up on internals that I can't find quickly, I will see if I can find them and see if they are still true
also @Girgias there still remains the original issue: you cannot call json_decode() and pass a value for $options without providing an explicit value for $depth
 
Sure :) But just look at the stubs, only default values which cannot be described are if it's = UNKNOWN
 
arguably named params are the correct answer to that problem
 
11:02 PM
@DaveRandom Again named arguments fixed that because you just do options: $customOption but that's a 8.0 only feature
So I don't think we'll ever get default as a keyword for functions
 
fine, I basically didn't think this out
although I suspect there are some places where things are semantically-wrongly nullable that could be cleaned up (deprecated)
 
No problem, seems you haven't been able to keep up with everything PHP 8.0 related
@DaveRandom Oh for sure, overloaded functions/methods can't have proper defaults
PDO has a couple, Date too
 
@Girgias ...and to be super contrary, I actually don't see any harm in adding this, it results in obvious code and I'm pretty sure it could be done basically for free
(but not worth the effort)
@Girgias overloads are a whole other problem :-P
 
Oh probably, didn't Stas do a patch
 
I remember it being proposed ages ago, I haven't paid attn to internals for like 2 years tho
and in the 2 years before that it was patchy, at best
I got ground down pretty quick :-P
 
11:07 PM
Well I have only been following internals for a bit less than 2 years :p
 
I'll definitely take named params instead, I have seen a couple of things in the past get shot down on grounds of "we don't need it" even though adding it is harmless and it's perfectly valid, I feel like this might be one of those things but also maybe not
the ethos of PHP has historically been basically "there's like 9 ways you can do this", and while I'm glad to get rid of some of the madness I don't any reason not to have stuff that duplicates functionality but still reads obviously
but whatever, I don't care enough to actually do anything about it :-P
 

« first day (3664 days earlier)      last day (1267 days later) »