Browse Source

Fix PHP 7.1

Laurent Destailleur 8 years ago
parent
commit
d2b766f9f4
5 changed files with 11 additions and 10 deletions
  1. 1 1
      .travis.yml
  2. 2 1
      ChangeLog
  3. 3 3
      htdocs/user/card.php
  4. 1 1
      htdocs/user/class/user.class.php
  5. 4 4
      test/phpunit/WebservicesUserTest.php

+ 1 - 1
.travis.yml

@@ -12,7 +12,7 @@ php:
 - '5.5'
 - '5.5'
 - '5.6'
 - '5.6'
 - '7.0'
 - '7.0'
-#- '7.1'
+- '7.1'
 - nightly
 - nightly
 
 
 addons:
 addons:

+ 2 - 1
ChangeLog

@@ -151,7 +151,8 @@ Dolibarr better:
   no more required, were also removed. Use this new one if you were using one of them.
   no more required, were also removed. Use this new one if you were using one of them.
 - The trigger that activate or close a contract line is run on a contract line, not on contract.
 - The trigger that activate or close a contract line is run on a contract line, not on contract.
 
 
-Dolibarr 5.0 was frozen before PHP 7.1 was released. It is compatible with PHP 5.3 to 7.0 but not with PHP 7.1 (Dolibarr 6.0 will be).
+Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough
+feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0.
 
 
 
 
 ***** ChangeLog for 4.0.3 to 4.0.2 *****
 ***** ChangeLog for 4.0.3 to 4.0.2 *****

+ 3 - 3
htdocs/user/card.php

@@ -1090,9 +1090,9 @@ if (($action == 'create') || ($action == 'adduserldap'))
 	// Categories
 	// Categories
 	if (! empty($conf->categorie->enabled)  && ! empty($user->rights->categorie->lire)) 
 	if (! empty($conf->categorie->enabled)  && ! empty($user->rights->categorie->lire)) 
 	{
 	{
-		print '<tr><td>' . fieldLabel( 'Categories', 'usercats' ) . '</td><td colspan="3">';
-		$cate_arbo = $form->select_all_categories( Categorie::TYPE_USER, null, 'parent', null, null, 1 );
-		print $form->multiselectarray( 'usercats', $cate_arbo, GETPOST( 'usercats', 'array' ), null, null, null,
+		print '<tr><td>' . fieldLabel('Categories', 'usercats') . '</td><td colspan="3">';
+		$cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1);
+		print $form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), null, null, null,
 			null, '90%' );
 			null, '90%' );
 		print "</td></tr>";
 		print "</td></tr>";
 	}
 	}

+ 1 - 1
htdocs/user/class/user.class.php

@@ -330,7 +330,7 @@ class User extends CommonObject
 		}
 		}
 		else
 		else
 		{
 		{
-			$this->error=$this->db->error();
+			$this->error=$this->db->lasterror();
 			return -1;
 			return -1;
 		}
 		}
 
 

+ 4 - 4
test/phpunit/WebservicesUserTest.php

@@ -154,7 +154,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
 
 
         // Test URL
         // Test URL
         $result='';
         $result='';
-        $parameters = array('authentication'=>$authentication,'ref'=>'admin');
+        $parameters = array('authentication'=>$authentication,'id'=>0,'ref'=>'admin');
         print __METHOD__."Call method ".$WS_METHOD."\n";
         print __METHOD__."Call method ".$WS_METHOD."\n";
         try {
         try {
             $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
             $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
@@ -177,11 +177,11 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
         }
         }
 
 
         print __METHOD__." result=".$result."\n";
         print __METHOD__." result=".$result."\n";
-        $this->assertEquals('OK',$result['result']['result_code']);
+        $this->assertEquals('OK', $result['result']['result_code'], 'Test on ref admin');
 
 
         // Test URL
         // Test URL
         $result='';
         $result='';
-        $parameters = array('authentication'=>$authentication,'ref'=>'refthatdoesnotexists');
+        $parameters = array('authentication'=>$authentication,'id'=>0,'ref'=>'refthatdoesnotexists');
         print __METHOD__."Call method ".$WS_METHOD."\n";
         print __METHOD__."Call method ".$WS_METHOD."\n";
         try {
         try {
             $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
             $result = $soapclient->call($WS_METHOD,$parameters,$ns,'');
@@ -200,7 +200,7 @@ class WebservicesUserTest extends PHPUnit_Framework_TestCase
         }
         }
 
 
         print __METHOD__." result=".$result."\n";
         print __METHOD__." result=".$result."\n";
-        $this->assertEquals('NOT_FOUND',$result['result']['result_code']);
+        $this->assertEquals('NOT_FOUND', $result['result']['result_code'], 'Test on ref that does not exists');
 
 
         return $result;
         return $result;
     }
     }