diff options
author | Satoshi Sahara <sahara.satoshi@gmail.com> | 2021-11-27 13:52:37 +0900 |
---|---|---|
committer | Satoshi Sahara <sahara.satoshi@gmail.com> | 2021-11-27 13:52:37 +0900 |
commit | 36454bb57afad7e61b2bbe3c09f0647549fa65bc (patch) | |
tree | e0da64841508f44b31c0a67707cb87a612e4ef91 | |
parent | 666bc21d99e4980d910005abf0a399fad1b33024 (diff) | |
download | dokuwiki-36454bb57afad7e61b2bbe3c09f0647549fa65bc.tar.gz dokuwiki-36454bb57afad7e61b2bbe3c09f0647549fa65bc.zip |
remove page key from event data prior to return
$data['page'] is object $this, it is not possible to access the object after destructed.
-rw-r--r-- | inc/File/PageFile.php | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/inc/File/PageFile.php b/inc/File/PageFile.php index aba9947a1..bfc11496b 100644 --- a/inc/File/PageFile.php +++ b/inc/File/PageFile.php @@ -72,6 +72,7 @@ class PageFile * @param string $text wikitext being saved * @param string $summary summary of text update * @param bool $minor mark this saved version as minor update + * @return array data of event COMMON_WIKIPAGE_SAVE */ public function saveWikiText($text, $summary, $minor = false) { @@ -109,7 +110,6 @@ class PageFile 'contentChanged' => (bool)($text != $currentContent), // confirm later 'changeInfo' => '', // automatically determined by revertFrom 'sizechange' => strlen($text) - strlen($currentContent), // TBD - 'page' => $this, // allow handlers to use class methods ); // determine tentatively change type and relevant elements of event data @@ -131,6 +131,8 @@ class PageFile } $this->data = $data; + $data['page'] = $this; // allow event handlers to use this class methods + $event = new Event('COMMON_WIKIPAGE_SAVE', $data); if (!$event->advise_before()) return; @@ -204,6 +206,7 @@ class PageFile // update the purgefile (timestamp of the last time anything within the wiki was changed) io_saveFile($conf['cachedir'].'/purgefile', time()); + unset($data['page']); return $data; } |