Page MenuHomePhorge

Fix InvalidArgumentException on commit hook
ClosedPublic

Authored by valerio.bozzolan on Apr 14 2023, 12:05.
Tags
None
Referenced Files
F2992237: D25122.1740208416.diff
Fri, Feb 21, 07:13
F2983682: D25122.1739996032.diff
Tue, Feb 18, 20:13
F2962326: D25122.1739179386.diff
Sun, Feb 9, 09:23
F2962325: D25122.1739179382.diff
Sun, Feb 9, 09:23
F2962324: D25122.1739179378.diff
Sun, Feb 9, 09:22
F2962323: D25122.1739179374.diff
Sun, Feb 9, 09:22
F2961737: D25122.1739169965.diff
Sun, Feb 9, 06:46
F2950215: D25122.1738734790.diff
Tue, Feb 4, 05:53

Details

Summary

Fix a regression introduced here:

96ae4ba13acbf0e2f8932e950a92af0495f034d7

I reproduced this exception executing "svn commit" on a hosted repository.

That crash happened because the PHP getenv() function can return false.
But, that is a very terrible value that blasts the non-string-empty check.

So, now the default getenv() value is skipped, without causing problems.

Closes T15253
Ref T15190

Test Plan
  • I've run svn commit and I have not encountered any issue now

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • fix damn linter putting every line under 80 chars

Removed some whitespaces unremoved by lint autofixer

scripts/repository/commit_hook.php
121

https://www.php.net/manual/en/function.getenv.php

«returns ... false if the environment variable varname does not exist»

This revision is now accepted and ready to land.Apr 14 2023, 17:06