File tree Expand file tree Collapse file tree
tests/unit/Controllers/Table Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -603,12 +603,6 @@ parameters:
603603 count: 1
604604 path: src/Config.php
605605
606- -
607- message: '#^Only booleans are allowed in a negated boolean, string\|false given\.$#'
608- identifier: booleanNot.exprNotBoolean
609- count: 1
610- path: src/Config.php
611-
612606 -
613607 message: '#^Only booleans are allowed in an if condition, string\|false given\.$#'
614608 identifier: if.condNotBoolean
@@ -3630,24 +3624,12 @@ parameters:
36303624 count: 1
36313625 path: src/Controllers/Table/ChangeController.php
36323626
3633- -
3634- message: '#^Parameter \#2 \$isUpload of method PhpMyAdmin\\InsertEdit\:\:getHtmlForInsertEditFormHeader\(\) expects bool, mixed given\.$#'
3635- identifier: argument.type
3636- count: 1
3637- path: src/Controllers/Table/ChangeController.php
3638-
36393627 -
36403628 message: '#^Parameter \#2 \$signature of static method PhpMyAdmin\\Core\:\:checkSqlQuerySignature\(\) expects string, mixed given\.$#'
36413629 identifier: argument.type
36423630 count: 1
36433631 path: src/Controllers/Table/ChangeController.php
36443632
3645- -
3646- message: '#^Parameter \#7 \$isUpload of method PhpMyAdmin\\InsertEdit\:\:getHtmlForInsertEditRow\(\) expects bool, mixed given\.$#'
3647- identifier: argument.type
3648- count: 1
3649- path: src/Controllers/Table/ChangeController.php
3650-
36513633 -
36523634 message: '#^Static property PhpMyAdmin\\Current\:\:\$whereClause \(array\<string\>\|string\|null\) does not accept list\<mixed\>\.$#'
36533635 identifier: assign.propertyType
Original file line number Diff line number Diff line change 227227 <code><![CDATA[$this->settings]]></code>
228228 </PropertyTypeCoercion>
229229 <RiskyTruthyFalsyComparison>
230- <code><![CDATA[! ini_get('file_uploads')]]></code>
231230 <code><![CDATA[$cookieName]]></code>
232231 <code><![CDATA[empty($dir)]]></code>
233232 <code><![CDATA[empty($path)]]></code>
22702269 </file>
22712270 <file src="src/Controllers/Table/ChangeController.php">
22722271 <MixedArgument>
2273- <code><![CDATA[$isUpload]]></code>
22742272 <code><![CDATA[$repopulate]]></code>
22752273 <code><![CDATA[$request->getQueryParam('where_clause_signature')]]></code>
22762274 </MixedArgument>
22792277 <code><![CDATA[$rowId]]></code>
22802278 </MixedArgumentTypeCoercion>
22812279 <MixedAssignment>
2282- <code><![CDATA[$isUpload]]></code>
22832280 <code><![CDATA[$repopulate]]></code>
22842281 </MixedAssignment>
2285- <PossiblyNullArgument>
2286- <code><![CDATA[$isUpload]]></code>
2287- </PossiblyNullArgument>
22882282 <RiskyTruthyFalsyComparison>
22892283 <code><![CDATA[empty(Current::$displayMessage)]]></code>
22902284 </RiskyTruthyFalsyComparison>
Original file line number Diff line number Diff line change @@ -160,7 +160,6 @@ public function loadAndCheck(string|null $source = null): void
160160 public function checkSystem (): void
161161 {
162162 $ this ->checkGd2 ();
163- $ this ->checkUpload ();
164163 $ this ->checkOutputCompression ();
165164 }
166165
@@ -556,25 +555,13 @@ public function getSource(): string
556555 return $ this ->source ;
557556 }
558557
559- /**
560- * checks if upload is enabled
561- */
562- public function checkUpload (): void
558+ public function isUploadEnabled (): bool
563559 {
564- if (! ini_get ('file_uploads ' )) {
565- $ this ->set ('enable_upload ' , false );
566-
567- return ;
568- }
560+ $ iniValue = ini_get ('file_uploads ' );
569561
570- $ this ->set ('enable_upload ' , true );
571562 // if set "php_admin_value file_uploads Off" in httpd.conf
572563 // ini_get() also returns the string "Off" in this case:
573- if (strtolower (ini_get ('file_uploads ' )) !== 'off ' ) {
574- return ;
575- }
576-
577- $ this ->set ('enable_upload ' , false );
564+ return $ iniValue !== false && $ iniValue !== '' && $ iniValue !== '0 ' && strtolower ($ iniValue ) !== 'off ' ;
578565 }
579566
580567 /**
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ public function __invoke(ServerRequest $request): Response
114114 'skip_queries_default ' => $ skipQueriesDefault ,
115115 'is_allow_interrupt_checked ' => $ isAllowInterruptChecked ,
116116 'local_import_file ' => $ localImportFile ,
117- 'is_upload ' => $ config ->get ( ' enable_upload ' ),
117+ 'is_upload ' => $ config ->isUploadEnabled ( ),
118118 'upload_dir ' => $ config ->settings ['UploadDir ' ] ?? null ,
119119 'timeout_passed_global ' => ImportSettings::$ timeoutPassed ,
120120 'compressions ' => $ compressions ,
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ public function __invoke(ServerRequest $request): Response
9696 'skip_queries_default ' => $ skipQueriesDefault ,
9797 'is_allow_interrupt_checked ' => $ isAllowInterruptChecked ,
9898 'local_import_file ' => $ localImportFile ,
99- 'is_upload ' => $ config ->get ( ' enable_upload ' ),
99+ 'is_upload ' => $ config ->isUploadEnabled ( ),
100100 'upload_dir ' => $ config ->settings ['UploadDir ' ] ?? null ,
101101 'timeout_passed_global ' => ImportSettings::$ timeoutPassed ,
102102 'compressions ' => $ compressions ,
Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ public function __invoke(ServerRequest $request): Response
200200
201201 //Insert/Edit form
202202 //If table has blob fields we have to disable ajax.
203- $ isUpload = $ this ->config ->get ( ' enable_upload ' );
203+ $ isUpload = $ this ->config ->isUploadEnabled ( );
204204 $ htmlOutput .= $ this ->insertEdit ->getHtmlForInsertEditFormHeader ($ hasBlobField , $ isUpload );
205205
206206 $ htmlOutput .= Url::getHiddenInputs ($ formParams );
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ public function __invoke(ServerRequest $request): Response
144144 'skip_queries_default ' => $ skipQueriesDefault ,
145145 'is_allow_interrupt_checked ' => $ isAllowInterruptChecked ,
146146 'local_import_file ' => $ localImportFile ,
147- 'is_upload ' => $ config ->get ( ' enable_upload ' ),
147+ 'is_upload ' => $ config ->isUploadEnabled ( ),
148148 'upload_dir ' => $ config ->settings ['UploadDir ' ] ?? null ,
149149 'timeout_passed_global ' => ImportSettings::$ timeoutPassed ,
150150 'compressions ' => $ compressions ,
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ public function getHtml(
115115 'has_bookmark ' => $ bookmarkFeature !== null ,
116116 'delimiter ' => $ delimiter ,
117117 'retain_query_box ' => $ this ->config ->settings ['RetainQueryBox ' ] !== false ,
118- 'is_upload ' => $ this ->config ->get ( ' enable_upload ' ),
118+ 'is_upload ' => $ this ->config ->isUploadEnabled ( ),
119119 'db ' => $ db ,
120120 'table ' => $ table ,
121121 'goto ' => $ goto ,
Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ public function testChangeController(): void
5353 ->withParsedBody (['insert_rows ' => '0 ' ]);
5454
5555 $ config = Config::getInstance ();
56- $ config ->set ('enable_upload ' , false );
5756 $ config ->set ('InsertRows ' , 3 );
5857 $ config ->set ('ShowFunctionFields ' , true );
5958 $ config ->set ('ShowFieldTypesInDataEditView ' , true );
@@ -149,7 +148,6 @@ public function testChangeController2(): void
149148 ->withParsedBody (['insert_rows ' => '1 ' ]);
150149
151150 $ config = Config::getInstance ();
152- $ config ->set ('enable_upload ' , false );
153151 $ config ->set ('InsertRows ' , 3 );
154152 $ config ->set ('ShowFunctionFields ' , false );
155153 $ config ->set ('ShowFieldTypesInDataEditView ' , false );
You can’t perform that action at this time.
0 commit comments