cannot variable_set() anything FALSE using patterns - patch attached

dman - July 26, 2009 - 12:12
Project:Patterns
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Here's an example minimal pattern

All I want is

<?php
   variable_set
("site_map_show_rss_links", FALSE);
?>

<?xml version="1.0" encoding="ISO-8859-1"?>
<pattern>
  <info><!-- blah blah --></info>
  <actions>
    <variable name="site_map_show_rss_links">0</variable>
  </actions>
</pattern>

... does not work due to a line in the middle of system.inc
A common oversight - needed isset().

-            if (!$item['value'] && !$item['delete']) {
+            if (! isset($item['value']) && !$item['delete']) {
             $value = $item;

It actually ends up putting a malformed array into the variable ... which registers as TRUE , so we can never turn things off.

Patch attached.

AttachmentSize
patterns-allow_variables_to_be_set_to_false.patch795 bytes

#1

sarvab - July 28, 2009 - 09:10
Status:needs review» closed

Nice catch. Fix committed and should be no reason for review here so closing.

 
 

Drupal is a registered trademark of Dries Buytaert.