Issue #1576552 by jhedstrom, jcisio, markie: Prevent PHP notices in path_node_insert/update if $node->path is defined but $node->path['alias'] is not

merge-requests/26/head
David Rothstein 2015-10-13 00:00:49 -04:00
parent 21598ba65e
commit e719d5cfe2
1 changed files with 3 additions and 3 deletions

View File

@ -185,7 +185,7 @@ function path_form_element_validate($element, &$form_state, $complete_form) {
* Implements hook_node_insert().
*/
function path_node_insert($node) {
if (isset($node->path)) {
if (isset($node->path) && isset($node->path['alias'])) {
$path = $node->path;
$path['alias'] = trim($path['alias']);
// Only save a non-empty alias.
@ -205,9 +205,9 @@ function path_node_insert($node) {
function path_node_update($node) {
if (isset($node->path)) {
$path = $node->path;
$path['alias'] = trim($path['alias']);
$path['alias'] = isset($path['alias']) ? trim($path['alias']) : '';
// Delete old alias if user erased it.
if (!empty($path['pid']) && empty($path['alias'])) {
if (!empty($path['pid']) && !$path['alias']) {
path_delete($path['pid']);
}
path_node_insert($node);