mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 06:37:55 +08:00 
			
		
		
		
	Fix #17793: Fix inconsistent handling of null data attribute values in yii\helpers\BaseHtml::renderTagAttributes()
				
					
				
			This commit is contained in:
		
				
					committed by
					
						
						Alexander Makarov
					
				
			
			
				
	
			
			
			
						parent
						
							7e471e3010
						
					
				
				
					commit
					beca7b45d3
				
			@ -12,6 +12,7 @@ Yii Framework 2 Change Log
 | 
				
			|||||||
- Bug #12539: `yii\filters\ContentNegotiator` now generates 406 'Not Acceptable' instead of 415 'Unsupported Media Type' on content-type negotiation fail (PowerGamer1)
 | 
					- Bug #12539: `yii\filters\ContentNegotiator` now generates 406 'Not Acceptable' instead of 415 'Unsupported Media Type' on content-type negotiation fail (PowerGamer1)
 | 
				
			||||||
- Bug #17760: Fix `JSON::encode()` for `\DateTimeInterface` under PHP 7.4 (samdark)
 | 
					- Bug #17760: Fix `JSON::encode()` for `\DateTimeInterface` under PHP 7.4 (samdark)
 | 
				
			||||||
- Enh #17792: Added support for `aria` attributes to `yii\helpers\BaseHtml::renderTagAttributes()` (brandonkelly)
 | 
					- Enh #17792: Added support for `aria` attributes to `yii\helpers\BaseHtml::renderTagAttributes()` (brandonkelly)
 | 
				
			||||||
 | 
					- Bug #17793: Fix inconsistent handling of null `data` attribute values in `yii\helpers\BaseHtml::renderTagAttributes()` (brandonkelly)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2.0.31 December 18, 2019
 | 
					2.0.31 December 18, 2019
 | 
				
			||||||
 | 
				
			|||||||
@ -1961,7 +1961,7 @@ class BaseHtml
 | 
				
			|||||||
                            if ($v) {
 | 
					                            if ($v) {
 | 
				
			||||||
                                $html .= " $name-$n";
 | 
					                                $html .= " $name-$n";
 | 
				
			||||||
                            }
 | 
					                            }
 | 
				
			||||||
                        } else {
 | 
					                        } elseif ($v !== null) {
 | 
				
			||||||
                            $html .= " $name-$n=\"" . static::encode($v) . '"';
 | 
					                            $html .= " $name-$n=\"" . static::encode($v) . '"';
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
				
			|||||||
@ -1028,6 +1028,14 @@ EOD;
 | 
				
			|||||||
            ],
 | 
					            ],
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
        $this->assertEquals('', Html::renderTagAttributes($attributes));
 | 
					        $this->assertEquals('', Html::renderTagAttributes($attributes));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $attributes = [
 | 
				
			||||||
 | 
					            'data' => [
 | 
				
			||||||
 | 
					                'foo' => null,
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					        $this->assertEquals('', Html::renderTagAttributes($attributes));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function testAddCssClass()
 | 
					    public function testAddCssClass()
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user