php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54081 __LINE__ provides unexpected value
Submitted: 2011-02-23 18:06 UTC Modified: 2015-03-03 03:55 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rmroczk at searshc dot com Assigned:
Status: Duplicate Package: CGI/CLI related
PHP Version: 5.3.5 OS: ubuntu
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rmroczk at searshc dot com
New email:
PHP Version: OS:

 

 [2011-02-23 18:06 UTC] rmroczk at searshc dot com
Description:
------------
This issue is very similar to Bug #20035 but the difference is in the #! line.
I am trying to find a way to specify the #! line, including the -d option such that the value of __LINE__ is correct.

Test script:
---------------
$ php5 -dauto_prepend_file=auto_prepend.php <test.php #correct value of __LINE__
Line: 2
#!/usr/bin/php5 -dauto_prepend_file=auto_prepend.php
Line: 7

$ ./test.php #incorrect value of __LINE__
Line: 3
Line: 6

$ php5 -dauto_prepend_file=auto_prepend.php test.php #incorrect
Line: 3
Line: 6
$ cat auto_prepend.php
<?php
echo "Line: " . __LINE__ . "\n";
?>
$ cat test.php
#!/usr/bin/php5 -dauto_prepend_file=auto_prepend.php
<?php
function function_name() {
}
function function_name2() {
}
echo "Line: " . __LINE__ . "\n";
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-03 03:55 UTC] reeze@php.net
-Status: Open +Status: Duplicate
 [2015-03-03 03:55 UTC] reeze@php.net
Dup of bug https://bugs.php.net/bug.php?id=67741 and been fixed in PHP5.5+
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC