1--TEST-- 2Bug #42945 (preg_split() swallows part of the string) 3--FILE-- 4<?php 5 6var_dump(preg_match_all('/\b/', "a'", $m, PREG_OFFSET_CAPTURE)); 7var_dump($m); 8 9var_dump(preg_split('/\b/', "a'")); 10var_dump(preg_split('/\b/', "a'", -1, PREG_SPLIT_OFFSET_CAPTURE)); 11var_dump(preg_split('/\b/', "a'", -1, PREG_SPLIT_NO_EMPTY)); 12var_dump(preg_split('/\b/', "a'", -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_OFFSET_CAPTURE)); 13 14?> 15--EXPECT-- 16int(2) 17array(1) { 18 [0]=> 19 array(2) { 20 [0]=> 21 array(2) { 22 [0]=> 23 string(0) "" 24 [1]=> 25 int(0) 26 } 27 [1]=> 28 array(2) { 29 [0]=> 30 string(0) "" 31 [1]=> 32 int(1) 33 } 34 } 35} 36array(3) { 37 [0]=> 38 string(0) "" 39 [1]=> 40 string(1) "a" 41 [2]=> 42 string(1) "'" 43} 44array(3) { 45 [0]=> 46 array(2) { 47 [0]=> 48 string(0) "" 49 [1]=> 50 int(0) 51 } 52 [1]=> 53 array(2) { 54 [0]=> 55 string(1) "a" 56 [1]=> 57 int(0) 58 } 59 [2]=> 60 array(2) { 61 [0]=> 62 string(1) "'" 63 [1]=> 64 int(1) 65 } 66} 67array(2) { 68 [0]=> 69 string(1) "a" 70 [1]=> 71 string(1) "'" 72} 73array(2) { 74 [0]=> 75 array(2) { 76 [0]=> 77 string(1) "a" 78 [1]=> 79 int(0) 80 } 81 [1]=> 82 array(2) { 83 [0]=> 84 string(1) "'" 85 [1]=> 86 int(1) 87 } 88} 89