« first day (3435 days earlier)      last day (1513 days later) » 
00:00 - 14:0014:00 - 00:00

Jpv
12:37 AM
Anyone expert on laravel? I'm trying to see if i can have a Service Provider output routes dynamically based on my db. Can i dump a service provider method out on web routes?
 
12:57 AM
 
1:10 AM
mysqi as a sub-namespace of PDO makes no sense, as mysqli doesn't use PDO. :-)
 
Oh I left an i on it, force of habit.
 
Also, does "exclusively classes" include interfaces, traits, and potentially other class-esque things that may be autoloadable in the future? What's the reason for making it class-ish only?
 
Yes, I can clarify that, anything class-like e.g. what would currently be autoloadable
 
For what reason?
 
Cleaner grouping, better opportunity for versioning, and not as ugly as sin when "use"ing
 
1:20 AM
@MarkR haven't sent it to the mailing list?
 
Not yet, still a draft
 
Oh, it's a draft
Lol
Good luck :D
 
Derick is going to be... displeased.
But I don't see the point in keeping on prefixing new things with PHP when there's a perfectly good namespace system
 
Yeah
 
Trump just blocked europe from travelling to the US... the stock markets are going to fall 10% tomorrow
... make that 20%
 
Jpv
2:17 AM
MURICA! ;)
 
2:36 AM
@MarkR Blocked for how long?
@MarkR I doubt this will pass; it's not anything close to the informal direction established in this chatroom.
That direction is that the PHP namespace is for things directly related to the PHP language. So PHP\Token would make sense.
Dumping a new container type would not be appropriate there -- has nothing to do with the language. New array function? Nope.
Also, I'm very against the highly nested namespaces that people tend to use. I'm fine with two namespace prefixes: one between projects/libs (e.g \PDO or \Datadog) and one more because even some orgs and things are pretty big, so Datadog\Trace and Datadog\Statsd. Almost anything more than that really drives me nuts. This particular message is definitely my own opinion that I haven't seen discussed, but the other bit seems roughly agreed on.
So yeah, \PHP\Databases\PDO\Postgres has me triggered lol
You can perhaps persuade me for the 3rd segment, but not the 4th. Nope, nope, nope.
 
Lim
3:14 AM
May I ask
I encountered an internal server error when I am running the website domain I am coding currently
I made some changes towards the code of the login page which resulted me to have that error
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if(isset($_POST['signin']))
{
$uname=$_POST['username'];
$password=md5($_POST['password']);
$sql ="SELECT * FROM tblemployees WHERE emp_username=:uname and Password=:password";
$query= $dbh -> prepare($sql);
$query-> bindParam(':uname', $uname, PDO::PARAM_STR);
$query-> bindParam(':password', $password, PDO::PARAM_STR);
$query-> execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
if($query->rowCount() > 0)
{
foreach ($results as $result) {
 
3:53 AM
@Lim Sorry that I cannot help you. However, using MD5 for passwords is insecure and frankly a disgrace in 2020. Please learn how to properly hash passwords.
A good place to start is password_hash in PHP.
 
4:32 AM
> frankly a disgrace
"Frank" is offended his namesake was used to describe this atrocity.
for y'all -- I'm working on a "pair programming" interview exercise, and I'm trying to come up with gotcha-esque problems to embed.
So far, I've got a case that covers "accidental" mutable state (and bugs resultant from)
What's another common "gotcha" problem that'd be suitable?
 
Jpv
5:08 AM
@Lim u might want to start by setting error_reporting(E_ALL) so you can start debugging
 
Lim
Oh I just solved the problem
but now my problem is that it will not redirect back to the page it's supposed to go after detect the user is not logged in
<?php
include('include/config.php');
include('include/config1.php');
session_start();
error_reporting(0);
if(strlen($_SESSION['emplogin'])==0){
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
header('location:../indexPM.php');
}
?>
 
Jpv
@Lim are u trying to send back to homepage?
 
Lim
as in?
 
Jpv
well.. first of i would try to set location to Location .. per php manual
 
Lim
So I have this snippet of code in all the page to detect if the user is logged in or not and if they don't they will direct to the login page
 
Jpv
5:14 AM
right, and had that been working before?
if not, header('Location: ../indexPM.php');
 
Lim
and once the user did log in, if they didn't come from a previous link (that detects that they're not logged in), they will go to the dashboard
indexPM.php is the login page
dashboardPM.php is where the default direct if they user didn't come from other existed link
 
Jpv
right, so it has to do with your header()
have you check if your if is meeting criteria first? i would start debugging there.
 
Lim
okay
Yes
It does but it just won't direct back to the previous link
the user can direct to indexPM.php if detected they're not logged in
but once they're logged in they just direct to default dashboardPM.php instead of the previosu link via PHP_SELF
 
Jpv
but they logged in from indexPM right?
and your form is sending them to dashboardPM?
So your login form must be POST from indexPM and action to dashboardPM? or u have an authentication middle ware that will redirect accordingly?
 
Lim
5:33 AM
no authentication
yes they logged in from indexPM
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if(isset($_POST['signin']))
{
$uname=$_POST['username'];
$password=md5($_POST['password']);
$sql ="SELECT * FROM tblemployees WHERE emp_username=:uname and Password=:password";
$query= $dbh -> prepare($sql);
$query-> bindParam(':uname', $uname, PDO::PARAM_STR);
$query-> bindParam(':password', $password, PDO::PARAM_STR);
$query-> execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
if($query->rowCount() > 0)
{
foreach ($results as $result) {
here's the code
 
Jpv
hmmm so you are re directing to dashboardPM via js
try document.location = window.location.hostname + 'PMSystem/dashboardPM.php';
Correction:
document.location = window.location.hostname + '/PMSystem/dashboardPM.php';
 
Lim
it gives out double the link
it's better to exclude the window.location.hostname
and it still doesn't work
direct the user back to the previous page
 
Jpv
well if you are seing your alert it means that your php is fine
oh its directing them to your login page
so your if is wrong
coment out header
and do a var_dump of your sessio
and see if ['lastPpage'] is set
hell. do a var_dump($_SESSION['last_page']) and see if is true
 
Lim
5:51 AM
where shall I place the var_dump?
 
Jpv
before your if. so do your var_dump($_SESSION) and die(); after
 
Lim
<?php
include('include/config.php');
include('include/config1.php');
session_start();
error_reporting(0);
if(strlen($_SESSION['emplogin'])==0){
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
header('location:../indexPM.php');
}
?>
In this snippet?
 
Jpv
include('include/config.php');
include('include/config1.php');
session_start();
error_reporting(0);

echo '<pre>';
var_dump($_SESSION);
echo '</pre>';
die;
and show what u get
 
Lim
it does
so the PHP_SELF is alright
 
Jpv
well the problem is that you are $_SESSION['emplogin'] is 0 , and your header is sending you to your login page
so your emplogin must be something else for it to not send you to your login page
 
Lim
6:03 AM
Oh! it is needed to be send to the login page
when the emplogin is 0
0 means they are not logged in
 
Jpv
right so that piece of code is correct
 
Lim
yes
 
Jpv
but somewhere else you are defining emplogin as 0 when it shouldn't b
when you fetch the user from your db
why are you iterating expecting multiple users
 
Lim
wait I think
I found the problem
I will go and modify it now
okay! I fixed it
 
Jpv
nice x) . i would consider moving a framework, or even something like wordpress. it will save u lots of time with authentication, redirecting, security, etc...
 
Lim
6:15 AM
Tru tru
but I was assigned to use php
so I have no choice AHAHA
huh
strange
the last_page it says it's dashboardPM.php instead of the page I am at
$_SESSION['last_page'] = $_SERVER['PHP_SELF'];
via xammp
 
Jpv
6:32 AM
why are u using last page?? just send em to your login page that thats it
 
@MarkR that's quite brave
 
Lim
7:01 AM
okay
so _SERVER['PHP_SELF']
I wish to know if the link as a .php?id=
how to get that in?
 
Lim
7:44 AM
it did not tackle the ?id=
 
preg_match('/(.php?id=)/', $url, $matches, PREG_OFFSET_CAPTURE);
 
Lim
8:06 AM
?
$_SESSION['last_page'] = $_SERVER['PHP_SELF']
preg_match('/(.php?id=)/', $url, $matches, PREG_OFFSET_CAPTURE);
?
@Bir
@Bira
 
Lim
hi
 
8:29 AM
@NikiC I'm not sure you saw this short discussion yesterday about covariant properties: chat.stackoverflow.com/transcript/message/48824864#48824864 I think property injection is a legit use-case (whether we agree or disagree with this practice. Personally, I think it is ok to do in a controller - but nowhere else) that might break if a property is overridden in a child class with a different type. Or maybe is it not a problem in practice?
 
Lim
8:52 AM
problem solved
$_SESSION['last_page'] = $_SERVER['PHP_SELF'].'?id='.$_GET['id'];
 
I mean, setter injection is the problem like how Mark said, like in this example: 3v4l.org/DQ3To (I needed an example to be able to see the problem)
 
@MátéKocsis I was hoping people wouldn't do that :P But yes, I think you can say that this is not supported and add that example as the rationale in the rfc
 
@Lim in general don't use PHP_SELF, use REQUEST_URI
 
9:14 AM
Comparison problem ・ Variables related ・ #79370
 
@AsyncBot :)
 
@LeviMorrison One level deep doesnt make any sense at all when considering long-term of use of namespaces.
If you did PHP\Token then that rules out any future developments calling anything else token, unless they prefix it with their module name, at which point you've just wasted the entire point of namespaces
user image
7
 
lololol
 
cmb
@AsyncBot at least someone who actually uses var_dump() to inspect the floats :)
 
@Andrea I've been thinking a bit about how to combine byte and char based strings in one API... gist.github.com/nikic/124223f324cc1abdf727ba15406ae128
Not sure how horrible that is...
 
@cmb I love how passive-aggressive the "Thank you for your interest in PHP" is. It definitely reads as "f**k off and learn how IEEE754 works"
 
@cmb Oh indeed. I added a comment...
 
cmb
9:47 AM
@DaveRandom indeed, several of these snippets are really a slap in the face; I tend to avoid them, but sometimes they are in order
Thanks Nikita!
 
@NikiC At which point would it detect if it were valid UTF8?
 
@MátéKocsis I'd say that at this point, default values for write-once properties should be dropped, no?
 
@DaveRandom Thank you for making my day
 
as in: shouldn't parse
 
9:51 AM
@MarkR When a utf8 based API would be used. (Nowadays we can cache utf8 validation, so this would not be repeated)
 
!!blame @DaveRandom
What happened to Jeeves?? What'd I miss? Did you write him in JavaScript instead?
 
!!blame @PeeHaa
 
!!blame @PeeHaa
 
@Jimbo I thought you'd like that one somehow :-P
 
@DaveRandom You're the new human jeeves API
 
9:55 AM
@NikiC Interesting. I still think the problem would be best solved by something generic-like, maybe with a cast.
 
actually @Jimbo I have another one you will prob like
 
you are indeed correct xD
 
@MarkR We only have the one string type though. For a core solution, it would have to look something like this I think. For userland, having separate string types may make more sense (e.g. what Symfony does)
 
string<utf8> (or just uft8) where utf8 would be a class exposing all the different methods as statics, taking a always-binary string a the first arg.

string<T> {
   private $str;

   public function toUpperCase(): self {
       return T::ToUpperCase($this->str);
   }
}

Would be represented internally by attaching a zend_string_encoder into zend_string, which would just be a set of zend_function *get_length; zend_function *substr; etc
 
it's not "UTF-8", if anything it's "unicode"
but it's not even that, it's an abstract collection of characters
the fact that it's internally represented as unicode code points is immaterial
 
10:06 AM
Tell that to UTF-16
 
I realise that may seem like nitpicking but it isn't, it's precisely this muddying of terms which results in the fundamentally flawed concept that it even makes sense to be able to treat a single structural type as both a char array and a byte array
strings are all collections of characters, and byte arrays are all raw data with no meaning, and converting between the two should be done explicitly in all circumstances
<throws toys out of pram>
 
there there chris, it's all going to be okay ...
 
@MarkR That's the kind of stupidity I would rather avoid
 
@JoeWatkins It bloody isn't though, is it? PHP strings are always going to be binary first, and we are forever going to be stuck in this weird purgatory, where what needs to happen is to throw the whole thing in a river and throw the river into the sun and start again. I think I will just walk into the sea.
:-P
 
How exactly is storing the encoding along with the string stupidity?
 
10:11 AM
because it implies that there is more than one internal encoding.
 
This is a discussion about exposing userland methods for manipulating it, is it not?
 
I don't think I'm capable of contributing constructively to this :-P
I am irrationally pissed off about it, I can feel it but I can't seem to get past it
 
I must be the only one who doesn't spend most of my time struggling with strings ...
 
@JoeWatkins Not just you :)
 
Even if you store the entire thing internally as a byte array, if you want to have a userland interface that can, say, return a substr of full characters or bytes, you either have to either have <n> methods for each encoding or store the user-expected encoding alongside the byte array. There are no alternatives.
 
10:17 AM
@JoeWatkins I actually don't though, that's the thing, I can work with it as it is and it's fine because strings as they stand are just byte arrays. Where the problems arise is when people expect to be able to treat them as something else.
 
I'm missing context, but why on earth would you want to hand over that sort of control to userland in the first place ?
 
in other words, I'm perfect and it's everyone else's fault
 
@MarkR The point where you're going wrong there is the "return a substr of full characters or bytes". Ideally that operation doesn't exist
It should be a substr between two positions in the string, where the "position" should only be derived from a raw byte/char offset in the most unusual of circumstances
 
sup
@MarkR Happy to talk you through this - I was heavily involved in the unicode support in PHP 6.
 
10:33 AM
Then how to handle the case where the length is unknown? A simple example such a person's initial in their name, the start position can be known, but how about the length, does that not require knowledge of the underlying encoding and char tables?
 
@Ocramius I suggested that at some point as well, but it might not be a good idea long term, taking public readonly Foo $foo = new Foo(); into account.
 
@MarkR Char tables won't help you either. You need to scan forwards in every case.
That's why intl's char (and friends) iterators are quite useful. Too bad that intl is such a shit API.
 
@MarkR Sure, you'd peak the character iterator for that.
 
just code points alone aren't good enough either, as there are combining diacritics that make up characters out of multiple of them
 
Oh, maybe the disconnect here is that you think encodings other than UTF-8 and binary exist
 
10:35 AM
that doesn't require you to just know the encoding, but also ... pretty much all of Unicode
 
They don't. Other encodings are just binary that hasn't been converted to UTF-8 yet.
 
@NikiC Other encodings do exist :-þ You shouldn't really be using them for transport, but internal encodings can make sense. But not UTF-16.
 
@Derick Other way around
 
and UTF-32 is wasteful (and still not "one code point per character")
 
You can use other encodings for transport, but internally only UTF-8
And by "transport" I mean interaction with legacy APIs
 
10:37 AM
UTF-8 was designed as an in/out encoding... so that's not quite right either
 
I was more thinking that a future scalar method string API would want provision for handling binary strings, as well as UTF-8, and would need a way to differentiate them. As presumably, just because something is legal UTF8 doesn't mean the user wants to treat it as such
 
@MarkR Don't conflate the two. THey are very different concepts. "array of bytes" vs "string with unicode semantics"
 
@Derick omg thank you, someone is finally talking sense
PHP strings are currently the former. If you want to turn them into the latter, knock yourself out, but ffs don't attempt to make them be both
 
That's a pretty shallow view
 
I'm happy to design a sexy API for byte buffers to complement it
 
10:43 AM
Nobody does raw unicode characters
Unicode characters only exist encoded ... as an array of bytes
And to be clear, PHP strings will always stay an array of bytes first, and anything else second
The question is more whether the interpretation of that array of bytes as a UTF-8 encoding of Unicode code points can be more ergonomic and efficient than it is right now ;)
 
I know that, and you know that, the problem is that the great unwashed do not understand that
 
gist.github.com/nikic/124223f324cc1abdf727ba15406ae128 it's this I'm not getting. If charLength returns the number of characters, is that determined exclusively by isUtf8()? So if it is a binary string which just happens to meet UTF8 specs, if treating it otherwise requires another method (byteLength) or if that should be part of the object itself.
 
@NikiC @Ocramius Removing support for default values has a little bit more raison d'etre than before but I'm not sure if it's really a problem in practice. Not everyone wants to use proxying together with read-only properties with default values. And if someone has a problem with it then they can just replace the default value to an assignment
 
@MátéKocsis Your podcast ep is out just now!
 
@Derick Thank you! :)
 
10:49 AM
@NikiC is gist.github.com/nikic/124223f324cc1abdf727ba15406ae128 a proposed API for something by you?
 
@MarkR The way that particular suggestion would work is that charLength() throws if the string is not utf-8. byteLength() would always work. Some for any other methods that have a char/byte distinction.
@Derick No, just some thought experiments
 
@NikiC OK, because that's terrible :-þ It's conflating the "byte array" vs "string with unicode semantics" cases
 
Basically, what we would have to do if we wanted to have a "scalar objects" based string API. It would either have to be byte-string only, or it would have to be hybrid.
 
@NikiC wouldn't that be something that can be added later? As in parser error now (unsupported), and later becomes a feature? As they currently are, they're constants otherwise...
 
Ok, so splitting the encoding types by method rather than the string itself being aware of what it is after initialization and needing a conversion to handle otherwise. Fair enough.
 
10:52 AM
@Derick The audio length is not right :) You forgot to crop the 2/3 of the episode ^^
 
I think the only sensible way is to add a new "String" class (not with that name), that encapsulates the "string with unicode semantics" feature. I've been meaning to look into this for a decade, but can never find the time
@MátéKocsis I know! I don't know why that lenght is off. I upgraded a tool, so not sure what's the problem. Need to dive into that soon
 
something like that, but also better supported in the engine
 
@Derick OK, not a big problem for me :)
 
@MarkR Yes. I do think it's generally better to have those as two separate types, just working under the constraint of how to make it fit into one
 
10:54 AM
I wouldn't try that at all... In any case, I think the last time I looked at Ustring is that it didn't do combining diacritics right.
My train's just pulling in, but happy to chat about that later.
 
This is making my head hurt a tad, but isn't Joe's ustring effectively just attaching the codepage to the string?
That seems very like string<spec> except it's being passed as a string argument rather than as a type that could be hinted to enforce that a string meets the codepage requirements (did I mix up codepages and encodings?) ... anyhowww, work time
 
11:16 AM
Why not having u"Unicode string with codepoints" and "normal string" as it is now ?
 
32 mins ago, by NikiC
And to be clear, PHP strings will always stay an array of bytes first, and anything else second
thus, the problem is not declarative, unless you are genuinely introducing a separate type
 
b"really?"
 
b"💩"
 
function foo(ustring $foo) :D
 
> why does foo("a string") not work?
 
11:19 AM
That's what auto boxing is for
 
meybe it should, but if function foo(string $foo) then maybe foo(u"💩") should not
 
@MarkR yes, but that suddenly becomes dependent on the encoding of the source file
(ftr I would have zero problems with mandatory UTF-8 source code)
 
ufread(): ustring :D
OMG
 
foo(string $x) - accept a string with any codepoint

foo(string<utf8> $x) - accept a string so long as it conforms to utf8 codepoints. Any methods will return another string<utf8>.

foo(string<ascii> $x) - accept a string and prep it with ascii codepoints (effectively byte array).

Pass them an interned string and it would check (and cache) when boxing?

Obviously string<utf8> is ugly as hell, so alias it.
 
Hello everyone, sorry to interrupt, I am kind of a beginner PHP programmer. I am interested in how exactly php deals with an array('empty'=>''); espesially the key empty. I've ran into a small proplem when parsing another array and checking $key=='empty', but it doesn't really deserve a question, because I am just searching for a place where I can read dealings with PHP array keys myself. Any good source is appreciated.
 
11:31 AM
I think string<Encoding> is a good idea - as long as it's really still a string and the encoding is transient information which gets lost as soon as it is passed to a type expecting string.
and Encoding is automatically re-verified if string is passed to string<Encoding>
 
@EugeneAnisiutkin a string containing the word empty is nothing special for PHP. Do you have some more context about why it should be special?
 
You might need this bit as well for the convo @bwoebi - gist.github.com/nikic/124223f324cc1abdf727ba15406ae128
 
I saw that one
 
@Sjon On array("no", "yes"); a check $key == 'empty' holds true. I was a bit stumped
 
Erasing the information would mean it couldn't be used for scalar methods, no?
 
cmb
11:47 AM
@EugeneAnisiutkin see 3v4l.org/ukmRU (that's not a bug, but one has to be aware of that)
 
/me dies a little inside
 
@cmb I am actually wondering why the hell does that hold true. I've run into that exact comparison problem. Any specific reason? Is it even documended anywhere?
 
Is this a bug in 7.4: paste.debian.net/plain/1134634
7.3 does the right thing: paste.debian.net/plain/1134635
 
@Sherif looks like a bugfix in 7.4 to me?
 
@bwoebi How's it a bug fix?
Shoulnd't errors go to stderr?
It's an uncaught exception
 
ah
@Sherif yeah makes no sense
 
@bwoebi So is it a bug?
 
In unrelated news - wiki.php.net/rfc/php_namespace_policy - I await the hate.
 
@cmb, Ah, And 'empty' in this case converts to 0. Forgot that bit about numerical ans string comparissons.
 
@MarkR How about mild distain?
 
11:59 AM
@Sherif Not good enough - youtube.com/watch?v=1LyKBfp3ov0
 
LOL
love that guy
 
12:09 PM
@MarkR It's not April 1st yet…
 
oh snap
 
I'm not joking. How many symbols are there in root now, 5 or 6 thousand?
 
@brzuchal You want to redo the PHP 6 project?
 
@Derick no, definitely not
I wish things could go faster
 
cmb
@MarkR depends on which extensions are loaded ;)
 
12:20 PM
I could put my own wish list for completeness but that's pointless
 
If I put thousands of items in a single namespace in PHP, I'd get fired... not from my job, someone would literally come along, pour petrol over me and set me alight.
 
@MarkR pollution is bad because it has bad effects ... it seems like you're saying that the number of classes is itself a bad effect and then calling that pollution ... what exactly is the problem or problems with having a high number of classes (or any classes) in the root namespace ?
also, I just can't see a way forward for this, at all ... not in the long term nor in the short ... there can never be a version of php which doesn't understand new stdClass ...
or new Date or whatever, it would break the internet, and will never be worth it ...
@MarkR language and application design are two very different disciplines with very different concerns ...
 
Lack of logical grouping means that _everything_has to come with a long prefix. I'm not suggesting the great purge, not right now anyway, but continuing to pile more things into it is digging a deeper hole. Namespaces obviously have their uses, almost every piece of modern PHP code takes advantage of them for very good reasons.
 
php-cli 7.4.3 does not send exception message to stderr ・ Output Control ・ #79372
 
inside of this box that I have resides a creature of unimaginable horror, you can't see the creature, or touch it, or hear it or smell it or otherwise sense it, but it's there ... in order to avoid the creature, I'd like to introduce [a bunch of] new rules ...
 
12:30 PM
IMO to argue against namespaces for internals classes, you have to argue against namespaces entirely, and that argument was lost a decade ago which is why almost every PHP package on earth (outside wordpress) uses namespaces.
 
no no
different concerns
also, it's a fact that we have a bunch of stuff in the root namespace that we can never move, or we will break the internet
say we start using a namespace next week for everything new, without breaking BC, in 10 years, PHP will be an utter mess, moreso than if we just keep using the root namespace ...
 
Some stuff yeah. Although nothing a single pass from a migration scanner wouldn't solve in 99.999% of cases.
 
sure, but only 0.0001% of users know what one of those is, or how to wordpress it ...
 
If Nikic ever makes one, IMO it should probably come bundled with PHP
But what's that phrase... when you've found yourself in a hole, stop digging
 
well you still didn't actually point out the hole, you're just saying it's there ...
 
12:37 PM
The hole to my mind is that the policy of using root namespace forces people in to having to prefix their classes / functions / constants, effectively trying to work in namespaces through the back door.
 
Morning
 
@MarkR there's a grammatical error in your meme, not sure if it's intentional or if you care
 
application code should obviously be in a namespace, if someone on a team I review for tried to put code in the root ns, I'd kick them in their shins
 
@Tiffany I noticed there's a error (see what I did there)
 
Lol
 
12:40 PM
@JoeWatkins What's the big difference between application code, and internals adding say... \PHP\Tokenizer\Token or \PHP\Engine\Annotations\JIT ?
 
@MarkR no. no. no.
 
@bwoebi 404 - Reason not found.
 
@MarkR keep internal things easily accessible without the need for extra import
 
if we ever did have to change the API for JSON, or tokenizer, it would not make sense to force that to be a breaking change by forcing us to accept that new code must go into a namespace
we already have \PHP reserved, and in the whole history of PHP and namespaces nobody ever managed to provide a good reason to use it ... and you want to force hands in the absence of that reason ...
 
@JoeWatkins This came from discussing engine-specific annotations which should be pre-loaded and validated upon compilation. The obvious solution was that all engine related annotations should be in a namespace under \PHP, thus allowing them to be differentiated from others.
 
12:49 PM
@MarkR what's the gain? people will import it.
and then you cannot really distinguish it where it matters - at the location where the annotation is used
 
I don't follow.. if it's imported then you already know exactly what it is
 
aye, aren't unqualified names resolved to fqns at compile time?
 
Personally I don't see the problem with use statements. Pretty much every language except C groups their standard library by namespace and expects people to either fully qualify or import. Things like stdclass etc do belong in the root, like .net keeping the base types in it.
 
for attributes we might need Builtin\ as namespace to differentiate which attributes to load at compile time and which at reflection time. But i am walking back on PHP\ namespace here. if you have <<\Builtin\Jit(true)>> its less necessary to use the attribute and you could make the absolute reference. from a documentation perspective better, you don't need to add the use statement to every example
i was shortly thinking about hacks <<__builtinattr>> naming, but thats too much reminding of magic methods :D
 
Isn't \builtin just effectively claiming another top level namespace?
 
1:01 PM
^
I don't see the difference between \BuiltIn\Jit and \PHP\Jit
 
I prefer the latter
 
One starts with a B and another with a P
 
the only rule needs to be that namespace PHP; in userland is a compile error
(if you want compile-time handling)
 
what about pollyfills then?
 
35 secs ago, by DaveRandom
(if you want compile-time handling)
 
1:03 PM
i am not claiming the namespace, it can be used by others, but the code needs a string based approach to decide which attribute have to be resolved at compile vs refleciton time
 
oh right, so it will trigger autoloading at compile time a la implements?
that works I suppose
 
ahh get it, it won't trigger autoload for `\PHP` prefix
 
No I think the point is that it will trigger it, only for that
 
Anything in \PHP should be known at compile time IMO
 
1 min ago, by brzuchal
what about pollyfills then?
@MarkR ^ except that
it's a trade-off, I don't think you can have it both ways
nor do I have a strong opinion either way
 
1:06 PM
errr I meant annotation wise sorry
 
ah right yes I suppose they are separate concerns vs regular class defs
 
Generally I think \PHP should be userland accessible to add polyfills but it should come with a notice along the lines of "Are you are a guest here"
Things like annotations can be off-limits though
 
@NikiC something along these lines is what I have been thinking about. will look at it properly later today (when I am not at work :p)
 
Good morning everyone.
How do I get the (para = '2'), since I will only have the value of the variable (de)?
would an alias solve?
 
@Tiago don't you just want WHERE de = :de AND para = 2?
 
1:19 PM
This is a messaging system. I'm doing it with mySQL, because everything needs to be registered for at least 1 year. And if there is any occurrence you can analyze the conversation.
@DaveRandom I'm gonna explain
@DaveRandom I'll separate it like that to make it easier. Contractor = ID 1. Customer = ID 2
On the PHP screen, I was doing this:
  $rsMsgLer = $mysqli->query("SELECT * FROM mensagens WHERE de = '".$_SESSION['ID_Cadastro']."' GROUP BY projeto ORDER BY data DESC");
 
<Obligatory warning about SQL injection>
 
This logic of mine is wrong, because it will always look for (de =)
@DaveRandom I will do the treatment later, I am simplifying to see it working.
@DaveRandom Did you understand the logic?
 
sort of, are you looking for a way to change which column you are using to search by?
 
@DaveRandom Between (de) and (para)
 
@Tiago I would say just do this:
 
1:31 PM
If I am the contractor, I will see the list of projects that I have sent messages. Now if the person logged in is the customer he will see the projects he received message.
@DaveRandom Please see: sqlfiddle.com/#!9/d506b7/1
 
if ($shouldUseDe) {
    $query = "SELECT * FROM mensagens WHERE de = '".$_SESSION['ID_Cadastro']."' GROUP BY projeto ORDER BY data DESC";
} else if ($shouldUsePara) {
    $query = "SELECT * FROM mensagens WHERE para = '".$valueForPara."' GROUP BY projeto ORDER BY data DESC";
} else ...
don't try and do some complicated clever SQL based thing, it will be slow and error prone
just choose the right query on the PHP side
you can obviously abstract that a bit to make a more universal shared template
the key point is though: use PHP to make the decision, not MySQL
 
@DaveRandom Thanks for the suggestion, I will work on it.
 
/me eats lunch
btw everyone @DanLugg eats babies
ohai @DanLugg, didn't see you there
 
@DaveRandom Last question. Do you have a suggestion on how to get ($ shouldUseDe)? Currently I only have the user ID when he logs into the system.

With your experience, would you have a better suggestion?
 
@DaveRandom Thanks for the laugh, good way to start the day :P
 
1:48 PM
What is the correct way to make this consultation?
(SELECT *, de as user FROM mensagens WHERE user = '1' GROUP BY projeto ORDER BY data DESC)
	UNION
(SELECT *, para as user  FROM mensagens WHERE user = '1' GROUP BY projeto ORDER BY data DESC)
 
@DaveRandom Dude WTF, I haven’t done that in months.
Strangely it correlates with avoiding active PHP development.
 
@DanLugg negative correlation. presumably
@Tiago you need to know what sort of user it is, I guess that's in the user table? You need to store more than just the user ID
 
Is there a way to return a list of rows and columns that were affected after executing an insert/update query?
 
@MátéKocsis what is your PHP email address? I want to put the consistent float to string RFC onto the wiki and want to mark you as co Author
 
@DemCodeLines Yup, look at DELETE RETURNING postgresql.org/docs/10/sql-delete.html
 
1:59 PM
@Girgias have a look at this wiki.php.net/rfc/locale_independent_float_to_string :D :D
 
Oh :D
You already did
 
00:00 - 14:0014:00 - 00:00

« first day (3435 days earlier)      last day (1513 days later) »