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
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: 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: Mon Jul 14 03:01:31 2025 UTC