When on the form for creating a new node, there are several variables that are treated as if the node already exists. In PHP E_ALL, it causes about 8 notices to fire from unset variables and objects. This patch simply initializes some of those variables and adds some isset and empty calls.
Unfortunately for patch readability, my editor strips trailing whitespace, so what you're looking for related to this are 3 patch blocks.
+ $timestamp = NULL;
+ $comment = '';
+
// See if scheduling information is present.
- if ($node->_workflow_scheduled_timestamp && $node->_workflow_scheduled_sid) {
+ if (isset($node->_workflow_scheduled_timestamp) && isset($node->_workflow_scheduled_sid)) {
---------------
$name is never set anywhere previous in this function or passed as a parameter, so I just replaced it with an empty string.
- workflow_node_form($form, $form_state, $name, $name, $current, $choices, $timestamp, $comment);
+ workflow_node_form($form, $form_state, '', '', $current, $choices, $timestamp, $comment);
---------------
There is no nid when creating a node, so check to see if there is one before trying to query the db with it.
- $sid = db_result(db_query('SELECT sid FROM {workflow_node} WHERE nid = %d', $node->nid));
+ $sid = FALSE;
+
+ if (!empty($node->nid)) {
+ $sid = db_result(db_query('SELECT sid FROM {workflow_node} WHERE nid = %d', $node->nid));
+ }
Comments
Comment #1
deekayen commentedComment #2
deekayen commentedThis patch should be easier to read.
Comment #3
jvandyk commentedFixed. Thanks.