[php-src] Issue #7746: mysqli_sql_exception->getSqlState()
| From: | noreply@php.net | Date: | Thu, 09 Dec 2021 23:46:38 +0000 |
| Subject: | [php-src] Issue #7746: mysqli_sql_exception->getSqlState() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238309@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7746
Author: nunoperalta
### Description
Hello,
About
mysqli_sql_exception:
https://www.php.net/manual/en/class.mysqli-sql-exception.php
What's the point of:
protected string $sqlstate;
if we cannot access it?
I was also trying:
```
class mysqli_sql_exception_x extends \mysqli_sql_exception {
public function getSqlState() : string {
return $this->sqlstate;
}
}
```
But then I get:
> Class mysqli_sql_exception_x may not inherit from final class (mysqli_sql_exception)
Why doesn't \mysqli_sql_exception contain a getSqlState() method?
I see some workarounds with using Reflection, etc, but that's obviously not ideal.
At least we can still use mysqli_sqlstate, but still...