-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use different code for PHP7/PHP8 when detecting function name. Added funcmap_flush(), mainly to verify if the extension works well using a test. Added the test, just a basic scenario.
- Loading branch information
Showing
2 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--TEST-- | ||
Checks if the logfile is created correctly | ||
--INI-- | ||
funcmap.enabled=on | ||
funcmap.logfile=funcmap-%pid%.log | ||
--FILE-- | ||
<?php | ||
$LOG_FILENAME=str_replace('%pid%', (string)getmypid(), ini_get('funcmap.logfile')); | ||
|
||
try { | ||
funcmap_enable(true); | ||
|
||
class Test { | ||
function test() { | ||
echo "code works\n"; | ||
} | ||
} | ||
|
||
for ($i = 0; $i < 5; ++ $i) { | ||
(new Test)->test(); | ||
} | ||
|
||
funcmap_enable(false); | ||
funcmap_flush(); | ||
|
||
$actual = file_get_contents($LOG_FILENAME); | ||
|
||
echo "logfile: $LOG_FILENAME:\n"; | ||
echo $actual; | ||
} finally { | ||
// cleanup | ||
unlink($LOG_FILENAME); | ||
} | ||
|
||
?> | ||
--EXPECTF-- | ||
code works | ||
code works | ||
code works | ||
code works | ||
code works | ||
logfile: funcmap-%d.log: | ||
Test::test |