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
Staring Me Down
This lovely stag was keeping a keen eye on me walking past in Richmond Park. A lovely day out, but very few birds. Hoping c2c gets their railway sorted soon so I can get to Rainham again.
Grey Wagtail Forraging
This one is often shows around at the Ken Barratt Hide at RSPB Rainham Marshes.
#photography #Birds #BirdPhotography #BirdsOfFediverse #NaturePhotography #wildlife #RSPB #RainhamMarshes
Updated a pub
Updated a toilet; Deleted a toilet
I hiked 16.2km in 5h12m16s
Mary Had Two Little Lambs
#photography #SheepOfMastodon #Defaidodon #DyddDefaidodon #DefaidodonDay
Just Relaxing While Mom Makes Milk
#photography #SheepOfMastodon #Defaidodon #DyddDefaidodon #DefaidodonDay
Grazing on the Cliff Edge
#photography #SheepOfMastodon #Defaidodon #DyddDefaidodon #DefaidodonDay #shetland
I walked 3.7km in 1h15m13s
Survey housenumbers
Specify whether there are cycleways
Specify whether roads have sidewalks
New layout
I walked 7.9km in 1h34m09s
Little Egret Looking Sharp
I always like looking at these birds. They move so gracefully, but are also fun to see catch fish.
#photography #Birds #BirdPhotography #BirdsOfFediverse #NaturePhotography #wildlife #wwt #london
Updated an entrance
I walked 9.1km in 1h44m35s
Iridescent Colours
This Lapwing, one of about a hundred in the flock, nicely stopped to pose for me. The sun was getting lower making its wings shine in iridescent colours. In winter many flock together here at the London Wetland Centre.
#photography #Birds #BirdPhotography #BirdsOfFediverse #NaturePhotography #wildlife #wwt #london
Go with 2026.03
Merged pull request #189
Survey hairdresser's customers
Specify bicycle parkings covers











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