-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--TEST-- | ||
Bug #62059: ArrayObject and isset are not friends | ||
--FILE-- | ||
<?php | ||
|
||
class MyArrayObject1 extends ArrayObject { | ||
public function offsetGet($name) { | ||
echo "offsetGet($name)\n"; | ||
return parent::offsetGet($name); | ||
} | ||
public function offsetExists($name) { | ||
echo "offsetExists($name)\n"; | ||
return parent::offsetExists($name); | ||
} | ||
} | ||
class MyArrayObject2 extends ArrayObject { | ||
public function offsetGet($name) { | ||
echo "offsetGet($name)\n"; | ||
return parent::offsetGet($name); | ||
} | ||
} | ||
class MyArrayObject3 extends ArrayObject { | ||
public function offsetExists($name) { | ||
echo "offsetExists($name)\n"; | ||
return parent::offsetExists($name); | ||
} | ||
} | ||
|
||
$arr = [1 => [1 => 42]]; | ||
$ao = new ArrayObject($arr); | ||
var_dump(isset($ao[0][1])); | ||
var_dump(isset($ao[1][0])); | ||
var_dump(isset($ao[1][1])); | ||
$ao = new MyArrayObject1($arr); | ||
var_dump(isset($ao[0][1])); | ||
var_dump(isset($ao[1][0])); | ||
var_dump(isset($ao[1][1])); | ||
$ao = new MyArrayObject2($arr); | ||
var_dump(isset($ao[0][1])); | ||
var_dump(isset($ao[1][0])); | ||
var_dump(isset($ao[1][1])); | ||
$ao = new MyArrayObject3($arr); | ||
var_dump(isset($ao[0][1])); | ||
var_dump(isset($ao[1][0])); | ||
var_dump(isset($ao[1][1])); | ||
|
||
?> | ||
--EXPECT-- | ||
bool(false) | ||
bool(false) | ||
bool(true) | ||
offsetExists(0) | ||
bool(false) | ||
offsetExists(1) | ||
offsetGet(1) | ||
bool(false) | ||
offsetExists(1) | ||
offsetGet(1) | ||
bool(true) | ||
bool(false) | ||
offsetGet(1) | ||
bool(false) | ||
offsetGet(1) | ||
bool(true) | ||
offsetExists(0) | ||
bool(false) | ||
offsetExists(1) | ||
bool(false) | ||
offsetExists(1) | ||
bool(true) |