php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65500 debug_backtrace doesn't identify file name when config contains invalid comment
Submitted: 2013-08-22 08:30 UTC Modified: 2013-08-22 22:37 UTC
From: alina dot sch61 at gmail dot com Assigned:
Status: Analyzed Package: Scripting Engine problem
PHP Version: 5.4 or later OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-08-22 08:30 UTC] alina dot sch61 at gmail dot com
Description:
------------
If php-fpm.conf contains not correctly commented string (commented with "#" 
symbol instead of semicolon), debug_backtrace() function 
doesn't return in message name of file and line where this mistake was done:

[args] => Array(
  [0] => ErrorException Object(
     [message:protected] => Comments starting with '#' are deprecated in Unknown 
on line 1
     [string:Exception:private] =>
     [code:protected] => 8192
     [file:protected] => Unknown
     [line:protected] => 0
     [trace:Exception:private] => Array(
           [0] => Array(
                  [function] => shutdownHandler
                  [class] => Shared\Error\ErrorHandler
                  [type] => ->
                  [args] => Array()
           )
     )
     [previous:Exception:private] =>
     [severity:protected] => 0
  )
)

But if such comment is made in config of one of the extensions (e.g. mysql.ini) 
name of file will be successfully identified for message.

[args] => Array(
  [0] => ErrorException Object(
       [message:protected] => Comments starting with '#' are deprecated in 
/etc/php5/fpm/conf.d/20-mysql.ini on line 2
       [string:Exception:private] =>
       [code:protected] => 8192
       [file:protected] => Unknown
       [line:protected] => 0
       [trace:Exception:private] => Array(
           [0] => Array(
               [function] => shutdownHandler
               [class] => Shared\Error\ErrorHandler
               [type] => ->
               [args] => Array()
           )
        )
        [previous:Exception:private] =>
        [severity:protected] => 0
    )
)



Expected result:
----------------
If not correct comment is in php-fpm.conf message doesn't contain file name:

[message:protected] => Comments starting with '#' are deprecated in 
/etc/php5/fpm/php-fpm.conf on line 7

Actual result:
--------------
If not correct comment is in php-fpm.conf message doesn't contain file name:

[message:protected] => Comments starting with '#' are deprecated in Unknown on 
line 1 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-08-22 10:38 UTC] yohgaki@php.net
-Status: Open +Status: Analyzed -Package: FPM related +Package: Scripting Engine problem -Operating System: Linux +Operating System: any -PHP Version: 5.4.18 +PHP Version: 5.4 or later
 [2013-08-22 10:38 UTC] yohgaki@php.net
Ini settings are scanned by zend_ini_scanner.c

http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_ini_scanner.l#592

    zend_error(E_DEPRECATED, "Comments starting with '#' are deprecated in %s on 
line %d", zend_ini_scanner_get_filename(TSRMLS_C), SCNG(lineno));

If getting filename and lineno at this stage, error message could be improved. 

"Comments starting with '#' in php config file are deprecated" or like.
 [2013-08-22 10:39 UTC] yohgaki@php.net
> If getting filename and lineno at this stage, error message could be improved.

If getting filename and lineno is not feasible at this stage, error message could 
be improved.
 [2013-08-22 22:37 UTC] yohgaki@php.net
Looked into a bit.
fpm_conf.c parse config file as string and line by line. Therefore, zend ini 
scanner does not know filename nor line number.

http://lxr.php.net/xref/PHP_TRUNK/sapi/fpm/fpm/fpm_conf.c#1502

I guess this ini scanner usage is not expected by the authors.

Adding flag that allows "#" as comment will resolve this issue, but I'm not sure 
if this is the best resolution.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC