[drupal-devel] [bug] phptemplate.engine: is_int/is_numeric confusion
Issue status update for http://drupal.org/node/27781 Post a follow up: http://drupal.org/project/comments/add/27781 Project: Drupal Version: cvs Component: theme system Category: bug reports Priority: normal Assigned to: Anonymous Reported by: wiz Updated by: wiz Status: patch Attachment: http://drupal.org/files/issues/phptemplate_node.patch (720 bytes) I've wondered why $node is not defined anymore in my theme's page.tpl.php. The reason is a modified expression in phptemplate.engine, which now reads: if ((arg(0) == 'node') && is_int(arg(1))) { arg(1) may be the node number, but it is a string variable, and therefore this check is always false. is_int should be replaced with the code given in the patch. wiz
Issue status update for http://drupal.org/node/27781 Post a follow up: http://drupal.org/project/comments/add/27781 Project: Drupal Version: cvs Component: theme system Category: bug reports Priority: normal Assigned to: Anonymous Reported by: wiz Updated by: Robrecht Jacques Status: patch (code needs review) Attachment: http://drupal.org/files/issues/phptemplate-is_int.patch (739 bytes) Rerolled the patch (and changed the coding: eg Drupal uses "&&", not "and"). I think wiz is correct: you should use "is_numeric" here, not "is_int". Robrecht Jacques Previous comments: ------------------------------------------------------------------------ Fri, 29 Jul 2005 16:59:38 +0000 : wiz Attachment: http://drupal.org/files/issues/phptemplate_node.patch (720 bytes) I've wondered why $node is not defined anymore in my theme's page.tpl.php. The reason is a modified expression in phptemplate.engine, which now reads: if ((arg(0) == 'node') && is_int(arg(1))) { arg(1) may be the node number, but it is a string variable, and therefore this check is always false. is_int should be replaced with the code given in the patch.
Issue status update for http://drupal.org/node/27781 Post a follow up: http://drupal.org/project/comments/add/27781 Project: Drupal Version: cvs Component: theme system Category: bug reports Priority: normal Assigned to: Anonymous Reported by: wiz Updated by: yogadex Status: patch (code needs review) Consider: if (arg(1) && ctype_digit [1](arg(1))); reportedly performs better than is_numeric(), and true only for integers. [1] http://us2.php.net/manual/en/function.ctype-digit.php yogadex Previous comments: ------------------------------------------------------------------------ Fri, 29 Jul 2005 16:59:38 +0000 : wiz Attachment: http://drupal.org/files/issues/phptemplate_node.patch (720 bytes) I've wondered why $node is not defined anymore in my theme's page.tpl.php. The reason is a modified expression in phptemplate.engine, which now reads: if ((arg(0) == 'node') && is_int(arg(1))) { arg(1) may be the node number, but it is a string variable, and therefore this check is always false. is_int should be replaced with the code given in the patch. ------------------------------------------------------------------------ Thu, 08 Sep 2005 23:13:39 +0000 : Robrecht Jacques Attachment: http://drupal.org/files/issues/phptemplate-is_int.patch (739 bytes) Rerolled the patch (and changed the coding: eg Drupal uses "&&", not "and"). I think wiz is correct: you should use "is_numeric" here, not "is_int".
participants (3)
-
Robrecht Jacques -
wiz -
yogadex