Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-release-src > by-pkgid > c9a4ab89a8836a5d5fd8224814c7b3e8 > files > 1

sloccount-2.26-15.mga6.src.rpm

Author: Colin Guthrie <colin@mageia.org>

It's generally considered good practice to not close PHP tags
at the end of files, so this warning is stupid.

Also add a few more extensions to treat as PHP and fix up PHP
file detection for *.inc files (short tags are generally frowned
upon these days, so may as well check for real tags.

--- sloccount-2.26/php_count.c.orig	2013-12-06 10:22:47.649165371 +0000
+++ sloccount-2.26/php_count.c	2013-12-06 10:23:02.223477443 +0000
@@ -257,9 +257,6 @@
        consume_char(stream);
     }
  }
- if (mode != NONE) {
-   fprintf(stderr, "Warning! Unclosed PHP file %s, mode=%d\n", filename, mode);
- }
 
  return sloc;
 }
--- sloccount-2.26/break_filelist.origx	2013-12-06 10:33:51.686304019 +0000
+++ sloccount-2.26/break_filelist	2013-12-06 10:38:19.720134511 +0000
@@ -193,7 +193,7 @@
   "makefile" => "makefile",
   "sql" => "sql",
   "php" => "php", "php3" => "php", "php4" => "php", "php5" => "php",
-  "php6" => "php",
+  "php6" => "php", "phtml" => "php", "ptxt" => "php",
   "inc" => "inc", # inc MAY be PHP - we'll handle it specially.
   "m3" => "modula3", "i3" => "modula3",
   "mg" => "modula3", "ig" => "modula3",
@@ -583,6 +583,7 @@
  open(PHP_FILE, "<$filename") ||
       die "Can't open $filename to determine if it's php.\n";
  while(<PHP_FILE>) {
+   if (m/\<\?php/)                        { $is_php = 1; last; }
    if (m/\<\?/)                           { $normal_surround |= 1; }
    if (m/\?\>/ && ($normal_surround & 1)) { $normal_surround |= 2; }
    if (m/\<script.*language="?php"?/i)    { $script_surround |= 1; }