[development] need a standard for contrib node build_mode constants

Peter Wolanin pwolanin at gmail.com
Sun May 17 04:22:41 UTC 2009


The reason I was suggesting sticking with ints is that strings are
cast to int 0 during comparison:

php -r"var_dump('cck' == 0);"

bool(true)

And core has code like:

modules/upload/upload.module:363:  if ($node->build_mode == NODE_BUILD_RSS) {

modules/book/book.module:710:    if (!empty($node->book['bid']) &&
$node->build_mode == NODE_BUILD_NORMAL) {

So if CCK is using ints, that's a potentially serious bug - 0 is
NODE_BUILD_NORMAL, so I think any string build modes will basically
end up being this mode.

-Peter

On Sat, May 16, 2009 at 11:50 PM, Earl Miles <merlin at logrus.com> wrote:
> Peter Wolanin wrote:
>>
>> When doing some cleanup of my Modr8 module, I wanted to define a new
>> build_mode for use by
>> http://api.drupal.org/api/function/node_build_content/6
>
> I believe there is no need to stick with ints; CCK uses this and I think
> it's using strings.
>


More information about the development mailing list