Warrnings:
"date() expects parameter 2 to be long, string given .....token_node.inc, line 35 to 46".
and second problem.. when node->created is empty (when creating new node) path for uploaded files is empty too.
I think there should be if statment like this:
token_node.inc:
line 19:

if (empty($node->created)) {
    $node->created = time();
  }
      $values['yyyy']           = date('Y', $node->created);
      $values['yy']             = date('y', $node->created);
      $values['month']          = date('F', $node->created);
      $values['mon']            = date('M', $node->created);
      $values['mm']             = date('m', $node->created);
      $values['m']              = date('n', $node->created);
      $values['ww']             = date('W', $node->created);
      $values['date']           = date('N', $node->created);
      $values['day']            = date('l', $node->created);
      $values['ddd']            = date('D', $node->created);
      $values['dd']             = date('d', $node->created);
      $values['d']              = date('j', $node->created);
if (!(empty($node->changed))) {
      $values['mod-yyyy']       = date('Y', $node->changed);
      $values['mod-yy']         = date('y', $node->changed);
      $values['mod-month']      = date('F', $node->changed);
      $values['mod-mon']        = date('M', $node->changed);
      $values['mod-mm']         = date('m', $node->changed);
      $values['mod-m']          = date('n', $node->changed);
      $values['mod-ww']         = date('W', $node->changed);
      $values['mod-date']       = date('N', $node->changed);
      $values['mod-day']        = date('l', $node->changed);
      $values['mod-ddd']        = date('D', $node->changed);
      $values['mod-dd']         = date('d', $node->changed);
      $values['mod-d']          = date('j', $node->changed);
}

Comments

greggles’s picture

Status: Active » Postponed (maintainer needs more info)

under what scenarios does this occur?

greggles’s picture

Please respond with an answer to the question of "under what scenarios does this occur" ?

This seems pretty error-prone to me. One option is that the consuming module (e.g. upload path, apparently) could set the $node->created prior to handing the object to token.

dmitrig01’s picture

Status: Postponed (maintainer needs more info) » Fixed

This was fixed in an earlier commit

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

yan’s picture

Version: 5.x-1.6 » 5.x-1.9
Status: Closed (fixed) » Active

I re-open this issue since I still get the same error in 5.x-1.9 (folders are named "[yyyy]/[mm]" instead of replacing the tokens by numbers). I think it's just the following that needs to be included in token_node.inc (and hasn't been so far):

if (empty($node->created)) {
  $node->created = time();
}
meatbites’s picture

Status: Active » Postponed (maintainer needs more info)

Can you give an idea on how to reproduce this error? Does upgrading to Token 5.x-1.10 help?

It sounds more like a bug of a node-creating module not setting a creation date. In which case, that'd probably be the best module under which to file this bug.

yan’s picture

Version: 5.x-1.10 » 5.x-1.9
Status: Active » Postponed (maintainer needs more info)

sorry, clicked twice. edited this one and deleted double info.

yan’s picture

Version: 5.x-1.9 » 5.x-1.10
Status: Postponed (maintainer needs more info) » Active

Can you give an idea on how to reproduce this error?

I'm using the upload field (file attachments) with upload path module and token module. In upload path settings I put [yyyy]/[mm] as upload folder. When I create a new node and upload an image, $node->created is empty, i.e. the tokens are not replaced by the numbers of the actual date.

Does upgrading to Token 5.x-1.10 help?

No, it doesn't. The problem is still there. I think it has to do with the empty $node->created.

greggles’s picture

Version: 5.x-1.9 » 5.x-1.10
Status: Postponed (maintainer needs more info) » Closed (won't fix)

This seems pretty error-prone to me. One option is that the consuming module (e.g. upload path, apparently) could set the $node->created prior to handing the object to token.

I don't like this idea in token. If Eaton disagrees then he should feel free to override me, but IMO this is up to the calling module to handle.

yan’s picture

I don't like this idea in token.

Could you tell why?

IMO this is up to the calling module to handle.

Which one would that be? The node module? In my understanding it is quite obvious that there is no creation time/date before the creation of the node.

greggles’s picture

I think I said why I don't like it in comment #2 and then quoted it in comment #9. To be more clear:

If we add a created time to the node object (which is passed by refererence by default in php5) then we run the risk of messing up the processing by another module. I don't want token to be responsible for that.

I also said that it's up to the consuming module (upload path, apparently) to do the right thing here.

yan’s picture

Ok greggles, I raised the issue for upload path (the same problem has just been mentioned there):
#219132: Problem with yyyy, mm, dd tokens