Edit report at https://bugs.php.net/bug.php?id=61090&edit=1

 ID:                 61090
 Updated by:         ras...@php.net
 Reported by:        frascafresca at gmail dot com
 Summary:            include in a tick declare
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows 7 64bit
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2012-02-14 21:44:54] 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}-


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61090&edit=1

Reply via email to