__FILE__ magic constant containing wrong values #2

已关闭
belliash2018-07-12 19:33:16 +02:00创建 · 8 评论
所有者

Aer Information

  • Aer Version (or commit ref): e53cfb8ba0
  • Operating System: Linux
  • System Architecture (eg. arm, x86_64, ...): x86_64

Your problem description

When several source files are included/required, the magic constant contains wrong data. Code snippet contains 3 files:

test.php:
<?php echo __FILE__ . ' - ' . __LINE__ . "\n"; require_once('test2.php'); echo __FILE__ . ' - ' . __LINE__ . "\n"; ?>
test2.php:
<?php echo __FILE__ . ' - ' . __LINE__ . "\n"; require_once('test3.php'); echo __FILE__ . ' - ' . __LINE__ . "\n"; ?>
test3.php:
<?php echo __FILE__ . ' - ' . __LINE__ . "\n"; ?>

Expected result differs from the actual result. This bug makes debugging more difficult.

Expected results

test.php - 2

test2.php - 2

test3.php - 2

test2.php - 4

test.php - 4

Current results

test.php - 2

test2.php - 2

test3.php - 2

./test3.php - 4

test2.php - 4

Additional information

debug_backtrace() function is also affected by this bug, but there line number is also not working correctly, returning always 1:

<?php
    echo "TEST:\n"
    var_dump(debug_backtrace());
?>

The above code results in:

TEST:
array(2) {
[line] =>
int(1)
[file] =>
string(8 'test.php')
}

<!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please take a moment to check that your issue doesn't already exist. 3. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> # Aer Information - Aer Version (or commit ref): e53cfb8ba0 - Operating System: Linux - System Architecture (eg. arm, x86_64, ...): x86_64 # Your problem description When several source files are included/required, the magic constant contains wrong data. Code snippet contains 3 files: test.php: <?php echo __FILE__ . ' - ' . __LINE__ . "\n"; require_once('test2.php'); echo __FILE__ . ' - ' . __LINE__ . "\n"; ?> test2.php: <?php echo __FILE__ . ' - ' . __LINE__ . "\n"; require_once('test3.php'); echo __FILE__ . ' - ' . __LINE__ . "\n"; ?> test3.php: <?php echo __FILE__ . ' - ' . __LINE__ . "\n"; ?> Expected result differs from the actual result. This bug makes debugging more difficult. # Expected results test.php - 2 test2.php - 2 test3.php - 2 test2.php - 4 test.php - 4 # Current results test.php - 2 test2.php - 2 test3.php - 2 ./test3.php - 4 test2.php - 4 # Additional information debug_backtrace() function is also affected by this bug, but there line number is also not working correctly, returning always 1: <?php echo "TEST:\n" var_dump(debug_backtrace()); ?> The above code results in: TEST: array(2) { [line] => int(1) [file] => string(8 'test.php') }
belliash2018-07-12 19:33:16 +02:00 添加了标签
bug
作者
所有者

This can be related with https://github.com/symisc/PH7/issues/20

This can be related with https://github.com/symisc/PH7/issues/20

This is the one bug i ran into thats when i decided to give up on my project

This is the one bug i ran into thats when i decided to give up on my project
作者
所有者

Unfortunately this is a bug in basic functionality and we have to fix it. This will make any kind of debugging harder.

Unfortunately this is a bug in basic functionality and we have to fix it. This will make any kind of debugging harder.

Im looking into this

Im looking into this
BigDave2018-07-13 18:21:19 +02:00belliash 指派

i have completed one part but for the life of me i cant think how todo replace ../ etc with the actual dir i will commit changes into file_magic branch shortly i hope the unix eqiv works too but the win32 version does

i have completed one part but for the life of me i cant think how todo replace ../ etc with the actual dir i will commit changes into file_magic branch shortly i hope the unix eqiv works too but the win32 version does
作者
所有者

This is connected with #3, I think. This is connected with #2, I think. There is a general problem with information about file & line position in PH7. FILE shows some trash, while debug_backtrace() simply gets currently processed file and returns only last callback instead of whole backtrace.

This is connected with #3, I think. This is connected with #2, I think. There is a general problem with information about file & line position in PH7. __FILE__ shows some trash, while debug_backtrace() simply gets currently processed file and returns only last callback instead of whole backtrace.
成员

How is it now with the current code ?

How is it now with the current code ?
BigDave2018-07-23 11:25:19 +02:00belliash 指派
belliash2018-07-23 11:25:20 +02:00 指派给自己
作者
所有者

I'll do my best to close this today.

I'll do my best to close this today.
belliash2018-07-23 15:52:17 +02:00 关闭此工单
belliash2020-06-20 00:20:29 +02:00 在代码提交中引用了该工单
登录 并参与到对话中。
3 名参与者
通知
到期时间
未设置到期时间。
依赖工单

没有设置依赖项。

参考:aerscript/Aer#2
没有提供说明。