Skip to content

Instantly share code, notes, and snippets.

View tobiasgies's full-sized avatar

Tobias Gies tobiasgies

View GitHub Profile
@tobiasgies
tobiasgies / invokeable.php
Last active August 29, 2015 14:07
Invoke class property test
<?php
class Invokeable {
public function __invoke() {
echo "Hello World!\r\n";
}
}
class Container {
private $_invokeable;

Keybase proof

I hereby claim:

  • I am tobiasgies on github.
  • I am tobiasgies (https://keybase.io/tobiasgies) on keybase.
  • I have a public key whose fingerprint is 4919 6569 161F C376 4768 4736 B07B 33F4 4C30 F8AE

To claim this, I am signing this object:

@tobiasgies
tobiasgies / gist:9723617
Last active August 29, 2015 13:57
HHVM: Issue with disabling original constructor of builtin classes

Test Code:

<?php

namespace TobiasGies;

class HHVMCompatibilityTest extends \PHPUnit_Framework_TestCase {
  public function testCreateDummyWithDisabledConstructor() {
    $mock = $this
@tobiasgies
tobiasgies / gist:6591863
Created September 17, 2013 09:01
How PHPBB checks if you're allowed to access an ACP module...
<?php
function module_auth($module_auth, $forum_id = false)
{
// ...
$is_auth = false;
eval('$is_auth = (int) (' . preg_replace(array('#acl_([a-z0-9_]+)(,\$id)?#', '#\$id#', '#aclf_([a-z0-9_]+)#', '#cfg_([a-z0-9_]+)#', '#request_([a-zA-Z0-9_]+)#'), array('(int) $auth->acl_get(\'\\1\'\\2)', '(int) $forum_id', '(int) $auth->acl_getf_global(\'\\1\')', '(int) $config[\'\\1\']', '!empty($_REQUEST[\'\\1\'])'), $module_auth) . ');');
// AAAAAAAAAAAAAAAAAAAAAAAHHH!
// ...
}