[PHP-BUG] Bug #52302 [NEW]: mysqli_fetch_all does not work with MYSQLI_USE_RESULT

2010-07-10 Thread brianlm...@php.net
From: 
Operating system: Linux
PHP version:  5.3.2
Package:  MySQLi related
Bug Type: Bug
Bug description:mysqli_fetch_all does not work with MYSQLI_USE_RESULT

Description:

When using MYSQLI_USE_RESULT as the second parameter to mysqli_query,
fetch_all returns null.

Test script:
---
query($sql, MYSQLI_USE_RESULT);



$rows = $res->fetch_all();



var_dump($rows);



?>

Expected result:

An array of the table data.

Actual result:
--
NULL

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



Bug #52301 [Bgs]: signature incompatibility warning when used with interfaces

2010-07-10 Thread colder
Edit report at http://bugs.php.net/bug.php?id=52301&edit=1

 ID:   52301
 Updated by:   col...@php.net
 Reported by:  giorgio dot liscio at email dot it
 Summary:  signature incompatibility warning when used with
   interfaces
 Status:   Bogus
 Type: Bug
 Package:  Class/Object related
 Operating System: all
 PHP Version:  5.3.2

 New Comment:

Currently, arguments are invariant. And if not, they should be
contra-variant, but 

surely not co-variant like you want.



Your subclass is more strict that the super class which is wrong, as any
subclass 

should be able to be used as instances of the super class.


Previous Comments:

[2010-07-09 20:58:28] giorgio dot liscio at email dot it

i think it is a bug because with abstract classes works good



abstract class A {}

abstract class X { abstract public function __construct(A $x); } // must
be at least A



class A_BASED extends A {}

class X_BASED extends X { public function __construct(A_BASED $x){} } //
it is A_BASED, so it satisfy A


[2010-07-09 20:54:22] giorgio dot liscio at email dot it

but my A_BASED is a valid instance of A too



class A_BASED implements A {}





constructor



__construct(A_BASED $TESTTEST) {}



overrides



abstract __construct(A $TESTTEST) {}



and A_BASED instanceof A === TRUE



so i don't limit anything because all methods required by interface A
are implemented in class A_BASED


[2010-07-09 20:15:59] johan...@php.net

interface X guarantees that any A may be passed. You limit it to
A_BASED. MyClass is a valid A but no A_BASED, so X_BASED won't accept
it, which conflicts with the promise by interface X.


[2010-07-09 18:13:23] giorgio dot liscio at email dot it

hi johannes, please read better my example



interface A {}

interface X { public function __construct(A $x); }



class A_BASED implements A {}

class X_BASED implements X { public function __construct(A_BASED
$TESTTEST){} }



interface X

says its constructor first parameter should be "instance of A"



XBASED implements X

says its constructor first parameter should be "instance of A_BASED"

A_BASED as type hint is correct because A_BASED implements A


[2010-07-09 17:53:23] johan...@php.net

class MyClass implements A {}

new X_BASED(new MyClass);



won't be accepted while X says MyClass would be valid as a constructor
Parameter -> contract not fullfilled. So PHP's error is correct.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

http://bugs.php.net/bug.php?id=52301


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


Bug #52260 [Opn->Asn]: Windows implementation of dns_get_record fails with non-existing domain

2010-07-10 Thread felipe
Edit report at http://bugs.php.net/bug.php?id=52260&edit=1

 ID:   52260
 Updated by:   fel...@php.net
 Reported by:  a_jelly_doughnut at phpbb dot com
 Summary:  Windows implementation of dns_get_record fails with
   non-existing domain
-Status:   Open
+Status:   Assigned
 Type: Bug
 Package:  Network related
 Operating System: Windows (All)
 PHP Version:  5.3.2
-Assigned To:  
+Assigned To:  pajoye



Previous Comments:

[2010-07-06 02:08:26] a_jelly_doughnut at phpbb dot com

Description:

Windows implementation of dns_get_record fails with non-existing domain



---

var_dump(dns_get_record('dalfkjdaslfj.net')); // return false, throw
E_WARNING

---



This is inconsistent with the *NIX implementation, which never (in our
testing, see * note at bottom) throws E_WARNING on a non-existing
domain, and returns an empty array, as demonstrated below:



---

afisc...@miraculix:~$ php -v

PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010
20:01:00)

Copyright (c) 1997-2009 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans



afisc...@miraculix:~$ php -r "error_reporting(E_ALL);
var_dump(dns_get_record('dalfkjdaslfj.net'));"

array(0) {

}

---



There is code in dns_win32.c to attempt to catch some cases of
non-existing domains, but it does not seem to be complete.



Changing

---

if (status) {

if (status == DNS_INFO_NO_RECORDS) {

continue;

---

to 

---

if (status) {

if (status == DNS_INFO_NO_RECORDS || status ==
DNS_ERROR_RCODE_NAME_ERROR) {

continue;



---

Seems to fix the problems for me.  For reference, all error codes which
can be returned by DNSQuery_A are listed by Microsoft:
http://msdn.microsoft.com/en-us/library/ms681391



* I cannot say for sure if reports like
http://bugs.php.net/bug.php?id=50903 are valid.  I do know from reading
the PHP source that there are three separate *NIX implementations of
php_dns_search(), but Andreas has not investigated which one his Ubuntu
server is using.  It seems likely that this inconsistency affects NIX
implementations as well.

Test script:
---


Expected result:

array(0) {

}

Actual result:
--
bool(false)






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


Bug #52302 [Opn->Asn]: mysqli_fetch_all does not work with MYSQLI_USE_RESULT

2010-07-10 Thread felipe
Edit report at http://bugs.php.net/bug.php?id=52302&edit=1

 ID:   52302
 Updated by:   fel...@php.net
 Reported by:  brianlm...@php.net
 Summary:  mysqli_fetch_all does not work with MYSQLI_USE_RESULT
-Status:   Open
+Status:   Assigned
 Type: Bug
 Package:  MySQLi related
 Operating System: Linux
 PHP Version:  5.3.2
-Assigned To:  
+Assigned To:  mysql



Previous Comments:

[2010-07-10 10:39:32] brianlm...@php.net

Description:

When using MYSQLI_USE_RESULT as the second parameter to mysqli_query,
fetch_all returns null.

Test script:
---
query($sql, MYSQLI_USE_RESULT);



$rows = $res->fetch_all();



var_dump($rows);



?>

Expected result:

An array of the table data.

Actual result:
--
NULL






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


Bug #52290 [Opn->Asn]: setDate, setISODate, setTime works wrong when DateTime created from timestamp

2010-07-10 Thread felipe
Edit report at http://bugs.php.net/bug.php?id=52290&edit=1

 ID:   52290
 Updated by:   fel...@php.net
 Reported by:  danikas2k2 at gmail dot com
 Summary:  setDate, setISODate, setTime works wrong when DateTime
   created from timestamp
-Status:   Open
+Status:   Assigned
 Type: Bug
 Package:  Date/time related
 Operating System: WinXP x86
 PHP Version:  5.3.2
-Assigned To:  
+Assigned To:  derick



Previous Comments:

[2010-07-08 15:29:29] danikas2k2 at gmail dot com

Description:

setDate, setISODate, setTime works wrong

Test script:
---
$tz = 'UTC';

date_default_timezone_set($tz);



$ts = strtotime('2006-01-01');

$dt = new DateTime('@'.$ts);

$dt->setTimezone(new DateTimeZone($tz));



echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



$dt->setISODate(2005, 52, 1);

echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



$dt->setDate(2007, 10, 10);

echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



$dt->setTime(20, 30, 40);

echo $dt->format('o-\WW-N | Y-m-d | H:i:s | U'), "\n";



Expected result:

2005-W52-7 | 2006-01-01 | 00:00:00

2005-W52-1 | 2005-12-26 | 00:00:00

2007-W40-5 | 2007-10-10 | 00:00:00

2007-W40-5 | 2007-10-10 | 20:30:40



Actual result:
--
2005-W52-7 | 2006-01-01 | 00:00:00 | 1136073600

2041-W52-4 | 2041-12-26 | 00:00:00 | 2271628800

2044-W40-1 | 2044-10-03 | 00:00:00 | 2359065600

2081-W39-6 | 2081-09-27 | 20:30:40 | 3526230640








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


[PHP-BUG] Bug #52303 [NEW]: Intermittent segfault on call to pg_connect

2010-07-10 Thread reed dot underwood at gmail dot com
From: 
Operating system: Linux (Ubuntu 10.04)
PHP version:  5.3.2
Package:  PostgreSQL related
Bug Type: Bug
Bug description:Intermittent segfault on call to pg_connect

Description:

I didn't have time to get a core dump or investigate further, but calls to
pg_connect inside of Codeigniter caused a segfault.  Calls to pg_connect in
short test scripts functioned normally.  This is using the Ubuntu php5
package, which is a 5.3.2 build.  I built 5.2.13 and found that the problem
went away.


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



Bug #11835 [Com]: Include and Require does not work inner a class definition.

2010-07-10 Thread tbiegacz at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=11835&edit=1

 ID:   11835
 Comment by:   tbiegacz at gmail dot com
 Reported by:  developer at libero dot it
 Summary:  Include and Require does not work inner a class
   definition.
 Status:   Closed
 Type: Bug
 Package:  Scripting Engine problem
 Operating System: win nt 4
 PHP Version:  4.0.4pl1

 New Comment:

Did you try to define base class with common variables and functions?
For example



class Common {

  protected $strCommonVariable;

  protected function commonFunction() { ... }

}



class Specific extends Commmon {

 ...

}


Previous Comments:

[2002-06-05 11:55:34] lopez at sydel dot net

Indeed include or class must work inside a class so as to ease multiple
definitions of the same variables or functions.  As in my case, all my
classes have a save and a delete function which are identical.  include
or require will make it easier for me to maintain my code (as what it
should be)


[2001-07-02 09:27:12] developer at libero dot it

Well

"include is not allowed there" is not sufficient.



I have 200+ classes that have a common declaration of variables and
methods.

Everytime I need  to modify this declarations I have to modify this 200+
files.



If I could use require or include there I had only one file to modify.



- Original Message - 



> ID: 11835

> Old-Status: Open

> Status: Closed

> Bug Type: Scripting Engine problem

> 

> include is not allowed there, use the constructor instead

> class {

> function class () {

> include('2.php'); //same with require

> }

> }

> 

> 

> 

> Previous Comments:

>
---

> 

> [2001-07-02 09:14:57] develo...@libero.it

> 

> Require nor Include works inner a class file.

> 

> This is the file where I define the class:

> = 1.php =

>  class test {

>   include("2.php"); //the same with require

> }

> ?>

> =  end  =

> 

> And this is the file where I have content.

> = 2.php =

>  var $a=1;

> function method1 () {

>   $this->a++;

> }

> ?>

> =  end  =

> 

> This does not work.

> The error is:

> 

> Parse error:  parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION'
or `T_VAR' or `'}'' 

> 

> 

>
---

> 


[2001-07-02 09:19:33] j...@php.net

include is not allowed there, use the constructor instead

class {

function class ()   {

include('2.php'); //same with require

}

}






[2001-07-02 09:14:57] developer at libero dot it

Require nor Include works inner a class file.



This is the file where I define the class:

= 1.php =



=  end  =



And this is the file where I have content.

= 2.php =

a++;

}

?>

=  end  =



This does not work.

The error is:



Parse error:  parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
`T_VAR' or `'}'' 







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


Req #52293 [Com]: $_SERVER['PATH_INFO'] doesn't accept single quote in filename

2010-07-10 Thread jinmoku at hotmail dot com
Edit report at http://bugs.php.net/bug.php?id=52293&edit=1

 ID:   52293
 Comment by:   jinmoku at hotmail dot com
 Reported by:  brouard at ined dot fr
 Summary:   $_SERVER['PATH_INFO'] doesn't accept single quote in
   filename
 Status:   Open
 Type: Feature/Change Request
 Package:  PHP options/info functions
 Operating System: Linux
 PHP Version:  5.3.2

 New Comment:

use utf8_(de|en)code, it's the browser and/or the server who's write
this


Previous Comments:

[2010-07-08 20:41:27] brouard at ined dot fr

Description:

 $_SERVER['PATH_INFO'] doesn't return single quote in filename.

Although single quote in filenames were used frequently in French while
using mediawiki server. But in recent versions of mediawiki (svn) we can
upload images or pdf files having quotes in their name, like "Rapport
d'activité.pdf" but we can't retrieve any more because the
$_SERVER['PATH_INFO'] is returning a question mark instead of a quote
"/6/6e/Rapport_d?activité.pdf". It has been working for years and now
it says "Access denied, you must log in".



It doesn't affect all wiki servers but only servers where access to
files is granted via the img_auth.php (which means that only logged
users can access to uploaded images).



The orginal code of img_auth.php was:

  $path = $_SERVER['PATH_INFO'];

  $filename = realpath( $wgUploadDirectory . $_SERVER['PATH_INFO'] );

  wfDebugLog( 'img_auth', "\$path is {$path}" );



and the log output contains a question mark instead of the quote.



I decided to patch by replacing the question mark with a single quote:

 

 $path = preg_replace('/\?/','\'', $_SERVER['PATH_INFO']);



and it works but it is not very clean.



What is wrong with having single quote in the PATH_INFO as long as
filenames can have single quote?



Many thanks for any information.

 











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


Req #52268 [Com]: explode with an Array as Delimiter

2010-07-10 Thread jinmoku at hotmail dot com
Edit report at http://bugs.php.net/bug.php?id=52268&edit=1

 ID:   52268
 Comment by:   jinmoku at hotmail dot com
 Reported by:  halloanjedendenichkenne at gmail dot com
 Summary:  explode with an Array as Delimiter
 Status:   Open
 Type: Feature/Change Request
 Package:  Unknown/Other Function
 Operating System: Irrelevant
 PHP Version:  Irrelevant

 New Comment:

use preg_split instead ;)



var_dump(preg_split('/[, !\.]/', 'Hello, World! This is a Test!'));


Previous Comments:

[2010-07-06 20:28:38] halloanjedendenichkenne at gmail dot com

Description:

It would be useful if you were able to pass an Array as Delimiter to
explode.

The "Test Script" contains an Example.

Test script:
---


string(5) "Hello"

[1]=>

string(0) ""

[2]=>

string(5) "World"

[3]=>

string(0) ""

[4]=>

string(4) "This"

[5]=>

string(2) "is"

[6]=>

string(1) "a"

[7]=>

string(4) "Test"

  }



  */



?>

Expected result:

Included in the Test Script

Actual result:
--
Warning: explode() expects parameter 1 to be string, array given in php
shell code 

on line 1

NULL






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


Req #51144 [Com]: spl_autoload is broken

2010-07-10 Thread jinmoku at hotmail dot com
Edit report at http://bugs.php.net/bug.php?id=51144&edit=1

 ID:   51144
 Comment by:   jinmoku at hotmail dot com
 Reported by:  davi dot fol at gmail dot com
 Summary:  spl_autoload is broken
 Status:   Open
 Type: Feature/Change Request
 Package:  SPL related
 Operating System: Mac OSX 10.6
 PHP Version:  5.3.1

 New Comment:

see http://bugs.php.net/bug.php?id=51991


Previous Comments:

[2010-02-25 14:00:40] davi dot fol at gmail dot com

Description:

I am aware of spl_autoload_* issues that the development team do not 

consider bugs, namely the requirement for class files to have 

lowercase names in order for spl_autoload to function. (I would like 

to think that moving forwards, we could supply a constant to 

spl_register_autoload as a best compromise BC step to change this 

behaviour to support PascalCase class names).



Anyhow, I've disabled all extensions, I believe I've exhausted all 

configuration possibilities affecting spl_autoloads behaviour, and 

it still does not work. Defining my own handler, does. It seems that 

no matter how I define the include path, spl_autoload throws 

LogicExceptions as it cannot find classes. I am hoping that its not 

the case that as Mac OSX paths contain upper case folder names, 

that the auto lowercasing behaviour of spl_autoload is affecting 

absolute paths.



As a concrete case, this IS an include path that I use- it works with 

include_once et al, supplying or omitting the trailing slash:



"/Users/davidfoley/Documents/Aptana Studio 

Workspace/www.thorium.site/Private/Library/"



The above path is a perfectly valid file path- its somewhat different 

in the sense that 'www.thorium.site' is plonked in the middle- 

thats simply the name of a virtual hosts symlinked folder. I am only 

guessing that this could be a possible reason why spl_autoload is 

not working.

Reproduce code:
---
Assume a class file: 

location:

www/Private/library/target.php

contents:

namespace library

{

class target

{



}

}



Assume a bootloader script

location:

www/Public/boot.php

contents:

define('BREAK', '');

set_include_path('absolute/path/to/www/Private/library);

spl_autoload_extensions('.php');

spl_autoload_register();



$classFile= new SplFileObject('library/target.php', true);

echo 'The class file exists: ' . ($classFile->isFile() ? 'true' :
'false') . BREAK;



use library\target;



$instance= new target;

echo 'The class was loaded: ' . (isset($instance) ? 'true' : 'false') .
BREAK;

Expected result:

The following output:



The class file exists: true

The class was loaded: true

Actual result:
--
LogicException 'could not load class library\target'






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


Bug #50579 [Com]: RegexIterator::REPLACE doesn't work

2010-07-10 Thread jinmoku at hotmail dot com
Edit report at http://bugs.php.net/bug.php?id=50579&edit=1

 ID:   50579
 Comment by:   jinmoku at hotmail dot com
 Reported by:  team at fazend dot com
 Summary:  RegexIterator::REPLACE doesn't work
 Status:   Verified
 Type: Bug
 Package:  SPL related
 Operating System: *
 PHP Version:  5.*, 6

 New Comment:

In original doc (http://www.php.net/~helly/php/ext/spl/),
RegexIterator::REPLACE wait for "replacement" property, but it's doesn't
exist in __construct and properties.



In ext/spl replacement exist as public property but not in __construct
method, so I try to extends it like this



public function __construct($iterator, $regex, $mode = 0, $flags = 0,
$preg_flags = 0)

{   

parent::__construct($iterator, $regex, $mode, $flags, $preg_flags);

$this->replacement = '$1';  

}



but nothing append to :(


Previous Comments:

[2009-12-29 15:04:20] j...@php.net

Seems like this thing never got finished. There aren't any tests for it
either..


[2009-12-26 13:18:29] team at fazend dot com

Description:

RegexIterator::REPLACE doesn't work as it is supposed to do. The code 

example attached should return something, but it returns nothing.

Reproduce code:
---
$i = new RegexIterator(

  new ArrayIterator(array(

'test1'=>'test888', 

'test2'=>'what?', 

'test3'=>'test999')),

  '/^test(.*)/',

  RegexIterator::REPLACE);



foreach ($i as $name=>$value)

  echo $name . '=>' . $value . "\n";

Expected result:

888

999

Actual result:
--
nothing






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