Skip to content

Commit 3cbc65b

Browse files
489: Fix z-index size too big in 64bit OS
1 parent 0beeb27 commit 3cbc65b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PhpWord/Writer/Word2007/Style/Frame.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
*/
2929
class Frame extends AbstractStyle
3030
{
31+
const PHP_32BIT_INT_MAX = 2147483647;
32+
3133
/**
3234
* Write style.
3335
*
@@ -41,7 +43,8 @@ public function write()
4143
}
4244
$xmlWriter = $this->getXmlWriter();
4345

44-
$zIndices = array(FrameStyle::WRAP_INFRONT => PHP_INT_MAX, FrameStyle::WRAP_BEHIND => -PHP_INT_MAX);
46+
$maxZIndex = min(PHP_INT_MAX, self::PHP_32BIT_INT_MAX);
47+
$zIndices = array(FrameStyle::WRAP_INFRONT => $maxZIndex, FrameStyle::WRAP_BEHIND => -$maxZIndex);
4548

4649
$properties = array(
4750
'width' => 'width',

0 commit comments

Comments
 (0)