| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * @copyright Copyright (c) 2016 Arthur Schiwon <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @author Arthur Schiwon <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @license GNU AGPL version 3 or any later version | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * This program is free software: you can redistribute it and/or modify | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * it under the terms of the GNU Affero General Public License as | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * published by the Free Software Foundation, either version 3 of the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * License, or (at your option) any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * GNU Affero General Public License for more details. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * You should have received a copy of the GNU Affero General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | namespace OCA\Files\Settings; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | use bantu\IniGetWrapper\IniGetWrapper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | use OCP\AppFramework\Http\TemplateResponse; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use OCP\IRequest; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use OCP\Settings\ISettings; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use OCP\Util; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  | class Admin implements ISettings { | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  | 	/** @var IniGetWrapper */ | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  | 	private $iniWrapper; | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  | 	/** @var IRequest */ | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  | 	private $request; | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	public function __construct(IniGetWrapper $iniWrapper, IRequest $request) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 		$this->iniWrapper = $iniWrapper; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		$this->request = $request; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  | 	 * @return TemplateResponse | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 	public function getForm() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		$htaccessWorking  = (getenv('htaccessWorking') == 'true'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 		$htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		$userIniWritable  = is_writable(\OC::$SERVERROOT.'/.user.ini'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 		$upload_max_filesize = $this->iniWrapper->getBytes('upload_max_filesize'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 		$post_max_size = $this->iniWrapper->getBytes('post_max_size'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 		$maxUploadFilesize = Util::humanFileSize(min($upload_max_filesize, $post_max_size)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 		if($_POST && $this->request->passesCSRFCheck()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 			if(isset($_POST['maxUploadSize'])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 				if(($setMaxSize = \OC_Files::setUploadLimit(Util::computerFileSize($_POST['maxUploadSize']))) !== false) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 					$maxUploadFilesize = Util::humanFileSize($setMaxSize); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 				} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 		$parameters = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 			'uploadChangable'              => (($htaccessWorking and $htaccessWritable) or $userIniWritable ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  | 			'uploadMaxFilesize'            => $maxUploadFilesize, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 			// max possible makes only sense on a 32 bit system | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 			'displayMaxPossibleUploadSize' => PHP_INT_SIZE === 4, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 			'maxPossibleUploadSize'        => Util::humanFileSize(PHP_INT_MAX), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 		]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 		return new TemplateResponse('files', 'admin', $parameters, ''); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 73 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  | 	 * @return string the section ID, e.g. 'sharing' | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 	public function getSection() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 		return 'additional'; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 80 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  | 	 * @return int whether the form should be rather on the top or bottom of | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  | 	 * the admin section. The forms are arranged in ascending order of the | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  | 	 * priority values. It is required to return a value between 0 and 100. | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  | 	 * E.g.: 70 | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 	public function getPriority() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 		return 5; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 91 |  |  | 	} | 
            
                                                        
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 93 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 94 |  |  |  | 
            
                        
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: