Page MenuHomePhorge

Initialize $cache_key variable in CelerityResourceController.php
ClosedPublic

Authored by aklapper on May 16 2024, 09:46.
Tags
None
Referenced Files
F3615671: D25642.1745304515.diff
Mon, Apr 21, 06:48
F3510347: D25642.1744804462.diff
Tue, Apr 15, 11:54
F3390392: D25642.1744466499.diff
Fri, Apr 11, 14:01
F3384199: D25642.1744401465.diff
Thu, Apr 10, 19:57
F3373274: D25642.1744264267.diff
Wed, Apr 9, 05:51
F3372210: D25642.1744249014.diff
Wed, Apr 9, 01:36
F3371469: D25642.1744242088.diff
Tue, Apr 8, 23:41
F3369474: D25642.1744215007.diff
Tue, Apr 8, 16:10

Details

Summary

$cache_key is unconditionally called in $cache->setKey($cache_key, $data) but is only defined if the previous condition if ($is_cacheable && $is_locally_cacheable && !$dev_mode) was true.
Thus initialize the variable to avoid a theoretical exception. (No additional null check is needed as $cache gets defined in the same condition.)

Test Plan

Carefully read the code.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

src/applications/celerity/controller/CelerityResourceController.php
102

And, maybe this line

I felt it's not necessarily needed but it cannot hurt either. :)

Thanks. Moreover, looking at PhutilKeyValueCache it seems that setKey(null) has no sense. So thanks also for that extra care you already set.

This revision is now accepted and ready to land.Jun 11 2024, 10:57