#44135 [Com]: PDO MySQL does not support CLIENT_FOUND_ROWS

2008-02-15 Thread larry at garfieldtech dot com
 ID:   44135
 Comment by:   larry at garfieldtech dot com
 Reported By:  chx1975 at gmail dot com
 Status:   Open
 Bug Type: PDO related
 Operating System: Linux
 PHP Version:  5.2.5
 New Comment:

I can duplicate this problem.  The issue appears to be that by 
default, MySQL will return the number of affected rows from a 
previous UPDATE statement, not the number of matched rows.  That 
values will differ if the update statement would set a row to its 
existing value.  With ext/mysql and ext/mysqli, it can be set to 
return matched rows instead.  PDO does not appear to have a way to 
allow that.


Previous Comments:


[2008-02-16 03:26:34] chx1975 at gmail dot com

Description:

mysql_real_connect supports client flags
http://dev.mysql.com/doc/refman/4.1/en/mysql-real-connect.html most
importantly CLIENT_FOUND_ROWS but PDO provides no way to pass it in.






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


[PHP-BUG] Bug #52280 [NEW]: LimitIterator cannot take IteratorAggregate inner iterator

2010-07-07 Thread larry at garfieldtech dot com
From: 
Operating system: Any
PHP version:  5.2.13
Package:  SPL related
Bug Type: Bug
Bug description:LimitIterator cannot take IteratorAggregate inner iterator

Description:

LimitIterator declares in its constructor that it only takes an Iterator as
its inner iterator rather than just a Traversable as its parent
IteratorIterator does.  That becomes a problem when, for example, an object
that implements IteratorAggregate is passed into a LimitIterator.  Although
IteratorAggregate will produce an Iterator via its getIterator() method, it
is not itself an Iterator, just Traversable, so LimitIterator will reject
it.



I'm running my code on PHP 5.2.6 but according to the documentation this is
an issue in 5.3 still.  Technically this behavior is what the documentation
currently reads, but I believe it is a bug that LimitIterator demands an
Iterator, not just a Traversable, and therefore breaks in this case.

Test script:
---
class Foo implements IteratorAggregate {

  protected $array = array(1, 2, 3, 4, 5);

  public function getIterator() {

return new ArrayIterator($this->array);

  }

}



$f = new LimitIterator(new Foo(), 0, 3);

foreach ($f as $a) {

  print $a . PHP_EOL;

}

Expected result:

1

2

3

Actual result:
--
Catchable fatal error: Argument 1 passed to LimitIterator::__construct()
must implement interface Iterator, instance of Foo given in
/blah/blah/test.php on line 10

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



Bug #47494 [Com]: htmlspecialchars does not throw E_WARNING on multibyte problems

2011-06-01 Thread larry at garfieldtech dot com
Edit report at http://bugs.php.net/bug.php?id=47494&edit=1

 ID: 47494
 Comment by: larry at garfieldtech dot com
 Reported by:philipp dot feigl at gmail dot com
 Summary:htmlspecialchars does not throw E_WARNING on
 multibyte problems
 Status: Bogus
 Type:   Bug
 Package:Strings related
 Operating System:   CentOS5
 PHP Version:5.2.8
 Block user comment: N
 Private report: N

 New Comment:

This bug should be reopened, not just documented.  Haven't we learned
our lesson with magic_quotes and its ilk?  Designing PHP to try and save
the user when the user does something stupid always backfires.  Always. 
MySQL has the same problem, and it backfires there, too.



The current logic is simply backward.  "When display_errors is on, you
get all errors except from this function.  When display_errors is off,
you get no errors except from this one function."  There is no logical
reason for that.



I'm working on a project that has been stalled for over a week while we
try to figure out what's wrong with the character encoding configuration
on our production server, only to realize that the data is (probably)
bad but we didn't know it because of this bug.



This is a bug and should be fixed, not simply documented as dumb.



If a production server is misconfigured, that's not the job of the
language to fix.  All that does is, as another commenter noted, punish
those who configure their servers properly.  If anything, it is a
security hole for people who DO configure their server properly by
turning off display_errors, as then these strings would get echoed in
production.  How is that helpful to anyone?


Previous Comments:

[2011-05-03 17:48:02] pinkgothic at gmail dot com

Could this bug please get REOPENED as a documentation bug

then? As already stated, the absence of the information in

the documentation can be crippling for people who do things

-right-. (Admittedly right now "htmlspecialchars" has my

comment on the subject, but that's hardly official...)



(Sidenote: You might also want to close Bug #54109 as bogus

for consistency.)


[2011-05-03 17:33:35] ras...@php.net

This isn't a logic error. The idea is to prevent a user-triggered
information 

leak by not showing this error to the user in case a production server
is 

misconfigured and running with display_errors turned on.


[2011-05-02 14:48:50] example at example dot com

Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too!
Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too!
Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too!
Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too!
Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too!
Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too! Me too!


[2011-03-10 18:05:11] dtajchre...@php.net

I say this is a logic error. Bugs #54109 and #52397 also mention the
same 

behavior in two other spots of code. 

php_error_docref already handles display_errors configurations... I
don't how 

this would be considered correct/intended 

behavior.. 



Questionable logic: http://svn.php.net/viewvc/php/php-

src/branches/PHP_5_3/ext/standard/html.c?view=markup#l1145



if(!PG(display_errors)) { 

php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid multibyte sequence


in argument");

}


[2011-03-10 17:37:31] pinkgothic at gmail dot com

I'm afraid this isn't just confusing, but actually punishes people who
do it right by blindsiding them completely.



Scenario:



 * display_errors off

 * an Exception-throwing error handler



As far as I'm informed, this is good practise. (I acknowledge I may be
misinformed.)



However, due to this behaviour, you suddenly get application crashes in
production without that anyone really 

understands why the code snippet is suddenly a culprit. 'But we tested
it with broken UTF-8, why are -we- just 

getting empty strings? And the documentation says that's what we should
be expecting...'



> If a configuration variable tells that errors are shown on screen then
I

> think all errors (dependent on reporting level) are shown - and not
that

> they can be only logged if the configuration variable is turned off.

> I think/hope this is not only my opinion.



Yeah, you're not alone; but live and learn, I guess? :)



> For debugging, I would suggest always logging errors and