#49279 [NEW]: Current does not seem to work with Iterator

2009-08-17 Thread andrew at ajohnstone dot com
From: andrew at ajohnstone dot com
Operating system: debain
PHP version:  5.2.10
PHP Bug Type: *General Issues
Bug description:  Current does not seem to work with Iterator

Description:

Current does not seem to work with Iterator

Reproduce code:
---
1,
1=>2,
2=>3,
3=>4,
4=>5,
);

public function getIterator() {
var_dump(__FUNCTION__);
return $this->getCurrentItems();
}

public function getCurrentItems() {
return $this->_data;
}

public function current() {
var_dump(__FUNCTION__);
$this->_data = $this->getCurrentItems();
return current($this->_data);
}

public function key() {
var_dump(__FUNCTION__);
return key($this->_data);
}

public function next() {
var_dump(__FUNCTION__);
next($this->_data);
}

public function rewind() {
var_dump(__FUNCTION__);
$this->_data = $this->getCurrentItems();
$this->_pointer = 0;
reset($this->_data);
}

public function valid() {
var_dump(__FUNCTION__);
return (current($this->_data) !== FALSE);
}


}

$c = new test();
var_dump(current($c));


Expected result:

string 'current' (length=7)
1

Actual result:
--
bool(false)

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



#49321 [NEW]: Warning: Division by zero in Command line code on line 1 on strtotime

2009-08-21 Thread andrew at ajohnstone dot com
From: andrew at ajohnstone dot com
Operating system: Debian
PHP version:  5.2.10
PHP Bug Type: Date/time related
Bug description:  Warning: Division by zero in Command line code on line 1 on 
strtotime

Description:

Warning: Division by zero in Command line code on line 1
on strtotime

Reproduce code:
---
php -r 'var_dump(strtotime('21/08/2009'));'

Warning: Division by zero in Command line code on line 1

Call Stack:
0.0001 100992   1. {main}() Command line code:0

bool(false)


Expected result:

php -r 'var_dump(strtotime('21/08/2009'));'
bool(false)


Actual result:
--
Warning: Division by zero in Command line code on line 1

Call Stack:
0.0001 100992   1. {main}() Command line code:0
bool(false)


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



#49441 [NEW]: filter_var - FILTER_VALIDATE_EMAIL

2009-09-02 Thread andrew at ajohnstone dot com
From: andrew at ajohnstone dot com
Operating system: Debian
PHP version:  5.2.10
PHP Bug Type: *General Issues
Bug description:  filter_var - FILTER_VALIDATE_EMAIL

Description:

var_dump(filter_var('and...@bb1.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
bool(false)

var_dump(filter_var('and...@debian.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
bool(false)

php -v PHP 5.2.10-2 


Reproduce code:
---
var_dump(filter_var('and...@bb1.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
var_dump(filter_var('and...@debian.gateway.2wire.net',FILTER_VALIDATE_EMAIL));


Expected result:

string(28) "and...@bb1.gateway.2wire.net"
string(31) "and...@debian.gateway.2wire.net"

Actual result:
--
bool(false)
bool(false)

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



#47009 [NEW]: PDO can't handle commented out lines with bound params

2009-01-05 Thread andrew at ajohnstone dot com
From: andrew at ajohnstone dot com
Operating system: fedora
PHP version:  5.2.8
PHP Bug Type: PDO related
Bug description:  PDO can't handle commented out lines with bound params

Description:

databaseException: SQLSTATE[HY093]: Invalid parameter number: number of
bound variables does not match number of tokens

Can't handle commented out lines with bound params

Reproduce code:
---
SELECT 
  *
FROM 
  mapping_outlets mo
  JOIN media_outlets USING(mapping_outlets_id)
WHERE
  -- mo.mapping_outlets_id = ?
  mo.media_outlets_id = ?
GROUP BY ml.name
ORDER BY NULL
LIMIT 500

Expected result:

Ignore the commented outline.

Actual result:
--
databaseException: SQLSTATE[HY093]: Invalid parameter number: number of
bound variables does not match number of tokens

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



#47009 [Fbk->Opn]: PDO can't handle commented out lines with bound params

2009-01-06 Thread andrew at ajohnstone dot com
 ID:   47009
 User updated by:  andrew at ajohnstone dot com
 Reported By:  andrew at ajohnstone dot com
-Status:   Feedback
+Status:   Open
 Bug Type: PDO related
 Operating System: fedora
 PHP Version:  5.2.8
 New Comment:

Thanks for the quick response, I should have stated this was using
MySQL PDO driver.


Previous Comments:


[2009-01-06 11:13:19] johan...@php.net

I'm quite sure this is a problem with PS emulation, I have no test
system at hand ...

Not sue how to handle it in our parser:The SQL standard wants, afaik, a
space behind the --, MySQL fr instance doesn't need it.Additionally the
same problem should exist with /* */ comments, which are implemented in
different way, too (MySQL need no */)

Following the standard might still break stuff, not following the
standard might break other case, making it driver dependent will give a
mess...



[2009-01-05 22:44:03] fel...@php.net

Which SGBD are you using?



[2009-01-05 22:36:31] fel...@php.net

I can't reproduce it using sqlite.

query('create table if not exists foo (x int)');
$x->query('insert into foo values (1)');
$x->query('insert into foo values (2)');
$y = $x->prepare('select x from foo 
where 
-- x = ?
x = ?');
var_dump($y->execute(array(2)));
var_dump($y->fetch());
var_dump($y->errorInfo());




bool(true)
array(2) {
  ["x"]=>
  string(1) "2"
  [0]=>
  string(1) "2"
}
array(1) {
  [0]=>
  string(5) "0"
}


----

[2009-01-05 15:34:08] andrew at ajohnstone dot com

Description:

databaseException: SQLSTATE[HY093]: Invalid parameter number: number of
bound variables does not match number of tokens

Can't handle commented out lines with bound params

Reproduce code:
---
SELECT 
  *
FROM 
  mapping_outlets mo
  JOIN media_outlets USING(mapping_outlets_id)
WHERE
  -- mo.mapping_outlets_id = ?
  mo.media_outlets_id = ?
GROUP BY ml.name
ORDER BY NULL
LIMIT 500

Expected result:

Ignore the commented outline.

Actual result:
--
databaseException: SQLSTATE[HY093]: Invalid parameter number: number of
bound variables does not match number of tokens





-- 
Edit this bug report at http://bugs.php.net/?id=47009&edit=1



[PHP-BUG] Req #51499 [NEW]: mysql_warning_count to be implemented

2010-04-07 Thread andrew at ajohnstone dot com
From: 
Operating system: 
PHP version:  Irrelevant
Package:  PDO related
Bug Type: Feature/Change Request
Bug description:mysql_warning_count to be implemented

Description:

The warning count is sent in the returned OK packet from a executed
statement, however there is no functionality within PDO to extract, how
many warnings were triggered from the statement.



This will save on round trips to the database to identify whether data
could have been truncated for example.



http://dev.mysql.com/doc/refman/5.0/en/mysql-warning-count.html

http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Types_Of_Result_Packets



This would need to be implemented for other drivers too.


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



[PHP-BUG] Bug #52401 [NEW]: throw construct invalid within conditional

2010-07-22 Thread andrew at ajohnstone dot com
From: 
Operating system: 
PHP version:  5.3.2
Package:  Scripting Engine problem
Bug Type: Bug
Bug description:throw construct invalid within conditional

Description:

The following is a valid:



(!array_key_exists($class, $this->_data)) AND new
InvalidArgumentException("Class does not exist");



However the following is not:



(!array_key_exists($class, $this->_data)) AND throw new
InvalidArgumentException("Class does not exist");

Test script:
---
(!array_key_exists($class, $this->_data)) AND throw new
InvalidArgumentException("Class does not exist");

Expected result:

No syntax error

Actual result:
--
Parse error: syntax error, unexpected

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52401&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52401&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52401&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=52401&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52401&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52401&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52401&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=52401&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=52401&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=52401&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=52401&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=52401&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=52401&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=52401&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52401&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=52401&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=52401&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=52401&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=52401&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=52401&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=52401&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=52401&r=mysqlcfg