ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

why?

March 20, 2009 4:48pm

Subscribe [3]
  • #1 / Mar 20, 2009 4:48pm

    metamorpher

    22 posts

    some may move to the dark side and say “get away you f***ing spammer”, but I just wanted to know why all the files from CI do not include the final and beloved ?>

    I may say “because compilation” but that’s not a certain answer… And will add that: once, when I was writing my first controller, I finished the class with the glorious braces and just a line after added the “?>”... so final result would’ve like this

    }
    ?>

    ... I stood in black when an error pulled out… After 14 Hours I added an enter between braces

    }
    
    ?>

    and voilĂ ... so, what’s the big deal about this???

  • #2 / Mar 20, 2009 5:15pm

    xwero

    4145 posts

    the end ?> gave problems for a lot of users. the headers already send error was most of the times caused by adding ?>.

    It isn’t needed in php only files so why not?

  • #3 / Mar 21, 2009 11:56am

    Nevio

    38 posts

    In the most of cases, ?> sign inside of php file is just a waste of time, and can lead to bugs and security injects.

    1.) If there are no HTML blocks outside of <?php ?> block you dont need it.

    For example:

    Here you need ?>

    <?php
    
    class Test{
    
    }
    ?>
    <html><!--WHATEVER--></html>

    Here you don’t need to:

    <?php
    
    class Test{
    
    }

    2.) GZIP will fail, headers will fail if something is wrong or to be exactly output before code execution.

    3.) Because there are a lot of <?php ?><?php ?><?php ?><?php ?>, you can get injected to insert something between ?> and <?php

    That’s what I know about that “problem”.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases