File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings / bug55871.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:45 2012 UTC (12 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--TEST--
Bug #55871 (Interruption in substr_replace())
--FILE--
<?php
class test1 {
	public function __toString() {
		preg_match('//', '', $GLOBALS['my_var']);
		return '';
	}
}

class test2 {
        public function __toString() {
		$GLOBALS['my_var'] += 0x08048000;
                return '';
        }
}

class test3 {
        public function __toString() {                
                $GLOBALS['my_var'] .= "AAAAAAAA";
                return '';
        }
}

$my_var = str_repeat('A', 40);
$out = substr_replace(array(&$my_var), array(new test1), 40, 0);
var_dump($out);
$my_var = str_repeat('A', 40);
$out = substr_replace(array(&$my_var), array(new test2), 40, 0);
var_dump($out);
$my_var = str_repeat('A', 40);
$out = substr_replace(array(&$my_var), array(new test3), 40, 0);
var_dump($out);
--EXPECTF--

Warning: substr_replace(): Argument was modified while replacing in %s on line %d
array(0) {
}

Warning: substr_replace(): Argument was modified while replacing in %s on line %d
array(0) {
}

Warning: substr_replace(): Argument was modified while replacing in %s on line %d
array(0) {
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>