Browse Source

Fixed error message when uploading a file

E_NOTICE (8)
Message: Only variables should be passed by reference
File: /var/www/epesi-live/modules/CRM/Contacts/Photo/Photo_0.php
Line=44

Error:
$extension = strtolower(end(explode('.', $oryg)));
fix:
 $file_ext = explode('.', $oryg);
$extension = strtolower(end($file_ext));

As per: https://vijayasankarn.wordpress.com/2017/08/28/php-only-variables-should-be-passed-by-reference/
Janusz Tylek 5 months ago
parent
commit
0b71d6d990
No account linked to committer's email address
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      modules/CRM/Contacts/Photo/Photo_0.php

+ 2
- 1
modules/CRM/Contacts/Photo/Photo_0.php View File

@@ -41,7 +41,8 @@ class CRM_Contacts_Photo extends Module {
41 41
         }
42 42
         /* check extension */
43 43
         $possible_extensions = array('jpg', 'jpeg', 'png');
44
-        $extension = strtolower(end(explode('.', $oryg)));
44
+        $file_ext = explode('.', $oryg);
45
+        $extension = strtolower(end($file_ext));
45 46
         if( ! in_array($extension, $possible_extensions) ) {
46 47
             echo __('Filename extension should be one of these (letter size doesn\'t matter): ').implode(', ', $possible_extensions);
47 48
             return;

Loading…
Cancel
Save