WordPress.org

Ready to get started?Download WordPress

Forums

Cimy User Extra Fields
[resolved] Extra linefeeds at end of .php files (10 posts)

  1. Ov3rfly
    Member
    Posted 2 years ago #

    Many .php files of this plugin like cimy_uef_functions.php and others have an extra linefeed after the end-marker of php-code, e.g.

    ...
    php-code();
    ?>
    EXTRA LINEFEED 0x0a HERE

    These linefeeds should be removed.

    http://wordpress.org/extend/plugins/cimy-user-extra-fields/

  2. Marco Cimmino
    Member
    Plugin Author

    Posted 2 years ago #

    And are you able to motivate why should be removed?
    I can explain instead why are there. It is always a good idea to code with an extra line at the end of the file for compatibility reasons.

  3. Marco Cimmino
    Member
    Plugin Author

    Posted 2 years ago #

  4. Ov3rfly
    Member
    Posted 2 years ago #

    That extra linefeed is printed to the browser when you require()/include() the file and can lead to well known headers already sent problem.

    The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include or require, so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later.

    http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php

    http://stackoverflow.com/questions/8028957/headers-already-sent-by-php
    http://stackoverflow.com/questions/4410704/php-closing-tag

  5. Marco Cimmino
    Member
    Plugin Author

    Posted 2 years ago #

    Seriously, is this causing you any issues? If not then I am not gonna remove them.

  6. Ov3rfly
    Member
    Posted 2 years ago #

  7. Marco Cimmino
    Member
    Plugin Author

    Posted 2 years ago #

    All WordPress files seem having extra line at the end, what they don't is closing the php tag.

  8. Ov3rfly
    Member
    Posted 2 years ago #

    No closing php tag = no output of any extra linefeed "after the end-marker of php-code".

    Why are they doing this? It's explained in detail in above links...

  9. Marco Cimmino
    Member
    Plugin Author

    Posted 2 years ago #

    So I prefer to remove the last php tag rather than removing the last empty line, which is useful for many other things.

  10. Marco Cimmino
    Member
    Plugin Author

    Posted 1 year ago #

    Fixed in trunk, will be in v2.3.11

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic