Ottomata has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374816 )

Change subject: Fix PHP7 warnings
......................................................................

Fix PHP7 warnings

I have not been able to test these in mw-vagrant.  These changes are in how 
MediaWiki will serve
JSONSchemas from wiki (namespace 470?) via the MW API.  I am not sure how to 
install schemas
and get them served by the API in mw-vagrant.

The first change in JsonSchema.php
is harmless, and just avoids a warning about possibly modifying args before 
calling func_get_args().

The second fix, in ApiJsonSchema.php, I am not sure about.  I believe it should 
be harmless, as I
don't see the point in iterating over the values in $schema by reference, 
rather than copy.
$v is not used outside of the foreach loop again, so it should be fine to 
modify $v
(when the nested foreach loop iterates over &$properties by reference), without 
modifying
the value in $schema.  But, I am not an expert on how PHP by-reference vars 
work, especially
in the context of this funky nested for loop PHP 7 warning :)

Bug: T173850
Change-Id: I5e12bb6ad46ce309e68c51924b478aa533257726
---
M includes/ApiJsonSchema.php
M includes/JsonSchema.php
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging 
refs/changes/16/374816/1

diff --git a/includes/ApiJsonSchema.php b/includes/ApiJsonSchema.php
index 2bee672..871868f 100644
--- a/includes/ApiJsonSchema.php
+++ b/includes/ApiJsonSchema.php
@@ -128,7 +128,7 @@
 
                $result = $this->getResult();
                $result->addValue( null, 'title', $title->getText() );
-               foreach ( $schema as $k => &$v ) {
+               foreach ( $schema as $k => $v ) {
                        if ( $k === 'properties' ) {
                                foreach ( $v as &$properties ) {
                                        $properties[ApiResult::META_BC_BOOLS] = 
[ 'required' ];
diff --git a/includes/JsonSchema.php b/includes/JsonSchema.php
index bbd6a4f..813e25e 100644
--- a/includes/JsonSchema.php
+++ b/includes/JsonSchema.php
@@ -58,9 +58,11 @@
        public $subtype;
 
        public function __construct( $code /* ... */ ) {
+               $args = func_get_args();
+
                parent::__construct( $code );
                $this->code = $code;
-               $this->args = func_get_args();
+               $this->args = $args;
                array_shift( $this->args );
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/374816
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e12bb6ad46ce309e68c51924b478aa533257726
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ottomata <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to