mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 08:21:52 +00:00
Fix E_NOTICE from indexing into empty string.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
This commit is contained in:
parent
b4469f17aa
commit
ee9c70ab7f
2
NEWS
2
NEWS
@ -43,6 +43,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
||||
Reported by Neike Taika-Tessaro.
|
||||
- Fix missing numeric entities on DirectLex; thanks Neike Taika-Tessaro
|
||||
for reporting.
|
||||
- Fix harmless notice from indexing into empty string. Thanks Matthijs
|
||||
Kooijman <matthijs@stdin.nl> for reporting.
|
||||
|
||||
4.2.0, released 2010-09-15
|
||||
! Added %Core.RemoveProcessingInstructions, which lets you remove
|
||||
|
@ -63,13 +63,15 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
|
||||
// handle size transform
|
||||
if (isset($attr['size'])) {
|
||||
// normalize large numbers
|
||||
if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
|
||||
$size = (int) $attr['size'];
|
||||
if ($size < -2) $attr['size'] = '-2';
|
||||
if ($size > 4) $attr['size'] = '+4';
|
||||
} else {
|
||||
$size = (int) $attr['size'];
|
||||
if ($size > 7) $attr['size'] = '7';
|
||||
if ($attr['size'] !== '') {
|
||||
if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
|
||||
$size = (int) $attr['size'];
|
||||
if ($size < -2) $attr['size'] = '-2';
|
||||
if ($size > 4) $attr['size'] = '+4';
|
||||
} else {
|
||||
$size = (int) $attr['size'];
|
||||
if ($size > 7) $attr['size'] = '7';
|
||||
}
|
||||
}
|
||||
if (isset($this->_size_lookup[$attr['size']])) {
|
||||
$prepend_style .= 'font-size:' .
|
||||
|
@ -162,6 +162,10 @@ class HTMLPurifier_TagTransformTest extends HTMLPurifier_Harness
|
||||
$this->assertSizeToStyle($transformer, '+3', '200%');
|
||||
$this->assertSizeToStyle($transformer, '+4', '300%');
|
||||
$this->assertSizeToStyle($transformer, '+5', '300%');
|
||||
$this->assertTransformation(
|
||||
$transformer, 'font', array('size' => ''),
|
||||
'span', array()
|
||||
);
|
||||
|
||||
// test multiple transforms, the alphabetical ordering is important
|
||||
$this->assertTransformation(
|
||||
|
Loading…
Reference in New Issue
Block a user