aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/develop
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-11 17:05:34 +0100
committerJoas Schilling <nickvergessen@gmx.de>2014-03-11 17:44:25 +0100
commite1d570285388990bf280ece3b2041dcc2f409e67 (patch)
tree03025d083956b262227907897cd171315a4dea09 /phpBB/develop
parent296af6c67910c74210354aec15eb04323f643acf (diff)
downloadforums-e1d570285388990bf280ece3b2041dcc2f409e67.tar
forums-e1d570285388990bf280ece3b2041dcc2f409e67.tar.gz
forums-e1d570285388990bf280ece3b2041dcc2f409e67.tar.bz2
forums-e1d570285388990bf280ece3b2041dcc2f409e67.tar.xz
forums-e1d570285388990bf280ece3b2041dcc2f409e67.zip
[ticket/12262] Also find vars array when it's defined in the trigger_event()
PHPBB3-12262
Diffstat (limited to 'phpBB/develop')
-rw-r--r--phpBB/develop/export_events_for_wiki.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/phpBB/develop/export_events_for_wiki.php b/phpBB/develop/export_events_for_wiki.php
index b276b4c5fa..ac4c4f9317 100644
--- a/phpBB/develop/export_events_for_wiki.php
+++ b/phpBB/develop/export_events_for_wiki.php
@@ -117,19 +117,30 @@ function check_for_events($phpbb_root_path, $file)
$event_name = substr($event_name, $found_trigger_event + strlen("phpbb_dispatcher->trigger_event('"));
$event_name = substr($event_name, 0, strpos($event_name, "'"));
- // Find $vars array lines
- $find_varsarray_line = 1;
- while (strpos($lines[$event_line - $find_varsarray_line], "vars = array('") === false)
+ $current_line = trim($lines[$event_line]);
+ $arguments = array();
+ if (($found_inline_array = strpos($current_line, "', compact(array('")) !== false)
{
- $find_varsarray_line++;
+ $varsarray = substr($current_line, $found_inline_array + strlen("', compact(array('"), -6);
+ $arguments = explode("', '", $varsarray);
+ }
- if ($find_varsarray_line > min(50, $event_line))
+ if (empty($arguments))
+ {
+ // Find $vars array lines
+ $find_varsarray_line = 1;
+ while (strpos($lines[$event_line - $find_varsarray_line], "vars = array('") === false)
{
- throw new LogicException('Can not find "$vars = array()"-line for event "' . $event_name . '" in file "' . $file . '"');
+ $find_varsarray_line++;
+
+ if ($find_varsarray_line > min(50, $event_line))
+ {
+ throw new LogicException('Can not find "$vars = array()"-line for event "' . $event_name . '" in file "' . $file . '"');
+ }
}
+ $varsarray = substr(trim($lines[$event_line - $find_varsarray_line]), strlen("\$vars = array('"), -3);
+ $arguments = explode("', '", $varsarray);
}
- $varsarray = substr(trim($lines[$event_line - $find_varsarray_line]), strlen("\$vars = array('"), -3);
- $arguments = explode("', '", $varsarray);
// Validate $vars array with @var
$find_vars_line = 3;