Skip to content

Instantly share code, notes, and snippets.

@chrisalexander
Created February 20, 2011 17:05
Show Gist options
  • Save chrisalexander/836105 to your computer and use it in GitHub Desktop.
Save chrisalexander/836105 to your computer and use it in GitHub Desktop.
How to abuse PHP's implementation of object privacy to do what you want.
<?php
class TestAbusingPHP
{
public $property;
private function Write()
{
echo '#' . $this->property . '#';
}
public function Abuse($variable)
{
$abuser = new TestAbusingPHP();
$abuser->property = $variable;
$abuser->Write();
}
}
$a = new TestAbusingPHP();
$a->Abuse('test');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment