#40136 [NEW]: ReflectionClass::implementsInterface() thowing exception

2007-01-15 Thread mark dot 2391 at blueyonder dot co dot uk
From: mark dot 2391 at blueyonder dot co dot uk
Operating system: Debian GNU/Linux
PHP version:  5.2.0
PHP Bug Type: Class/Object related
Bug description:  ReflectionClass::implementsInterface() thowing exception

Description:

The ReflectionClass::implementsInterface() correctly returns boolean true
for a given interface the subject class implements, but instead of
returning boolean false for one it does not, a ReflectionException is
thrown instead.

Reproduce code:
---
\n";
}
}

Greeting::sayHello();
$refl = new ReflectionClass('Greeting');

if ($refl->implementsInterface('Polite')) {
echo "Greeting implements Polite\n";
} else {
echo "Greeting does not implements Polite\n";
}


if ($refl->implementsInterface('Rude')) {
echo "Greeting implements Rude\n";
} else {
echo "Greeting does not implement Rude\n";
}
?>

Expected result:

Hello
Greeting implements Polite
Greeting does not implement Rude

Actual result:
--
Hello
Greeting implements Polite

Fatal error: Uncaught exception 'ReflectionException' with message
'Interface Rude does not exist' in
/home/mim/sites/intranet.home/tech/PHP/static-classes/static-object-usage.php:26
Stack trace: #0
/home/mim/sites/intranet.home/tech/PHP/static-classes/static-object-usage.php(26):
ReflectionClass->implementsInterface('Rude') #1 {main} thrown in
/home/mim/sites/intranet.home/tech/PHP/static-classes/static-object-usage.php
on line 26

-- 
Edit bug report at http://bugs.php.net/?id=40136&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40136&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40136&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40136&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40136&r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=40136&r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=40136&r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=40136&r=needscript
Try newer version:http://bugs.php.net/fix.php?id=40136&r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=40136&r=support
Expected behavior:http://bugs.php.net/fix.php?id=40136&r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=40136&r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=40136&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40136&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40136&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40136&r=dst
IIS Stability:http://bugs.php.net/fix.php?id=40136&r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=40136&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40136&r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=40136&r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=40136&r=mysqlcfg


#39235 [NEW]: Permit parameters in execute()

2006-10-23 Thread mark dot 2391 at blueyonder dot co dot uk
From: mark dot 2391 at blueyonder dot co dot uk
Operating system: Debian GNU/Linux
PHP version:  5.1.6
PHP Bug Type: Feature/Change Request
Bug description:  Permit parameters in execute()

Description:

I want to convert to MySqli from PDO's MySql driver as I'm hitting a known
bug in PDO that isn't getting fixed and I figure MySqli would be faster
anyway.

However, MySqli appears to be restrictive when compared to PDO in its
insistence that I use bind_params(). PDO allows the alternative to pass
Mysql parameters as an array to its execute() method.

My Mysql parameters are passed to me as an array in my code.
I do not know a way in PHP of passing an array of these parameters to
MySQLi while it insists on using bind_params which in turn insists on a
fixed list of named variables.

As I say, PDO copes with this as it's execute() method offers the
alternative choice while params to MySqli's execute() are marked as void,
and so it seems to me impossible to implement my Data Access Service layer
(which manages DB access on similar lines to the PHP SDO extension) with
Mysqli at the moment unless I completely lose the advantage of prepared
statements.

The code below hopefully illustrates the kind of usage I need (and as I
say, PDO allows). Perhaps there is a workaround I have not thought of.

Thanks in advance for any comments/tips,
Mark


Reproduce code:
---
execute($mysqlParams);

class MyDasStmt
{
protected $mysqlParamsStringTypes;
protected $stmt;

public function __construct($dbh, $sql, $mysqlParamsStringTypes)
{
$this->stmt = $dbh->stmt_init();
$this->stmt->prepare($sql);
}

public function execute(array $mysqlParams)
{
$this->stmt->execute($this->mysqlParamsStringTypes,
$mysqlParams);
// ...
}
}
?>


Expected result:

N/A

Actual result:
--
N/A

-- 
Edit bug report at http://bugs.php.net/?id=39235&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39235&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39235&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39235&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39235&r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=39235&r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=39235&r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=39235&r=needscript
Try newer version:http://bugs.php.net/fix.php?id=39235&r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=39235&r=support
Expected behavior:http://bugs.php.net/fix.php?id=39235&r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=39235&r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=39235&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39235&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39235&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39235&r=dst
IIS Stability:http://bugs.php.net/fix.php?id=39235&r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=39235&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39235&r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=39235&r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=39235&r=mysqlcfg