php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70716 Autoload a class will output an extra character "\n"
Submitted: 2015-10-15 06:54 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ccxopen at gmail dot com Assigned:
Status: Open Package: yaf (PECL)
PHP Version: 5.5.30 OS: ubuntu 12.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-10-15 06:54 UTC] ccxopen at gmail dot com
Description:
------------
Example A:

echo "a";
$A = new A(); //A.php in the application/library,YAF will autoload the class
echo "b";

The output is:
a
b

But Should be:
ab

Example B:
I make a Class like this and put the file in application/library/Controller.php

abstract class Controller extends Yaf_Controller_Abstract{
    .........
}

Then I create a Index.php in application/controllers/index.php
class IndexController extends Controller {
    public function indexAction() {

        echo "a";
    }
}

I call the action index,the output should be "a",but the result is "\na",an extra character "\n" appear before a.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-19 04:06 UTC] ajf@php.net
This might happen if one of your class files has a closing ?> with a new line after it. If so, that is your problem, not yaf.

To avoid this problem, don't use a closing ?> in files that are entirely PHP code.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 05:01:26 2019 UTC