Bug #63591 [Fbk->Nab]: Can't write to properties of mysqli classes using Reflection API
| From: | laruence@php.net | Date: | Sat, 24 Nov 2012 16:20:09 +0000 |
| Subject: | Bug #63591 [Fbk->Nab]: Can't write to properties of mysqli classes using Reflection API | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174905@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63591&edit=1
ID: 63591
Updated by: laruence@php.net
Reported by: HMWiesinger at gmx dot at
Summary: Can't write to properties of mysqli classes using
Reflection API
-Status: Feedback
+Status: Not a bug
Type: Bug
Package: MySQLi related
Operating System: Linux
PHP Version: 5.4.9
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
mysqli link properties are designed to be read-only.
the write func for them throw that error:
static int mysqli_write_na(mysqli_object *obj, zval *newval TSRMLS_DC)
{
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot write property");
return FAILURE;
}
Previous Comments:
------------------------------------------------------------------------
[2012-11-24 15:23:48] reeze@php.net
affected_rows property is kinda readonly property, so we can't change
that with reflection apis or property value update.
it makes the property reliable, I don't see a reason to change that,
I you really need to do that inherit it with a subclass.
------------------------------------------------------------------------
[2012-11-23 20:07:34] HMWiesinger at gmx dot at
Description:
------------
It doesn't seem to be possible to get write access to properties of mysqli classes
using the Reflection API.
Test script:
---------------
$mysqli = new MySQLi();
$reflection = new ReflectionClass('\MySQLi');
$property = $reflection->getProperty('affected_rows');
$property->setAccessible(TRUE);
$property->setValue($mysqli, 10);
Expected result:
----------------
No Error
Actual result:
--------------
Fatal error: ReflectionProperty::setValue(): Cannot write property
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63591&edit=1