WordPress.WP.AlternativeFunctions.file_system_operations error messages cannot be fixed anymore
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia in ruleset.xml, nelle regole WordPress.WP.AlternativeFunctions.file_system_operations, e confronta i messaggi configurati con il comportamento in VIPCS 3.0.0 e WordPressCS 3.1.0. Riproduci il problema con lo snippet fopen() fornito e verifica le indicazioni risultanti. Il lavoro è completo quando gli errori segnalati non contengono più indicazioni di risoluzione fuorvianti e tutte le regole correlate alle operazioni sul file system hanno un comportamento esplicito e coerente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug Description
WordPress.WP.AlternativeFunctions.file_system_operations error messages are overwritten in the ruleset, e.g.
<rule ref="WordPress.WP.AlternativeFunctions.file_system_operations_fopen">
<message>File system operations only work on the `/tmp/` and `wp-content/uploads/` directories. To avoid unexpected results, please use helper functions like `get_temp_dir()` or `wp_get_upload_dir()` to get the proper directory path when using functions such as %s(). For more details, please see: https://docs.wpvip.com/technical-references/vip-go-files-system/local-file-operations/</message>
</rule>
However since WPCS 3.0.0 this error can only be fixed by using WP_Filesystem. Neither get_temp_dir() or wp_get_upload_dir() will make the error go away and it's unclear why (unless you debug and find the original error message where it says WP_Filesystem)
Minimal Code Snippet
$f = fopen( get_temp_dir() . '/abc.log' );
Error Code
WordPress.WP.AlternativeFunctions.file_system_operations_fopen
Environment
| Question | Answer |
|---|---|
| PHP version | 8.3 |
| VIPCS version | 3.0.0 |
| WordPressCS version | 3.1.0 |
Additional Context (optional)
With WP_Filesystem, I think it's unnecessary to overwrite those errors in the first place and these overwrites can all be removed from ruleset.xml
Possibly, errors like WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_fputcsv should be changed to a also only allow WP_Filesystem ?
Tested Against main branch?
- I have verified the issue still exists in the
mainbranch of VIPCS. - I have verified the issue still exists in the
developbranch of VIPCS.
- Lingua principale
- PHP
- Stelle
- 261
- Fork
- 44
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Automattic/VIP-Coding-Standards
-
AlwaysReturnInFilter: isInsideIfConditonal() guards the conditions array after reading itForse già presa @tomjn l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Bug: PreGetPosts warns when the early is_main_query() return is not the first statement in its ifForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
-
Suppress filters in get_posts false positiveForse già presa @tomjn l’ha presa 3 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
-
Breaking Change Type: Maintenance
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
Automattic/VIP-Coding-Standards#849 · 1 commento ·
Tutte le issue di Automattic/VIP-Coding-Standards
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
PrestaShopCorp/ps_accounts#666 ·
-
Security SecurityBundle
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
symfony/symfony-docs#23173 ·
I maintainer di solito rispondono entro 3 giorni
-
incomplete
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
opnsense/plugins#5763 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
fossology/fossology#3893 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Documentation Feature: Self-Register / Verify UI
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno