Commit Graph

157 Commits

Author SHA1 Message Date
Maurício Meneghini Fauth
e8c216b17e
Fix PHP 8.5 Reflection*::setAccessible() deprecations
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2025-08-17 13:32:00 -03:00
Maurício Meneghini Fauth
7355ddff8d Fix XSS vulnerability on Insert page
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2025-01-20 14:02:28 -05:00
Liviu-Mihail Concioiu
78f3ff4554 Remove padding around varchar textarea
Signed-off-by: Liviu-Mihail Concioiu <liviu.concioiu@gmail.com>
2024-11-13 19:29:07 -03:00
Maurício Meneghini Fauth
555ea56cbd
Make PHPUnit's assertions stricter
Backports #18993 to QA_5_2.

This makes merging QA_5_2 into master easier.

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2024-10-12 15:33:45 -03:00
Maurício Meneghini Fauth
7fc96d6621
Call PHPUnit static methods using static calls
Backports #18907 to QA_5_2.

This makes merging QA_5_2 into master easier.
Changes done using Rector.

- #18907

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2024-10-12 14:28:22 -03:00
Maurício Meneghini Fauth
46f2c8871c
Backport some fixes for PHPUnit 10 compatibility
- Fixes https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1070623

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2024-08-13 20:13:18 -03:00
Kamil Tekiela
effe79664c Fix navigation page after table edit
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2024-01-23 22:17:32 +01:00
Maximilian Krög
4bd6a2dd52
Fix opening GIS editor in zoom search
The editor couldn't be opened there at all

Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
2023-09-15 00:36:02 +02:00
Maximilian Krög
d716e30e60
Change deprecated ReflectionProperty method call
Is being deprecated in PHP 8.3

Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
2023-07-20 01:30:37 +02:00
Maurício Meneghini Fauth
d464a8d081
Fix GisDataEditorControllerTest namespace
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-04-11 23:03:24 -03:00
Maximilian Krög
89bcefeadb
Fix inserting gis-data via insert/edit form
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
2023-03-01 22:40:09 +01:00
William Desportes
b9c593c67d
Fix #17766 - Allow to open in a new tab copy and edit row actions
Signed-off-by: William Desportes <williamdes@wdes.fr>
2022-11-25 19:55:53 +01:00
Mo Sureerat
afd568e889 [ISSUE-17793] Revert previous change + Fix default selection of uuid in alter table
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-11-03 05:11:19 +07:00
Mo Sureerat
7615c7e780 [ISSUE-17793] Insert record - fix null not selected if nullable UUID + insert error
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-11-03 03:01:38 +07:00
Mo Sureerat
aeab8a1c41
Fix #17793 - insert UUID (#17797)
* Add/Change table schema - Add UUID in default options
* Insert/Update - Generate uuid only not defined and not check null option
* Add/Change table schema - Hide UUID from default options if database not support & add unit test

Fix #17793

Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-20 15:57:53 -03:00
Mo Sureerat
cac09436c9 Rewrite method to set database info
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 13:01:19 +07:00
Mo Sureerat
8c93351647 Relocate method and fix unit test fail
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-11 01:18:52 +07:00
Mo Sureerat
033a4cb099 Update unit test - Exclude UUID if not supported database version
Signed-off-by: Mo Sureerat <sureemo@gmail.com>
2022-10-10 22:51:44 +07:00
Kamil Tekiela
fc932a9a8f Allow fields to be set to NULL
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-08-15 14:35:21 +01:00
Kamil Tekiela
06d58c9662 Fix bug #17663
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-08-08 14:41:51 +01:00
Kamil Tekiela
6d0a30a391 Fix errors in InsertEdit
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-06-04 19:06:16 +01:00
Kamil Tekiela
848c4ef172 Fix broken Insert page
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-02-18 14:14:22 +00:00
Kamil Tekiela
86031d2bf6 Deimplement fetchAssoc() helper
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-01-09 22:44:53 +00:00
Kamil Tekiela
83b4dda1a3 Change QUERY_STORE to QUERY_BUFFERED
Set the value to 0 instead of 1 and remove all unnecessary usages of this constant

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2022-01-01 01:46:01 +00:00
Kamil Tekiela
47a039d70c Implement ResultInterface & MysqliResult
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-12-31 23:59:24 +00:00
Maurício Meneghini Fauth
400c9e1d93
Merge pull request #17204 from kamil-tekiela/Refactor-DatabaseInterface-getColumns()
Refactor DatabaseInterface::getColumns()
2021-11-26 15:07:20 -03:00
Kamil Tekiela
22a6fc9045
Minor refactoring of InsertEdit.php (#17199)
* Simplify condition

isset is not needed since the variable is set and we check explicitely for an array so it cannot be null either.
!empty is not needed because the variable is set, so we just need to check if it has non-empty value

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Reduce indentation thanks to early returns

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Collapse isset check

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant variable assignments

$specialCharsEncoded is immediately overwritten in if/else.
$noSupportTypes is always empty and never used in this code.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant !empty() checks on parameters and defined variables

if(!empty($var)) on defined variables is redundant and equivalent to if($var)

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant ternary

$dispval is declared to be a string so the ternary is redundant

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor showEmptyResultMessageOrSetUniqueCondition

Replace boolean variable with returns, which leads to redundant else
block. Remove redundant unset, which leads to redundant variable assignment.
The return statement can be replaced with a boolean cast.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant unset at the end of the method

When a variable leaves scope it is automatically unset

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* [RISKY] Remove temporary var and error supression

It's risky because I was not able to determine the purpose of the error
suppression. In case of error, the function seems to return -1, but that
has not been checked here either. It was possible to silence undefined
global variable, but in that case, why was it not done only on that one
line?

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant condition

The variable is declared as int|false so if it is not false and not 0,
the only logical choice is a non-zero integer, which is always true.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Misleading type hint leading to invalid unit tests

According to DbiMysqli the first argument should be mysqli_result.
The correct type hint cannot be array. It can be object though.
Tested with a debugger that the passed value is really mysqli_result.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove dead code

Remove $inputType. I left the comemnt for posterity, but the variable is
dead. If in the future someone decides to implement it again, then
introducing the variable will not be a problem.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Move block of code to where it should be

I am not sure about this block of code. I don't fully understand what
it is supposed to do. However, making the query at the start of the
function doesn't make sense to me.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Use array_keys instead of foreach with dummy variable

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Use is_null instead of isset

True conditions are easier to read than inverted conditions.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant variable and break

When the loop breaks then the variable is true.
When the loop finishes then the variable is false.
We can simply replace it with return true/false to make it simpler.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Add type declarations

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getEnumSetAndTimestampColumns

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant condition

According to searchColumnInForeigners $foreigner is dependant on values
from $foreigners which makes this check redundant.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getColumnEnumValues

Simplify parameter list, add psalm types, and simplify code

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getColumnSetValueAndSelectSize

Unfortunately, I cannot type hint the return value as then I would have
to type-hint the param as well.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove ternary operator

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getSelectOptionForUpload

Added types, removed NULL return (it is only outputted in Twig as
HTML string so NULL made no sense), and simpified parameters.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getMaxUploadSize

According to getMaxUploadSize the value can only be int.
Comparisons of numerical strings should be avoided. Psalm return type
can be added with the exact types.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getColumnSize

It takes a string as a second parameter now.
The reason for this is that during normal execution, the value comes
from column specifier e.g. VARCHAR(255), which is a string. The value
in spec_in_brackets could also represent ENUM/SET values, so it can't be
forced as an int.
This change required changing tests to pass a string instead of an array
with an int.
The behaviour should remain the same thanks to the (int) cast (previously
implicit, now explicit).

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove parameter $realNullValue

This parameter was always false. Instead define it as false inside
each method. The methods are private, so this should not cause any problems.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Add psalm-return

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Add an early return and clarify return type

This function should never return false

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Change return type to multidimensional array

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Refactor getCommentsMap

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Type hint $tableColumns as multidimensional array

This simplifies static analysis a little bit

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update phpstan baseline

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Fix invalid unit test

The method getTableColumns should return a multidimensional array always.
Added proper type hint to avoid further mistakes and changed mock.
According to my analysis this method should always return a
multidimensional array because parameter $column to getColumns() is null.
Also, this test is pretty useless as it just seems to test the bahaviour
of array_values which behaves as an identity function right now.

Note: The DBAL needs urgent refactoring too. I imagine array_values is
redundant at the moment. The getColumns should only return a list or
columns or a single column. There's no need to reindex the list. I think
Psalm should have picked it up, but I didn't check.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant call to Util::extractColumnSpec()

Warning! There is no coverage in unit tests for this piece of code.
While I have analysed the code flow manually, it is possible the
duplicated call had some unknown to me purpose.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update psalm-baseline.xml

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Adhere to the coding standard

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Revert "Remove ternary operator"

This reverts commit 3cbec2cebb.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Rename $field_MD5 to $fieldHashMd5

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Exclude string '0' from comparison and invert the order of operation

This helps with readability and it's unlikely that we would want to
check for string '0' here.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Rename $spec_in_brackets to $specInBrackets

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove else statements

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Introduce array_key_exists() and a local variable

We also add phpdoc comment telling static analysis that the value should
be a string. This is what the current code expects already.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove object parameter type declaration

Upon further inspection I realize this was wrong. The unit tests rely
on the parameter type being an integer and so we cannot force it to be
only an object. I leave the type hint as object as array was probably
never the right type.

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-11-26 14:19:04 -03:00
Kamil Tekiela
58d9bb4a32 Refactor DatabaseInterface::getColumns()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2021-11-25 10:28:39 +00:00
Maurício Meneghini Fauth
c1e864b1d7
Add Warning value object for SHOW WARNINGS rows
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-10-09 00:09:01 -03:00
Maurício Meneghini Fauth
67e96cf40c
Get default config values from Config\Settings classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-30 12:04:47 -03:00
Maurício Meneghini Fauth
3e0856c77b
Remove useless string concatenations
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-27 21:40:22 -03:00
Maurício Meneghini Fauth
f00d70cccb
Remove useless whitespaces
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-09-15 17:05:40 -03:00
William Desportes
1645ee38fb
Remove InsertEdit::getUrlParameters
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-20 16:12:30 +02:00
William Desportes
8f77a9f29d
Ref #15247 - Remove defined('TESTSUITE') from ReplaceController and remove an exit
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-07-15 02:39:14 +02:00
Maurício Meneghini Fauth
e8c28d1883
Remove some globals from Config::enableBc method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-07-08 19:49:26 -03:00
Maurício Meneghini Fauth
9adaa912e1
Rename Response class to ResponseRenderer
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-30 12:35:22 -03:00
Maurício Meneghini Fauth
21431578db
Fix some errors found by PHPStan and Psalm
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-24 18:03:14 -03:00
Maurício Meneghini Fauth
f3b79d83c0
Add PHPUnit's Covers annotation on test classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-06-04 23:39:26 -03:00
William Desportes
f5f636ef3b
Merge branch 'QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-05-28 21:43:28 +02:00
dima
822dce2e6e
Fix Uncaught TypeError: array_fill(): Argument #2 ($count) must be of type int, string
Co-Authored-by: William Desportes <williamdes@wdes.fr>
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-05-28 18:00:43 +02:00
Maurício Meneghini Fauth
c3b892f802
Merge branch 'QA_5_1'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-27 18:44:58 -03:00
Saksham Gupta
36fe47f8b9 Fixes #16892: current_timestamp() stringified on INSERT for date field
Signed-off-by: Saksham Gupta <shucon01@gmail.com>

Add tests and fix condition

Signed-off-by: Saksham Gupta <shucon01@gmail.com>

Fix lint

Signed-off-by: Saksham Gupta <shucon01@gmail.com>
2021-05-27 22:33:39 +05:30
Maurício Meneghini Fauth
eff631ac1b
Extract HTML from the InsertEdit::getActionsPanel method
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-27 12:06:17 -03:00
Maurício Meneghini Fauth
0cd6cbee13
Remove some .pma-table CSS classes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-05-14 00:25:41 -03:00
William Desportes
ba35901594
Merge branch 'origin/QA_5_1' into master
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-04-17 00:53:14 +02:00
Maurício Meneghini Fauth
a3e12976cf
Fix field size for text input
Fixes #16803

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-04-13 14:31:24 -03:00
William Desportes
7a3978a948
Remove useless htmlspecialchars on URL generation
Signed-off-by: William Desportes <williamdes@wdes.fr>
2021-04-13 17:23:12 +02:00
Maurício Meneghini Fauth
a7d6df17d6
Remove warnings from PHPUnit
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-04-09 13:28:47 -03:00
Maurício Meneghini Fauth
1bfaec1351
Extract the HTML from InsertEdit::getValueColumn
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-31 17:21:59 -03:00
Maurício Meneghini Fauth
bbb117b30b
Extract the HTML from InsertEdit::getFunctionColumn
Removes positive tabindex from function and null cells.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2021-03-28 17:17:19 -03:00