Victorbarbu has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263182

Change subject: Make convertExtensionToRegistration.php die on global functions
......................................................................

Make convertExtensionToRegistration.php die on global functions

Made convertExtensionToRegistration.php die when meeting global
functions.

Bug: T122952
Change-Id: I0fca5457aba3a7237ad7aeb96f3f6636d73863d3
---
M maintenance/convertExtensionToRegistration.php
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/82/263182/1

diff --git a/maintenance/convertExtensionToRegistration.php 
b/maintenance/convertExtensionToRegistration.php
index 2de2e22..0de5b2f 100644
--- a/maintenance/convertExtensionToRegistration.php
+++ b/maintenance/convertExtensionToRegistration.php
@@ -151,6 +151,12 @@
                                        "Please move your extension function 
somewhere else.", 1
                                );
                        }
+                       // check if $func exists in the global scope
+                       if ( function_exists( $func ) ) {
+                               $this->error( "Error: Global functions cannot 
be converted to JSON. " .
+                                       "Please move your function into a 
class.", 1
+                               );
+                       }
                }
 
                $this->json[$realName] = $value;
@@ -217,6 +223,12 @@
                                                "Please move the handler for 
$hookName somewhere else.", 1
                                        );
                                }
+                               // Check if $func exists in the global scope
+                               if ( function_exists( $func ) ) {
+                                       $this->error( "Error: Global functions 
cannot be converted to JSON. " .
+                                               "Please move the handler for 
$hookName inside a class.", 1
+                                       );
+                               }
                        }
                }
                $this->json[$realName] = $value;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0fca5457aba3a7237ad7aeb96f3f6636d73863d3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Victorbarbu <victorbarb...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to