test 2
Today I learned
- Edited
Test #3
No Change to the Forum List... Thread did not move to the top.
TEST #4
Test #5
Test #6
Test # 6
Test #7
Test #8
NB: I got the "this thread is rather old" warning when I started to post.
TIL that Salads > Pizza for attention's sake, though pizza tastes much better. #Wait #AlreadyKnewThat #ZZZZ #CarbLoaded2pm....
Test # 9
- Edited
TIL (not really today, but it came up again today) that a nonbreaking space is a valid character that can be used in identifiers.
<?php
$fo = 42;
$fo = 17;
echo $fo ;
Outputs 42
because of course that's $fo
in the first and third positions, but only $fo
in the middle.
And it's also valid in constants as well (strictly speaking, almost all strings are valid as constant names, but most of them can't be used without wrapping them in constant()
):
<?php
define(' ', 42);
function foo() { return ;}
echo foo();
Edit: Hey; still got the error message but the thread got bumped to the top of the list!
Weedpacket TIL (not really today, but it came up again today) that a nonbreaking space is a valid character that can be used in identifiers.
YUCK. I do not like this idea very much. Seems like it opens the door to security problems.
- Edited
TESTING #10
Looks like the issue was fixed and the error has gone away and this and other thread move to the top as expected.
EDIT: Or maybe not.:
- Edited
Yeah, the "last replied" didn't update either.
On subject:
Did You Know:
PHP's "__construct
" is just a well-known name for an ordinary instance method? The only special treatment it gets is the property promotion syntax and an exemption from type variance constraints.
class Foo
{
public function __construct(public int $prop)
{
return 'Hello, World!';
}
}
$k = new Foo(42);
echo $k->prop, "\n";
echo $k->__construct(17), "\n";
echo $k->prop, "\n";
- Edited
sneakyimp YUCK. I do not like this idea very much. Seems like it opens the door to security problems.
It's nothing new; this has always been the case with PHP. So if there is a security hazard (which requires bad actors having write access to source code) it's one that has always been there. It's no different from
<?php
$fo=42;
$fο=17;
echo $fo;
except a little more fragile (because nonbreaking spaces don't copy-paste quite so reliably as omicrοn) and harder to spot if syntax highlighting doesn't assume all identifiers are in ASCII.
- Edited
TIL:
function cmp($n, $m) { return $n - $m;}
$el_gordo = 3*(PHP_INT_MAX >> 2);
$data = [0, 1, 6, -42, 25, -1000, $el_gordo, -$el_gordo];
usort($data, cmp(...));
echo join(' ', $data);
When passed $el_gordo
and -$el_gordo
, cmp
returns a double (equivalent to (3/2)PHP_INT_MAX
) instead of an integer. and usort
doesn't like that. It won't complain, but it doesn't like that.
Weedpacket 3*(PHP_INT_MAX >> 2);
You've always loved breaking stuff, haven't you?
Today I tested # 11
- Edited
shell>ls | grep PZCF
PZCFBLSBL
shell>mv PZCFBLSBL PZ/
PZCFBLSBL: no such file
shell>file PZCFBLSBL
PZCFBLSBL: no such file
dale>wget mad.jpeg
...
shell> ls -Aqb | cat -v | grep PZCF
M-0M-?PZCFBLSBL
shell>mv *PZCFBLSBL* PZ/PZCFBLSBL
dale>wget happy.jpeg
Today I learned this thread is still alive