Skip to content

Instantly share code, notes, and snippets.

@PeeHaa
Created May 7, 2012 22:27
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PeeHaa/2631006 to your computer and use it in GitHub Desktop.
Save PeeHaa/2631006 to your computer and use it in GitHub Desktop.
Frameworks are bad m'kay

This document will be a reminder why most (/ almost all) frameworks out there just suck monkey balls.

Let's just make a nice list of all the really bad stuff that is happening in the popular frameworks.
And maybe publish it just to give people the shivers.

CodeIgniter

Are we evaling now?

  • OR might be just personal preference, but c'mon who uses OR in PHP. And why would you?
  • Why no use Autoloader?
  • We need more eval(). And wait, wut? What are we eval()ing?

if ( ! isset($active_record) OR $active_record == TRUE)
{
    require_once(BASEPATH.'database/DB_active_rec.php');

    if ( ! class_exists('CI_DB'))
    {
        eval('class CI_DB extends CI_DB_active_record { }');
    }
}
else
{
    if ( ! class_exists('CI_DB'))
    {
        eval('class CI_DB extends CI_DB_driver { }');
    }
}

Global variable variable? Really??

  • Global is the cherry on top of the cake. Yay!

foreach (array($_GET, $_POST, $_COOKIE) as $global)
{
    if ( ! is_array($global))
    {
        if ( ! in_array($global, $protected))
        {
            global $$global;
            $$global = NULL;
        }
    }
    else
    {
        foreach ($global as $key => $val)
        {
            if ( ! in_array($key, $protected))
            {
                global $$key;
                $$key = NULL;
            }
        }
    }
}

Research

http://chat.stackoverflow.com/transcript/message/3612798#3612798

https://github.com/EllisLab/CodeIgniter/blob/develop/system/core/Loader.php#L853

http://chat.stackoverflow.com/transcript/message/3612873#3612873

https://github.com/EllisLab/CodeIgniter/blob/develop/system/helpers/smiley_helper.php#L78

http://chat.stackoverflow.com/transcript/message/3613051#3613051

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php#L597

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Templating/PhpEngine.php#L173

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php#L231

@cspray
Copy link

cspray commented May 7, 2012

Just...ugh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment