You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (preg_match('~\?>\s+$~', $contents, $matches)) {
57
-
thrownewException('End of File contains extra spaces in ' . $currentFile);
58
-
}
59
-
60
-
// Test to see if its there even, SMF 2.1 base package needs it there in our main files to allow package manager to properly handle end operations. Customizations do not need it.
61
-
if (!preg_match('~\?>$~', $contents, $matches)) {
62
-
thrownewException('End of File missing in ' . $currentFile);
63
-
}
64
-
65
-
// Test to see if a function/class ending is here but with no return (because we are OCD).
66
-
if (preg_match('~}([\r]?\n)?\?>~', $contents, $matches)) {
67
-
thrownewException('Incorrect return(s) after last function/class but before EOF in ' . $currentFile);
50
+
// We don't want closing PHP tags in SMF 3.0+.
51
+
if (preg_match('~\s*\?>\s*$~', $contents, $matches)) {
52
+
thrownewException('Closing PHP tag found in ' . $currentFile . '. Please remove it.');
68
53
}
69
54
70
-
// Test to see if a string ending is here but with no return (because we are OCD).
71
-
if (preg_match('~;([\r]?\n)?\?>~', $contents, $matches)) {
72
-
thrownewException('Incorrect return(s) after last string but before EOF in ' . $currentFile);
55
+
// Make sure we end with exactly one newline.
56
+
if (strlen($contents) > 0 && !preg_match('~\S\n$~', $contents, $matches)) {
57
+
thrownewException('Incorrect number of newlines at EOF in ' . $currentFile);
73
58
}
74
59
} else {
75
60
thrownewException('Unable to open file ' . $currentFile);
0 commit comments