com php-src: Fix typo in SplFixedArray has_dimension implem entation: ext/spl/spl_fixedarray.c ext/spl/tests/SplF
ixedArray_override_offsetGet_only.phpt

From: Date: Mon, 01 May 2017 10:15:26 +0000
Subject: com php-src: Fix typo in SplFixedArray has_dimension implem entation: ext/spl/spl_fixedarray.c ext/spl/tests/SplF
ixedArray_override_offsetGet_only.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-97737@lists.php.net to get a copy of this message
Commit: 1967950dc33b87a5b92c33875885cfb0b5b5bffc Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 1 May 2017 12:14:53 +0200 Parents: d9dfac90bf4bc71c7724fe3777542429a79a5f63 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1967950dc33b87a5b92c33875885cfb0b5b5bffc Log: Fix typo in SplFixedArray has_dimension implementation Changed paths: M ext/spl/spl_fixedarray.c A ext/spl/tests/SplFixedArray_override_offsetGet_only.phpt Diff: diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index ab81d9e..87c5926 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -507,7 +507,7 @@ static int spl_fixedarray_object_has_dimension(zval *object, zval *offset, int c intern = Z_SPLFIXEDARRAY_P(object); - if (intern->fptr_offset_get) { + if (intern->fptr_offset_has) { zval rv; SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(object, intern->std..ce, &intern->fptr_offset_has, "offsetExists", &rv, offset); diff --git a/ext/spl/tests/SplFixedArray_override_offsetGet_only.phpt b/ext/spl/tests/SplFixedArray_override_offsetGet_only.phpt new file mode 100644 index 0000000..4ad03a4 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_override_offsetGet_only.phpt @@ -0,0 +1,22 @@ +--TEST-- +Overriding SplFixedArray::offsetGet() only +--FILE-- +<?php + +class MyArray extends SplFixedArray { + public function offsetGet($key) { + return "prefix_" . parent::offsetGet($key); + } +} + +$arr = new MyArray(1); +var_dump(isset($arr[0])); +$arr[0] = "abc"; +var_dump(isset($arr[0])); +var_dump($arr[0]); + +?> +--EXPECT-- +bool(false) +bool(true) +string(10) "prefix_abc"

« previous php.cvs (#97737) next »