Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Forked from anonymous/hack.php
Last active December 16, 2015 19:09
Show Gist options
  • Select an option

  • Save simonewebdesign/5482572 to your computer and use it in GitHub Desktop.

Select an option

Save simonewebdesign/5482572 to your computer and use it in GitHub Desktop.

Revisions

  1. simonewebdesign revised this gist Apr 29, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hack.php
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ public static function baz() {
    $code = '
    $foo = new Foo();
    echo $foo.bar();
    echo $foo.bar(); # dots in PHP. Cool huh?
    echo Foo::baz();
    ';

  2. simonewebdesign revised this gist Apr 29, 2013. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions hack.php
    Original file line number Diff line number Diff line change
    @@ -13,13 +13,11 @@ public static function baz() {
    }
    }

    $foo = new Foo();

    $code = '
    $foo = new Foo();
    echo $foo.bar();
    echo Foo::baz();
    ';

    $newcode = str_replace(".", "->", $code);
  3. simonewebdesign revised this gist Apr 29, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion hack.php
    Original file line number Diff line number Diff line change
    @@ -24,4 +24,4 @@ public static function baz() {

    $newcode = str_replace(".", "->", $code);

    eval($newcode);
    eval($newcode); // barbaz
  4. @invalid-email-address Anonymous created this gist Apr 29, 2013.
    27 changes: 27 additions & 0 deletions hack.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    <?php

    class Foo {

    public function bar() {

    return "bar";
    }

    public static function baz() {

    return "baz";
    }
    }

    $foo = new Foo();

    $code = '
    echo $foo.bar();
    echo Foo::baz();
    ';

    $newcode = str_replace(".", "->", $code);

    eval($newcode);