Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
See #1328180: Minor error when upgrading nodes programmaticly.. We want people to be able to define $node->path['pathauto'], but this causes a PHP notice because path_node_insert/update and path_taxonomy_term_insert/update only check if isset($item->path) and not isset($item->path['alias']) which seems more reasonable.
Comment | File | Size | Author |
---|---|---|---|
#10 | 1576552-path-notice-9.patch | 1015 bytes | jcisio |
#6 | drupal-path-php-notice-1576552-06.patch | 861 bytes | jhedstrom |
#1 | drupal-path-prevent_notices-1576552-1.patch | 920 bytes | markie |
Comments
Comment #1
markie CreditAttribution: markie commentedpretty basic patch attached.
Comment #4
jhedstromComment #5
BerdirI don't think this applies to 8.x anymore.
Comment #6
jhedstromRe-rolled for D7.
Comment #7
SpadXIII CreditAttribution: SpadXIII commentedLooks like a nice and simple patch that works like a charm!
Comment #8
David_Rothstein CreditAttribution: David_Rothstein commentedThe path_node_insert() change looks fine, but I'm not sure about the way the patch does it in path_node_update() since that function contains this code further down:
So if you pass a 'pid' without an 'alias', currently it will run path_delete() (albeit with a PHP notice), but with the patch, path_delete() will be skipped entirely. I'm not sure what the practical consequences of that would be, but do we really want to change that behavior as a side effect of fixing the PHP notice...?
Comment #9
jcisio CreditAttribution: jcisio at Axess Open Web Services commentedI don't know we can have !empty($path['pid']) with $path['alias'] unset. BTW attached patch to keep the current behavior and to fix the notices.
Comment #10
jcisio CreditAttribution: jcisio at Axess Open Web Services commentedComment #11
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedYup, that looks good now and seems to work correctly.
Comment #12
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedCommitted to 7.x - thanks!