Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/editengine/PhabricatorEditEngine.php
Show First 20 Lines • Show All 965 Lines • ▼ Show 20 Lines | if ($use_default) { | |||||||||
} | } | |||||||||
} | } | |||||||||
if ($config->getIsDisabled()) { | if ($config->getIsDisabled()) { | |||||||||
return $this->buildDisabledFormResponse($object, $config); | return $this->buildDisabledFormResponse($object, $config); | |||||||||
} | } | |||||||||
$page_key = $request->getURIData('pageKey'); | $page_key = $request->getURIData('pageKey'); | |||||||||
if (!strlen($page_key)) { | if (!phutil_nonempty_string($page_key)) { | |||||||||
$pages = $this->getPages($object); | $pages = $this->getPages($object); | |||||||||
if ($pages) { | if ($pages) { | |||||||||
$page_key = head_key($pages); | $page_key = head_key($pages); | |||||||||
} | } | |||||||||
} | } | |||||||||
if (strlen($page_key)) { | if (phutil_nonempty_string($page_key)) { | |||||||||
valerio.bozzolan: ✅ I tested this locally with `phlog()` in various pages and it seems `$page_key` is always null… | ||||||||||
$page = $this->selectPage($object, $page_key); | $page = $this->selectPage($object, $page_key); | |||||||||
if (!$page) { | if (!$page) { | |||||||||
return new Aphront404Response(); | return new Aphront404Response(); | |||||||||
} | } | |||||||||
} | } | |||||||||
switch ($action) { | switch ($action) { | |||||||||
case 'parameters': | case 'parameters': | |||||||||
▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | if ($request->isFormOrHisecPost() && $request->getBool('editEngine')) { | |||||||||
} | } | |||||||||
$page_state->setIsError(true); | $page_state->setIsError(true); | |||||||||
} | } | |||||||||
} else { | } else { | |||||||||
if ($this->getIsCreate()) { | if ($this->getIsCreate()) { | |||||||||
$template = $request->getStr('template'); | $template = $request->getStr('template'); | |||||||||
if (strlen($template)) { | if (phutil_nonempty_string($template)) { | |||||||||
Not Done Inline Actions
⚠️ It seems $template should accept integers or strings. So, phutil_nonempty_string() is probably not appropriate since with an integer it will throw an exception. valerio.bozzolan: ⚠️ It seems `$template` should accept **integers** or strings. So, `phutil_nonempty_string()`… | ||||||||||
Done Inline ActionsOK I do not have a strong opinion about this since the getStr() method above just returns a string. So, green light here. valerio.bozzolan: OK I do not have a strong opinion about this since the `getStr()` method above just returns a… | ||||||||||
$template_object = $this->newObjectFromIdentifier( | $template_object = $this->newObjectFromIdentifier( | |||||||||
$template, | $template, | |||||||||
array( | array( | |||||||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | |||||||||
)); | )); | |||||||||
if (!$template_object) { | if (!$template_object) { | |||||||||
return new Aphront404Response(); | return new Aphront404Response(); | |||||||||
} | } | |||||||||
▲ Show 20 Lines • Show All 1,573 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ I tested this locally with phlog() in various pages and it seems $page_key is always null or string like "core". Any other alien value will be reported and this is OK.