Private Properties Exposed
For our Components project we are ofcourse writing unit tests (with PHPUnit ). Sometimes you would want to test whether a private property contains the correct data, and of course with the normal visibility rules you can't access those from your unit test. There is an interesting trick for this, which I'll share here:
<?php
class foo {
private $bar = 42;
}
$obj = new foo;
$propname="\0foo\0bar";
$a = (array) $obj;
echo $a[$propname];
?>
Comments
$f->{"0Foo0id"} (for private members) and $f->{"0*0name"} (for protected ones) used to work. Too bad someone added a "Cannot access property started with '0'" fatal error to the Zend Engine in the meantime, making necessary the array-cast hack presented here...
I'd rather have ReflectionProperty->setAccessible(TRUE) like (insert other programming language here):)
Life Line
Updated a pub
Merged pull request #1104
Drop support for PHP 8.1
Merged pull request #1103
Drop support for PHP 8.0
Merged pull request #1102
Upgrade composer for benchmarks
Merged pull request #774
PHP 7.4 has not been supported for a while
Fixed issue #1674: Inconsistent Path & Branch Coverage Reported
Merge branch 'xdebug_3_5'
Merged pull request #1101
Fixed issue #2436: Potential crash when remembering on which lines br…
I walked 8.0km in 1h30m48s
Footpath connectivity (and removing some useless/wrong ones)
Merged pull request #1063
Add 'make test-frankenphp' which also sets the current PHP version
Fixed issue #2403: Reinit debugger for requests in FrankenPHP worker …
Just stood outside for a few minutes and I got some actual rain drops on my head! The first in like two months. 🌧️ #ukrain
Updated a pub
I walked 0.8km in 10m30s
I walked 7.7km in 1h30m26s
I walked 6.7km in 1h7m37s
As I said yesterday, I never saw a Kingfisher hovering, but here is (some slightly blurry) evidence of one doing so.
#BirdPhotography #Birds #BirdsOfFediverse #Photography #Nature #NaturePhotography
Kingfisher Caught Its Lunch
This lovely chap caught a fish right in front of us, after hovering for a while.
It seemed pleased with itself, and instead of flying away to feed it to its kids, it ate it.
#BirdPhotography #Birds #BirdsOfFediverse #Photography #Nature #NaturePhotography



Shortlink
This article has a short URL available: https://drck.me/ppe-46g