1--TEST-- 2replaceData() negative count (mod 32) 3--EXTENSIONS-- 4dom 5--SKIPIF-- 6<?php 7if (PHP_INT_SIZE === 4) die('skip not for 32-bit'); 8?> 9--FILE-- 10<?php 11 12echo "--- Modern behaviour ---\n"; 13 14$dom = Dom\HTMLDocument::createEmpty(); 15$comment = $dom->createComment("foobarbaz"); 16$comment->replaceData(0, -1, "A"); 17echo $dom->saveHtml($comment), "\n"; 18$comment = $dom->createComment("foobarbaz"); 19$comment->replaceData(2, -(2**32 - 2), "A"); 20echo $dom->saveHtml($comment), "\n"; 21 22echo "--- Legacy behaviour ---\n"; 23 24$dom = new DOMDocument; 25$comment = $dom->createComment("foobarbaz"); 26try { 27 $comment->replaceData(0, -1, "A"); 28} catch (DOMException $e) { 29 echo $e->getMessage(), "\n"; 30} 31echo $dom->saveHtml($comment), "\n"; 32try { 33 $comment->replaceData(2, -(2**32 - 2), "A"); 34} catch (DOMException $e) { 35 echo $e->getMessage(), "\n"; 36} 37echo $dom->saveHtml($comment), "\n"; 38 39?> 40--EXPECT-- 41--- Modern behaviour --- 42<!--A--> 43<!--foAarbaz--> 44--- Legacy behaviour --- 45Index Size Error 46<!--foobarbaz--> 47Index Size Error 48<!--foobarbaz--> 49