jenkins-bot has submitted this change and it was merged.

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


convertExtensionToRegistration.php: die on global functions

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

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/maintenance/convertExtensionToRegistration.php 
b/maintenance/convertExtensionToRegistration.php
index 2de2e22..3113533 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 extension function 
($func) 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: merged
Gerrit-Change-Id: I0fca5457aba3a7237ad7aeb96f3f6636d73863d3
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Victorbarbu <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Victorbarbu <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to