php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #42957 Inconsistent line numbering
Submitted: 2007-10-13 18:06 UTC Modified: 2007-11-21 14:55 UTC
From: felipensp at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: felipensp at gmail dot com
New email:
PHP Version: OS:

 

 [2007-10-13 18:06 UTC] felipensp at gmail dot com
Description:
------------
The line numbering appear incorrect.

Reproduce code:
---------------
<?php

function test() {
    static $calls = 0;
    
    if ($calls++ < 1) return;
    
    $bt = debug_backtrace();
    printf("(%d)\n", $bt[0]['line']);
}

register_tick_function('test');

declare (ticks=1) {  
    $i = 0;
    $j = 1;
    $i = 0; $j = 1;
    $i = 0; $j = 1;
    // foo   
}

?>

Expected result:
----------------
(16)
(17)
(18)
(18)
(19)
(19)


Actual result:
--------------
(16)
(17)
(17)
(18)
(18)
(20)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-31 10:47 UTC] jani@php.net
It's because ticks are counted from "line 0" (declare) and they end at } which is also counted in. This needs some better documenting.
 [2007-11-21 14:55 UTC] vrana@php.net
"A tick is an event that occurs for every N low-level statements executed by the parser within the declare block." First tick occurs after $i = 0;, last one after }.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Sep 09 12:00:02 2025 UTC