RemexHtml/Tokenizer/Tokenizer.php
protected function handleNulls( $text, $sourcePos ) {
		if ( $this->ignoreNulls ) {
			return $text;
		}
		if ( !$this->ignoreErrors ) {
			$offset = 0;
			while ( true ) {
				$nullPos = strpos( $text, "\0", $offset );
				if ( $nullPos === false ) {
					break;
				}
				$this->error( "replaced null character", $sourcePos + $nullPos );
				if ( $nullPos < strlen( $text ) - 1 ) {
					$offset = $nullPos + 1;
				} else {
					break;
				}
			}
		}
		return str_replace( "\0", self::REPLACEMENT_CHAR, $text );
	}
protected function handleNulls( $text, $sourcePos ) {
		if ( $this->ignoreNulls ) {
			return $text;
		}
		if ( !$this->ignoreErrors ) {
			$offset = 0;
			while ( true ) {
				$nullPos = strpos( $text, "\0", $offset );
				if ( $nullPos === false ) {
					break;
				}
				$this->error( "replaced null character", $sourcePos + $nullPos );
				if ( $nullPos < strlen( $text ) - 1 ) {
					$offset = $nullPos + 1;
				} else {
					break;
				}
			}
		}
		return str_replace( "\0", self::REPLACEMENT_CHAR, $text );
	}
protected function handleNulls ( $ text , $ sourcePos ) { if ( $ this -> ignoreNulls ) { return $ text ; } if ( ! $ this -> ignoreErrors ) { $ offset = 0 ; while ( true ) { $ nullPos = strpos ( $ text , "\0" , $ offset ) ; if ( $ nullPos === false ) { break ; } $ this -> error ( "replaced null character" , $ sourcePos + $ nullPos ) ; if ( $ nullPos < strlen ( $ text ) - 1 ) { $ offset = $ nullPos + 1 ; } else { break ; } } } return str_replace ( "\0" , self :: REPLACEMENT_CHAR , $ text ) ; }
Generic helper for all those points in the spec where U+0000 needs to be
replaced with U+FFFD with a parse error issued.

@param string $text The text to be converted
@param int $sourcePos The input byte offset from which $text was
extracted, for error position reporting.
@return string The converted text
Generic helper for all those points in the spec where U + 0000 needs to be replaced with U + FFFD with a parse error issued .