Created
February 20, 2011 17:05
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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