Commit Graph

11176 Commits

Author SHA1 Message Date
MDW
6e5c4ef851 Fix PHPDoc date_m typo 2024-03-11 21:43:50 +01:00
John BOTELLA
9aaae61c9a Fix var 2024-03-11 16:49:46 +01:00
MDW
b7acea0ec4 Fix: PhanTypeMismatchDeclaredParamNullable notices
# Fix: PhanTypeMismatchDeclaredParamNullable notices

PHPDoc must indicate param is nullable if the default is null
with explicit typing.
(+Improved some other typing from generic Object to CommonObject).
2024-03-11 16:47:38 +01:00
Laurent Destailleur
93638f3980 Merge pull request #28667 from atm-john/fix_element_type_part_03
NEW : Factoring and Fix external module elementType limit - Part 03
2024-03-11 16:19:00 +01:00
Laurent Destailleur
38e67851bf Merge pull request #28747 from mdeweerd/test/security_dol_eval_ob_cleanup_on_exception
Fix: Ob buffer cleanup on exception
2024-03-11 16:17:14 +01:00
John BOTELLA
84ac33e1f5 Merge branch 'develop' of github.com:Dolibarr/dolibarr into fix_element_type_part_06 2024-03-11 16:14:28 +01:00
John BOTELLA
12ae786b0d Merge branch 'develop' into fix_element_type_part_05 2024-03-11 15:52:51 +01:00
terhoy
a8a2f0ff73 FIX: online signature partly fails if commercial proposal numbering contains a mask that’s includes a space (#28608) (#28742)
* FIX: online signature (#28608) Update signature.lib.php

If Commercial proposal numbering contains a mask that’s includes a space, that will affect the result of the online signature form. When generating the online signature form, the code in signature.lib.php line 77, will remove any existing space in the Commercial proposal numbering. The result is that the online signature form will miss data in field “Third-party” and “Amount”.

* FIX: online signature (#28608) Update payments.lib.php

If Commercial proposal numbering contains a mask that’s includes a space, that will affect the result of the online signature form. When generating the online signature form, the code in core/lib/payments.lib.ph, will remove any existing space in the Commercial proposal numbering.
2024-03-11 15:33:10 +01:00
Laurent Destailleur
41078a9a46 Merge branch 'develop' into test/security_dol_eval_ob_cleanup_on_exception 2024-03-11 14:57:33 +01:00
John BOTELLA
ed6874154d Merge branch 'develop' into fix_element_type_part_05 2024-03-11 14:33:48 +01:00
Laurent Destailleur
0f2121e3ba Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop 2024-03-11 13:46:08 +01:00
Laurent Destailleur
b7a246cedb Merge branch 'develop' into test/security_dol_eval_ob_cleanup_on_exception 2024-03-11 13:18:19 +01:00
MDW
dbfb1180ee Qual: Fix PhanPluginDuplicateIfStatements & remove exceptions (#28749)
# Qual: Fix PhanPluginDuplicateIfStatements & remove exceptions

Fix occurences of PhanPluginDuplicateIfStatements which are if statements where the
consecutive branches execute the same code, making it useles to test the condition
2024-03-11 12:58:51 +01:00
Laurent Destailleur
ff0d147847 Merge branch 'develop' into test/security_dol_eval_ob_cleanup_on_exception 2024-03-11 12:48:31 +01:00
MDW
48073b85cb Fix: 'count' on scalar zip->numFiles (#28756) 2024-03-11 12:39:07 +01:00
Laurent Destailleur
a327d39062 Fix warning 2024-03-11 11:39:51 +01:00
Laurent Destailleur
453eb9c242 FIX: upload odt files should not start/end with space 2024-03-10 15:53:35 +01:00
Laurent Destailleur
ec1b8284c9 Rename files to use an english name 2024-03-10 15:52:29 +01:00
Laurent Destailleur
5a5fa9293f FIX: upload odt files should not start/end with space 2024-03-10 15:42:38 +01:00
MDW
101d56a2c1 Fix: Ob buffer cleanup on exception
# Fix: Ob buffer cleanup on exception

The OB buffer capture was incorrectly cleaned up on exception.
This fixes that.

Also modified the SecurityTest to enable running it standalone
2024-03-10 15:17:58 +01:00
Laurent Destailleur
429476e293 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop 2024-03-10 01:53:32 +01:00
MDW
37afba949e Fix most PhanTypeMismatchDimAssignment notices (#28739)
* Qual: Add typing to fix PhanTypeMismatchDimAssignment notice

* Fix: Initialise array for code in somme

* Qual: Update type hint for  argument in _Set_Format

* Qual: Update type hint for childtables

* Qual: Add typing to attributes

* Qual: Add typing for _msgContent

* Qual: Suppress PhanTypeMismatchDimAssignment

* Qual: Add typing for liste

* Qual: Add typing to fields

* Qual: Add typing hint for $objMod

* Qual: Modify assignment of array with bool keys for phan typing

Demonstration:
```
php -r '$a=[true=>"yes",false=>"no"];var_dump($a);'
# Result demonstrates bool keys are converted to int.
Command line code:1:
array(2) {
  [1] =>
  string(3) "yes"
  [0] =>
  string(2) "no"
}
```

* Qual: Add typing hint to indicate value is not null

* Force non-null type on $paramname

* Qual: Add typing hint to getCats()

* Update inc.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-03-10 01:53:04 +01:00
Laurent Destailleur
28df0ba1ab Fix doc 2024-03-10 01:49:56 +01:00
MDW
c95bab2818 Qual: Add check on addExtraField type argument (#28738)
* Qual: Add check on addExtraField type argument

# Qual: Add check on addExtraField type argument

Added a check on the type argument for addExtraField

* Qual: Update phan ignore with more specific name
2024-03-10 01:46:10 +01:00
MDW
d023b43da9 Fix: Ensure string type for urlencode() 2024-03-09 16:55:46 +01:00
MDW
c7b1a924c2 Fix: Ensure string type for urlencode() 2024-03-09 16:55:45 +01:00
MDW
0b19aa415c Fix: Initialise array before assigning values (#28728)
* Qual: Enable PhanUndeclaredVariableDim

# Qual: Enable PhanUndeclaredVariableDim

The notifications are fixed in the code so the detection no longer
needs to be suppressed in the default flow

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Fix: initialise array before adding fields

* Qual: Add type hint to array to avoid phan notification

* Qual: Add type hint to array to avoid phan notification

* Qual: Enable PhanParamSpecial1 (all resolved)

* Qual: Ignore false PhanTypeArraySuspiciousNullable

* Qual: Improve typing to fix PhanTypeArraySuspicious

* Qual: Fix PhanTypeArraySuspicious by replacing null assignment with empty array

* Qual: Fix PhanTypeArraySuspicious by testing as instancof DebugBar

* Qual: Fix PhanTypeComparisonToArray with enhanced typing

* Qual: Fix PhanTypeComparisonToArray with enhanced typing

* Qual: Enable phan messages that no longer appear

* Qual: Exclude phan stubs from codesniffer ruleset
2024-03-09 16:32:02 +01:00
Laurent Destailleur
abc57a767b Merge branch 'develop' into fix_element_type_part_05 2024-03-09 15:23:23 +01:00
Frédéric FRANCE
e00a9816f8 fix phpstan (#28727)
* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
2024-03-09 14:48:06 +01:00
thibdrev
2cb4d40e5e qual: phan for functions.lib.php (#28655)
* Update card.php

* Update functions.lib.php

* Update card.php

* Update releve.php

* Update card-rec.php

* Update card.php

* Update prelevement.php

* Update card.php

* Update index.php

* Update index.php

* Update html.form.class.php

* Update card.php

* Update conferenceorbooth_card.php

* Update conferenceorbooth_contact.php

* Update conferenceorbooth_document.php

* Update conferenceorbooth_list.php

* Update conferenceorboothattendee_card.php

* Update conferenceorboothattendee_list.php

* Update shipment.php

* Update card.php

* Update card-rec.php

* Update card.php

* Update card.php

* Update document.php

* Update card.php

* Update comment.php

* Update element.php

* Update ganttview.php

* Update tasks.php

* Update comment.php

* Update contact.php

* Update document.php

* Update note.php

* Update task.php

* Update time.php

* Update card.php

* Update card.php

* Update bank.php

* Update card.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-03-09 01:49:07 +01:00
Laurent Destailleur
f1f9c2ee2e Merge branch 'develop' into fix_element_type_part_05 2024-03-09 01:48:08 +01:00
Laurent Destailleur
f4713ad8a2 Merge branch 'develop' into fix_element_type_part_03 2024-03-09 01:47:38 +01:00
MDW
746ca01423 Fix: Correctly close active output buffer. (#28723)
# Fix: Correctly close active output buffer.

Use ob_get_clean(), not ob_get_contents() and ob_clean().

Tests were failing with:
FunctionsLibTest::testVerifCond with data set "Test that verifConf("0") returns false" ('0', false)
Test code or tested code did not (only) close its own output buffers

OK, but incomplete, skipped, or risky tests\!

Also refactored a test case to use a data provider which helped identify that it was related
to dol_eval.
2024-03-09 01:27:01 +01:00
MDW
4de7c67010 Qual: PhanCompatibleNegativeStringOffset must be suppressed (#28720)
# Qual: PhanCompatibleNegativeStringOffset must be suppressed

Apparently the PhanCompatibleNegativeStringOffset notice can not be avoided
through the '>=1' condition hint, so suppress it explicitly
2024-03-09 01:06:37 +01:00
Laurent Destailleur
defc98f471 Merge branch 'develop' into fix_element_type_part_03 2024-03-08 22:04:51 +01:00
Laurent Destailleur
9a839a1c08 Merge branch 'develop' into fix_element_type_part_05 2024-03-08 21:40:34 +01:00
MDW
3d0a85608b Qual: Fix and enable alias deprecation detection (#28716)
* Qual: Ignore some false positives for deprecated functions

# Qual: Ignore some false positives for deprecated functions

The Phan Deprecation Plugin for internal functions has mixed up some
mail functions and lists them as deprecated, this ignores that

* Qual: Enable detection and fixing of internal deprecations

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Replace 'join' with 'implode'

* Qual: Update codespell lines ignore list after format

# Qual: Update codespell lines ignore list after forma

Done using latest library, so also adds some exceptions that are needed
in the future;

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-03-08 21:34:18 +01:00
MDW
f309d1634c Qual: Better hint for index value for phan (#28712)
# Qual: Better hint for index value for phan.

($i - 1) must be >= 0, so update test from $i>0 to $i>=1 .
This helps static analysis.
2024-03-08 21:30:46 +01:00
Laurent Destailleur
7ab339e97f Fix regression 2024-03-08 17:54:32 +01:00
John BOTELLA
c4cb7c0a98 Add cache feature on fetchObjectByElement 2024-03-08 16:55:53 +01:00
Laurent Destailleur
6df4a5eded Use a better name for thirdparties site account 2024-03-08 16:42:49 +01:00
Can Arslan
e74e638b26 FIX: skip adding tab if user doesn't have permission (#28698)
verifCond function checks whether user has right and we should skip adding it if user doesn't have right
2024-03-08 12:28:31 +01:00
John BOTELLA
d1c980b0be Factoring fetchObjectLinked 2024-03-08 11:57:07 +01:00
John BOTELLA
076a009554 Merge branch 'develop' into fix_element_type_part_03 2024-03-08 10:46:35 +01:00
Eric Seigne
57e5599d82 Merge branch '18.0' into 18.0-ticket_code_review 2024-03-08 00:12:22 +01:00
MDW
79adb60cf5 Qual: Add instanceof tests to help static typing analysis (#28696)
# Qual: Add instanceof tests to help static typing analysis

Added instanceof tests to help identify that properties exist.
2024-03-07 23:09:25 +01:00
Anthony Berton
ff03f86a50 NEW - See the documents of my subordinates (#28318)
* NEW - See the documents of my subordinates

* cop

* Rewriting

* up

* ok

* FIX - Restriction on sale representative

---------

Co-authored-by: Anthony Berton <anthony.berton@bb2a.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-03-07 22:47:29 +01:00
Frédéric FRANCE
c2379bfdf5 fix phpstan (#28694)
* fix phpstan

* fix typo

* fix phpstan
2024-03-07 21:39:29 +01:00
Laurent Destailleur
1d77e34daf Merge branch 'develop' into fix_element_type_part_03 2024-03-07 20:33:17 +01:00
thibdrev
e2026a1c14 qual: phan for functions.lib.php (#28654)
6 entries for:

TypeError PhanTypeMismatchArgumentProbablyReal Argument 5 ($objcon) is null of type null but \show_actions_messaging() takes \Contact|string (no real type) defined at htdocs/core/lib/functions.lib.php:13081
2024-03-07 20:23:45 +01:00