mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 13:21:51 +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.
|
Reported by Neike Taika-Tessaro.
|
||||||
- Fix missing numeric entities on DirectLex; thanks Neike Taika-Tessaro
|
- Fix missing numeric entities on DirectLex; thanks Neike Taika-Tessaro
|
||||||
for reporting.
|
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
|
4.2.0, released 2010-09-15
|
||||||
! Added %Core.RemoveProcessingInstructions, which lets you remove
|
! Added %Core.RemoveProcessingInstructions, which lets you remove
|
||||||
|
@ -63,6 +63,7 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
|
|||||||
// handle size transform
|
// handle size transform
|
||||||
if (isset($attr['size'])) {
|
if (isset($attr['size'])) {
|
||||||
// normalize large numbers
|
// normalize large numbers
|
||||||
|
if ($attr['size'] !== '') {
|
||||||
if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
|
if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
|
||||||
$size = (int) $attr['size'];
|
$size = (int) $attr['size'];
|
||||||
if ($size < -2) $attr['size'] = '-2';
|
if ($size < -2) $attr['size'] = '-2';
|
||||||
@ -71,6 +72,7 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
|
|||||||
$size = (int) $attr['size'];
|
$size = (int) $attr['size'];
|
||||||
if ($size > 7) $attr['size'] = '7';
|
if ($size > 7) $attr['size'] = '7';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (isset($this->_size_lookup[$attr['size']])) {
|
if (isset($this->_size_lookup[$attr['size']])) {
|
||||||
$prepend_style .= 'font-size:' .
|
$prepend_style .= 'font-size:' .
|
||||||
$this->_size_lookup[$attr['size']] . ';';
|
$this->_size_lookup[$attr['size']] . ';';
|
||||||
|
@ -162,6 +162,10 @@ class HTMLPurifier_TagTransformTest extends HTMLPurifier_Harness
|
|||||||
$this->assertSizeToStyle($transformer, '+3', '200%');
|
$this->assertSizeToStyle($transformer, '+3', '200%');
|
||||||
$this->assertSizeToStyle($transformer, '+4', '300%');
|
$this->assertSizeToStyle($transformer, '+4', '300%');
|
||||||
$this->assertSizeToStyle($transformer, '+5', '300%');
|
$this->assertSizeToStyle($transformer, '+5', '300%');
|
||||||
|
$this->assertTransformation(
|
||||||
|
$transformer, 'font', array('size' => ''),
|
||||||
|
'span', array()
|
||||||
|
);
|
||||||
|
|
||||||
// test multiple transforms, the alphabetical ordering is important
|
// test multiple transforms, the alphabetical ordering is important
|
||||||
$this->assertTransformation(
|
$this->assertTransformation(
|
||||||
|
Loading…
Reference in New Issue
Block a user