php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61090 include in a tick declare
Submitted: 2012-02-14 21:44 UTC Modified: 2012-02-15 00:04 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: frascafresca at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.10 OS: Windows 7 64bit
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: frascafresca at gmail dot com
New email:
PHP Version: OS:

 

 [2012-02-14 21:44 UTC] frascafresca at gmail dot com
Description:
------------
the script below work as well only if the content of test.php is copied inside the "declare" in main.php instead using "include".
Then the Tick system conflicts with include()

Test script:
---------------
main.php
<?php
function track_variables ($key) {
   static $last = '';
   if ($last !== $GLOBALS[$key]) {
      echo "-variable $key changed to{".$GLOBALS[$key]."}-";
   }
   $last = $GLOBALS[$key];
}
register_tick_function ('track_variables', 'foo');
declare (ticks=1) {
    include("test.php");
}
?>
test.php
<?php
$foo = 10;
echo "<br>Hi!";
$foo *= $foo;
$foo = 'bar';
echo "<br>Gotta run";
echo "<br>Bye!";
?>

Expected result:
----------------
-variable foo changed to{10}-
Hi!-variable foo changed to{100}--variable foo changed to{bar}-
Gotta run
Bye!

Actual result:
--------------
Hi!
Gotta run
Bye!-variable foo changed to{bar}-

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-15 00:04 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2012-02-15 00:04 UTC] rasmus@php.net
This isn't a bug, that's how block-level ticks work. They are per-op_array. You 
can put a declare ticks in your include file if you want the included op_array to 
be tickable as well.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 21:01:33 2025 UTC