Bug #52121 [Opn->Asn]: pcntl_signal() restart_syscalls doesn't behave as expected

2010-06-18 Thread felipe
Edit report at http://bugs.php.net/bug.php?id=52121&edit=1

 ID:   52121
 Updated by:   fel...@php.net
 Reported by:  nick dot telford at gmail dot com
 Summary:  pcntl_signal() restart_syscalls doesn't behave as
   expected
-Status:   Open
+Status:   Assigned
 Type: Bug
 Package:  PCNTL related
 Operating System: Ubuntu 10.04
 PHP Version:  5.3.2
-Assigned To:  
+Assigned To:  lbarnaud



Previous Comments:

[2010-06-18 18:01:22] nick dot telford at gmail dot com

Description:

The 3rd parameter of pcntl_signal() is "restart_syscalls". The docs
provide very 

little information about it, however reading here 

http://www.win.tue.nl/~aeb/linux/lk/lk-4.html#ss4.5 shows that it should
cause 

the following behaviour when a wait() call is made:

"The effect is that upon an interrupt the system call is aborted,
the user 

program's signal handler is called, and afterwards the system call is
restarted 

from the beginning."



The pcntl implementation of the restart_syscalls parameter appears to
restart 

the syscalls *without* calling the userland signal handler.



While I understand that this cannot be fixed (due to the "tick" based
signal 

handling in PHP), the "restart_syscalls" parameter should not default to
"true".



If the default parameter value is not changed, at the very least a big
red note 

should be made in the documentation warning of this inconsistency.

Expected result:

restart_syscalls parameter, when true, should cause wait() calls to get
restarted 

after calling the userland signal handler.

Actual result:
--
restart_syscalls parameter, when true, causes wait() calls to get
restarted 

*without* calling the userland signal handler.






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


Bug #36514 [Asn]: ob_gzhandler() issue

2010-06-18 Thread jani
Edit report at http://bugs.php.net/bug.php?id=36514&edit=1

 ID:   36514
 Updated by:   j...@php.net
 Reported by:  lunter at interia dot pl
 Summary:  ob_gzhandler() issue
 Status:   Assigned
 Type: Bug
 Package:  Output Control
 Operating System: winXP
 PHP Version:  5.1.2
-Assigned To:  jani
+Assigned To:  mike

 New Comment:

Assigned to someone who cares.


Previous Comments:

[2009-08-18 14:56:59] j...@php.net

Need to investigate if this is a) fixed in HEAD by the new output code
(or fix it if not) and b) if it's actually fixable somehow in 5.*
branches.


[2006-05-24 11:51:23] m...@php.net

Cannot be fixed with current Output Control code.


[2006-02-26 17:22:14] m...@php.net

Ok, seems to be as follows:



ob_clean() discards the gzip header bytes, but doesn't cause the gz
handler to restart.




[2006-02-25 23:04:59] m...@php.net

ob_clean() restarts the gz handler.


[2006-02-24 14:35:35] lunter at interia dot pl

PS. Please note that ob_clean() function does not destroy the output
buffer, but only clean (erase) the output buffer.

http://pl2.php.net/manual/en/function.ob-clean.php




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=36514


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


Bug #48153 [Com]: preg_replace() crashes in function "match"

2010-06-18 Thread bit2 at freemail dot hu
Edit report at http://bugs.php.net/bug.php?id=48153&edit=1

 ID:   48153
 Comment by:   bit2 at freemail dot hu
 Reported by:  raul dot gigea at directmedia dot de
 Summary:  preg_replace() crashes in function "match"
 Status:   Bogus
 Type: Bug
 Package:  PCRE related
 Operating System: FreeBSD 7.1-RELEASE-p4
 PHP Version:  5.2CVS-2009-05-06 (snap)

 New Comment:

I experienced this bug with Debian 5.0.4 (2.6.26-2-686 #1 SMP i686), PHP
5.2.6-1+lenny8, PCRE 7.6 2008-01-28, using mod_fcgid
(libapache2-mod-fcgid 2.2-1) and the default stacksize of 8k.



The sample code of Raul segfaults for me only with an input of ~3300
characters. I've simplified the code a bit further. The following causes
a segfault for me every time I run it:



$contents = str_repeat('a', 3396);

$contents = preg_replace('/(.)*/', '', $contents);



Playing with stack size or pcre limits (recursion and/or backtrack)
works around the problem, just as Raul described.



I could live with this "limitation" (or bug ... whatever) if PHP didn't
just segfault, but threw an error describing what happened. Getting a
segfault doesn't help too much and I've spent a few hours til I got to
the root of the problem. :-(



PS: if I understand it right, the segfault happens because the 8K stack
gets full. And this is probably because PCRE stores every match of a
parenthesized sub-pattern in a new string. In our example every
character of the input string is a match for that parenthesized pattern
... thus for every character a new string is created in the stack (each
taking up 2 bytes). And the 8K limit is reached, because there were a
few other things in the stack already when the PCRE function started.


Previous Comments:

[2009-05-06 23:37:24] raul dot gigea at directmedia dot de

by the way, with more than 3 a's it segfaults with 5.3 too.



$contents = 'sud' . str_repeat('a', 3) . 'bccess';

$contents = preg_replace('/d(a)+b/', '', $contents);

echo $contents


[2009-05-06 23:23:36] raul dot gigea at directmedia dot de

Ok, tried it on osx. It doesn't crash with 1900 'a''s, but it crashes 

with 2900. 



Try this code on OSX with 5.2CVS, it crashes on my macbook. With latest


libmhash from macports as of today ( 0.9.9.9_0 ) :



$contents = 'sud' . str_repeat('a', 2900) . 'bccess';

$contents = preg_replace('/d(a)+b/', '', $contents);

echo $contents;


[2009-05-06 22:54:53] raul dot gigea at directmedia dot de

Just tried it: with the 5.3 snapshot it works.



Compiling 5.2 on OSX right now


[2009-05-06 22:30:22] scott...@php.net

The mhash library is gone in 5.3 and replaced with a wrapper around the
hash library.



Can you try a 5.3 snapshot and see if you get the issue?



I should say I can't reproduce this on 5.2 on OSX with the same
configure like Jani used.


[2009-05-06 22:18:19] raul dot gigea at directmedia dot de

By the way, the mhash lib version is 0.9.9.




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=48153


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


Bug #51897 [Asn->Fbk]: LIBXML_NOWARNING does not suppress warnings when passed to xinclude().

2010-06-18 Thread rrichards
Edit report at http://bugs.php.net/bug.php?id=51897&edit=1

 ID:   51897
 Updated by:   rricha...@php.net
 Reported by:  rquadl...@php.net
 Summary:  LIBXML_NOWARNING does not suppress warnings when
   passed to xinclude().
-Status:   Assigned
+Status:   Feedback
 Type: Bug
 Package:  DOM XML related
 Operating System: Windows XP SP3
 PHP Version:  5.3.2
 Assigned To:  rrichards

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

please submit a test case that doesnt require phpdoc to be pulled


Previous Comments:

[2010-05-24 12:35:56] rquadl...@php.net

Description:

This issue is in relation to http://news.php.net/php.doc/969381854



Trying to standardise the documentation in relation to including class
synopsis, 

I'm including constructor and destructor synopsis via an xinclude with
an 

pointer and a xfallback...



http://docbook.org/ns/docbook) 

xpointer(id('class.datetime')/db:refentry/db:refsec...@role='description']/desce

ndant::db:destructorsynopsis[not(@role='procedural')])">

 





As there is no destructor for datetime, the fallback is used (which is
empty).



All would seem to be well.



The problem is that the xinclude processing generates a warning when
using the 

online documentation editor - but not when I run this locally via
phpdoc's 

configure.



I've been supplied a test script (http://news.php.net/php.doc/969381870)
which 

will generate the errors locally.



And so to the bug.



In the example the xinclude() call has no parameters.



Supplying LIBXML_NOWARNING does _NOT_ suppress the warnings.



To run the test script, you will need the doc-base/manual.xml file
produced by 

running the doc-base/configure.php script (part of PHPDoc).

Test script:
---
load('doc-base/manual.xml', LIBXML_NOENT);

var_dump($doc->xinclude(LIBXML_NOWARNING));

var_dump($doc->validate());

?>

Expected result:

int(-1)

bool(true)

Actual result:
--
Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.datetime')/db:refentry/db:refsec...@role='description']/desce

ndant::db:destructorsynopsis[not(@role='procedural')]) in - on line 4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.datetimezone')/db:refentry/db:refsec...@role='description']/d

escendant::db:destructorsynopsis[not(@role='procedural')]) in - on line
4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.dateinterval')/db:refentry/db:refsec...@role='description']/d

escendant::db:destructorsynopsis[not(@role='procedural')]) in - on line
4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.dateperiod')/db:refentry/db:refsec...@role='description']/des

cendant::db:destructorsynopsis[not(@role='procedural')]) in - on line 4



Warning: DOMDocument::xinclude(): XPointer evaluation failed: 

#xmlns(db=http://docbook.org/ns/docbook) 

xpointer(id('class.dateperiod')/db:refentry/db:refsec...@role='description']/des

cendant::db:methodsynopsis[not(@role='procedural')]) in - on line 4

int(-1)

bool(true)






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


Bug #52115 [Opn->Csd]: mysqli_result::fetch_all returns null, not an empty array

2010-06-18 Thread andrey
Edit report at http://bugs.php.net/bug.php?id=52115&edit=1

 ID:   52115
 Updated by:   and...@php.net
 Reported by:  uramihsayibok at gmail dot com
 Summary:  mysqli_result::fetch_all returns null, not an empty
   array
-Status:   Open
+Status:   Closed
 Type: Bug
 Package:  MySQLi related
 Operating System: Win 7
 PHP Version:  5.3.2
-Assigned To:  
+Assigned To:  mysql

 New Comment:

Fix will appear in 5.3.3


Previous Comments:

[2010-06-18 19:25:43] and...@php.net

Automatic comment from SVN on behalf of andrey
Revision: http://svn.php.net/viewvc/?view=revision&revision=300581
Log: Fix for bug #52115 mysqli_result::fetch_all returns null, not an
empty array


[2010-06-17 23:25:54] uramihsayibok at gmail dot com

Description:

The documentation says that mysqli_result::fetch_all

- "fetches all result rows and returns the result set as an associative
array, a numeric array, or both"

- "Returns an array of associative or numeric arrays holding result
rows"

(though the return type is "mixed").



As far as I can tell, fetch_all returns NULL when there are no rows (ie,
->num_rows==0).





Filed as a bug and not a documentation problem because it'd be nice to
always get an array back.

Test script:
---
// Requires that mysqlnd be loaded, of course



// $mysqli = new mysqli(...)

$result = $mysqli->query("SELECT 1 LIMIT 0");

var_dump($result->fetch_all());

Expected result:

array(0) {

}

Actual result:
--
NULL






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


Bug #51785 [Bgs]: No way to escape quotes for XPath

2010-06-18 Thread pecoes at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=51785&edit=1

 ID:   51785
 User updated by:  pecoes at gmail dot com
 Reported by:  pecoes at gmail dot com
 Summary:  No way to escape quotes for XPath
 Status:   Bogus
 Type: Bug
 Package:  *XML functions
 Operating System: WinXP
 PHP Version:  5.3.2
 Assigned To:  rrichards

 New Comment:

Nice! Your work-around is certainly better than mine. :)



It's still a work-around, though. :(



XPath variables would certainly be useful.



My suggestion would have been to take unilateral action and improve the
XPath standard by intoducing escape-sequences: \' \" and \\

I realize that amending a standard isn't exactly elegant, but it
certainly would make things easy on the PHP-side of things. Simply treat
your input with addslashes and you're good. From a user-perspective that
would be the most desirable solution, I suppose.


Previous Comments:

[2010-06-18 18:08:45] rricha...@php.net

simplest way is to use php functions for comparison, like compare 

htmlspecialchars escaped strings:



$dom = new DOMDocument;

$domstr = "double quote: \", single quote: '";

$dom->loadXML($domstr);

$xpath = new DOMXPath($dom);



$xpath->registerNamespace("php", "http://php.net/xpath";);

$xpath->registerPHPFunctions();



$check_string = htmlspecialchars("double quote: \", single quote: '",
ENT_QUOTES

);



$q = "/test[php:functionString('htmlspecialchars', ., 3) =
'$check_string']";



echo $q."\n";

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}



There is no current plan to support XPath 2.0 although possibility of
supporting 

xpath variables in a future PHP version


[2010-06-18 17:05:34] pecoes at gmail dot com

We seem to misunderstand each other...



As long as there's only one type of quote - single or double - there's
no problem, but how do I escape a string with mixed quotes? How do I
quote that, so that the XPath-engine won't reject it?


[2010-06-18 16:50:06] rricha...@php.net

Jeez. Learn to properly escape strings then. I even gave you the proper
code for 

your test to work. Its not a PHP bug nor a libxml2 bug so it's bogus.
Regardless 

of the language you use you will hit escaping issues. If you really
think its a 

bug somewhere you need to take it to the W3C.


[2010-06-18 16:33:42] pecoes at gmail dot com

Alright. It's not a PHP bug. So... what now? How do I deal with it in
PHP? Just because PHP is innocent, doesn't mean there's no need for a
fix. It's still a bug! Classifying it as "bogus" won't do a thing.


[2010-06-18 16:22:05] rricha...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to take into account PHP string escaping too.

$q = "/test[text()='\"']";

For more complex situations with mixed quote types, its a general
overall issue 

with XPath not a PHP bug.




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=51785


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


Bug #51785 [Bgs]: No way to escape quotes for XPath

2010-06-18 Thread rrichards
Edit report at http://bugs.php.net/bug.php?id=51785&edit=1

 ID:   51785
 Updated by:   rricha...@php.net
 Reported by:  pecoes at gmail dot com
 Summary:  No way to escape quotes for XPath
 Status:   Bogus
 Type: Bug
 Package:  *XML functions
 Operating System: WinXP
 PHP Version:  5.3.2
 Assigned To:  rrichards

 New Comment:

simplest way is to use php functions for comparison, like compare 

htmlspecialchars escaped strings:



$dom = new DOMDocument;

$domstr = "double quote: \", single quote: '";

$dom->loadXML($domstr);

$xpath = new DOMXPath($dom);



$xpath->registerNamespace("php", "http://php.net/xpath";);

$xpath->registerPHPFunctions();



$check_string = htmlspecialchars("double quote: \", single quote: '",
ENT_QUOTES

);



$q = "/test[php:functionString('htmlspecialchars', ., 3) =
'$check_string']";



echo $q."\n";

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}



There is no current plan to support XPath 2.0 although possibility of
supporting 

xpath variables in a future PHP version


Previous Comments:

[2010-06-18 17:05:34] pecoes at gmail dot com

We seem to misunderstand each other...



As long as there's only one type of quote - single or double - there's
no problem, but how do I escape a string with mixed quotes? How do I
quote that, so that the XPath-engine won't reject it?


[2010-06-18 16:50:06] rricha...@php.net

Jeez. Learn to properly escape strings then. I even gave you the proper
code for 

your test to work. Its not a PHP bug nor a libxml2 bug so it's bogus.
Regardless 

of the language you use you will hit escaping issues. If you really
think its a 

bug somewhere you need to take it to the W3C.


[2010-06-18 16:33:42] pecoes at gmail dot com

Alright. It's not a PHP bug. So... what now? How do I deal with it in
PHP? Just because PHP is innocent, doesn't mean there's no need for a
fix. It's still a bug! Classifying it as "bogus" won't do a thing.


[2010-06-18 16:22:05] rricha...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to take into account PHP string escaping too.

$q = "/test[text()='\"']";

For more complex situations with mixed quote types, its a general
overall issue 

with XPath not a PHP bug.


[2010-05-10 18:43:43] pecoes at gmail dot com

Description:

There seems to be no way to escape single or double quotes for
XPath-Queries.



given: "



/test[text()="\""] produces an error message

/test[text()="\\""] dito

/test[text()="""] finds no match



This is not a PHP-Bug, I suppose. It may be a bug in the libxml2. It
might even be a bug in the XPath Spec itself. But regardless of where
the blame lies: This is serious! How is one supposed to use user-input
in an XPath, if it cannot be escaped?



I found a work-around, but it's fugly:



$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



function xquote ($str)

{

if (strpos($str, '"') === FALSE) {

return '"'.$str.'"';

}

if (strpos($str, "'") === FALSE) {

return "'".$str."'";

}

$parts = preg_split('/(")/', $str, 0,
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);

array_walk($parts,

function (&$val) {

if ($val == '"') $val = "'\"'";

else $val = '"'.$val.'"';

}

);

return 'concat('.implode(',', $parts).')';

}



$q = sprintf('/test[text()=%s]', xquote('"'));

if ($xpath->evaluate($q)->item(0)) {

echo 'found'; // works!

} else {

echo 'not found';

}

Test script:
---
$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



$q = '/test[text()="""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}



$q = '/test[text()="\\""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}

Expected result:

found

found

Actual result:
--
not found

Warning: DOMXPath::evaluate(): Invalid predicate...

Warning: DOMXPath::evaluate(): Invalid expression...

Fatal error: Call to a member function item() on non-object...






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


[PHP-BUG] Bug #52121 [NEW]: pcntl_signal() restart_syscalls doesn't behave as expected

2010-06-18 Thread nick dot telford at gmail dot com
From: 
Operating system: Ubuntu 10.04
PHP version:  5.3.2
Package:  PCNTL related
Bug Type: Bug
Bug description:pcntl_signal() restart_syscalls doesn't behave as expected

Description:

The 3rd parameter of pcntl_signal() is "restart_syscalls". The docs provide
very 

little information about it, however reading here 

http://www.win.tue.nl/~aeb/linux/lk/lk-4.html#ss4.5 shows that it should
cause 

the following behaviour when a wait() call is made:

"The effect is that upon an interrupt the system call is aborted, the
user 

program's signal handler is called, and afterwards the system call is
restarted 

from the beginning."



The pcntl implementation of the restart_syscalls parameter appears to
restart 

the syscalls *without* calling the userland signal handler.



While I understand that this cannot be fixed (due to the "tick" based
signal 

handling in PHP), the "restart_syscalls" parameter should not default to
"true".



If the default parameter value is not changed, at the very least a big red
note 

should be made in the documentation warning of this inconsistency.

Expected result:

restart_syscalls parameter, when true, should cause wait() calls to get
restarted 

after calling the userland signal handler.

Actual result:
--
restart_syscalls parameter, when true, causes wait() calls to get restarted


*without* calling the userland signal handler.

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



[PHP-BUG] Bug #52120 [NEW]: Unable to call inherited protected __construct

2010-06-18 Thread vr...@php.net
From: vrana
Operating system: *
PHP version:  5.3.2
Package:  Class/Object related
Bug Type: Bug
Bug description:Unable to call inherited protected __construct

Description:

Protected visibility allows accessing parent members and also members of
parent's children. If class A defines protected method f() and classes B
and C are children of A then B can call C::f(). This is true for all
methods except __construct().

Test script:
---
class A {

protected function __construct() {

}

}



class B extends A {

static function test() {

new C;

}

}



class C extends A {

protected function __construct() {

echo "OK\n";

}

}



B::test();



Expected result:

OK

Actual result:
--
Fatal error: Call to protected C::__construct() from context 'B' on line 9

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



Bug #51785 [Bgs]: No way to escape quotes for XPath

2010-06-18 Thread pecoes at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=51785&edit=1

 ID:   51785
 User updated by:  pecoes at gmail dot com
 Reported by:  pecoes at gmail dot com
 Summary:  No way to escape quotes for XPath
 Status:   Bogus
 Type: Bug
 Package:  *XML functions
 Operating System: WinXP
 PHP Version:  5.3.2
 Assigned To:  rrichards

 New Comment:

We seem to misunderstand each other...



As long as there's only one type of quote - single or double - there's
no problem, but how do I escape a string with mixed quotes? How do I
quote that, so that the XPath-engine won't reject it?


Previous Comments:

[2010-06-18 16:50:06] rricha...@php.net

Jeez. Learn to properly escape strings then. I even gave you the proper
code for 

your test to work. Its not a PHP bug nor a libxml2 bug so it's bogus.
Regardless 

of the language you use you will hit escaping issues. If you really
think its a 

bug somewhere you need to take it to the W3C.


[2010-06-18 16:33:42] pecoes at gmail dot com

Alright. It's not a PHP bug. So... what now? How do I deal with it in
PHP? Just because PHP is innocent, doesn't mean there's no need for a
fix. It's still a bug! Classifying it as "bogus" won't do a thing.


[2010-06-18 16:22:05] rricha...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to take into account PHP string escaping too.

$q = "/test[text()='\"']";

For more complex situations with mixed quote types, its a general
overall issue 

with XPath not a PHP bug.


[2010-05-10 18:43:43] pecoes at gmail dot com

Description:

There seems to be no way to escape single or double quotes for
XPath-Queries.



given: "



/test[text()="\""] produces an error message

/test[text()="\\""] dito

/test[text()="""] finds no match



This is not a PHP-Bug, I suppose. It may be a bug in the libxml2. It
might even be a bug in the XPath Spec itself. But regardless of where
the blame lies: This is serious! How is one supposed to use user-input
in an XPath, if it cannot be escaped?



I found a work-around, but it's fugly:



$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



function xquote ($str)

{

if (strpos($str, '"') === FALSE) {

return '"'.$str.'"';

}

if (strpos($str, "'") === FALSE) {

return "'".$str."'";

}

$parts = preg_split('/(")/', $str, 0,
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);

array_walk($parts,

function (&$val) {

if ($val == '"') $val = "'\"'";

else $val = '"'.$val.'"';

}

);

return 'concat('.implode(',', $parts).')';

}



$q = sprintf('/test[text()=%s]', xquote('"'));

if ($xpath->evaluate($q)->item(0)) {

echo 'found'; // works!

} else {

echo 'not found';

}

Test script:
---
$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



$q = '/test[text()="""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}



$q = '/test[text()="\\""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}

Expected result:

found

found

Actual result:
--
not found

Warning: DOMXPath::evaluate(): Invalid predicate...

Warning: DOMXPath::evaluate(): Invalid expression...

Fatal error: Call to a member function item() on non-object...






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


Bug #51785 [Bgs]: No way to escape quotes for XPath

2010-06-18 Thread rrichards
Edit report at http://bugs.php.net/bug.php?id=51785&edit=1

 ID:   51785
 Updated by:   rricha...@php.net
 Reported by:  pecoes at gmail dot com
 Summary:  No way to escape quotes for XPath
 Status:   Bogus
 Type: Bug
 Package:  *XML functions
 Operating System: WinXP
 PHP Version:  5.3.2
 Assigned To:  rrichards

 New Comment:

Jeez. Learn to properly escape strings then. I even gave you the proper
code for 

your test to work. Its not a PHP bug nor a libxml2 bug so it's bogus.
Regardless 

of the language you use you will hit escaping issues. If you really
think its a 

bug somewhere you need to take it to the W3C.


Previous Comments:

[2010-06-18 16:33:42] pecoes at gmail dot com

Alright. It's not a PHP bug. So... what now? How do I deal with it in
PHP? Just because PHP is innocent, doesn't mean there's no need for a
fix. It's still a bug! Classifying it as "bogus" won't do a thing.


[2010-06-18 16:22:05] rricha...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to take into account PHP string escaping too.

$q = "/test[text()='\"']";

For more complex situations with mixed quote types, its a general
overall issue 

with XPath not a PHP bug.


[2010-05-10 18:43:43] pecoes at gmail dot com

Description:

There seems to be no way to escape single or double quotes for
XPath-Queries.



given: "



/test[text()="\""] produces an error message

/test[text()="\\""] dito

/test[text()="""] finds no match



This is not a PHP-Bug, I suppose. It may be a bug in the libxml2. It
might even be a bug in the XPath Spec itself. But regardless of where
the blame lies: This is serious! How is one supposed to use user-input
in an XPath, if it cannot be escaped?



I found a work-around, but it's fugly:



$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



function xquote ($str)

{

if (strpos($str, '"') === FALSE) {

return '"'.$str.'"';

}

if (strpos($str, "'") === FALSE) {

return "'".$str."'";

}

$parts = preg_split('/(")/', $str, 0,
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);

array_walk($parts,

function (&$val) {

if ($val == '"') $val = "'\"'";

else $val = '"'.$val.'"';

}

);

return 'concat('.implode(',', $parts).')';

}



$q = sprintf('/test[text()=%s]', xquote('"'));

if ($xpath->evaluate($q)->item(0)) {

echo 'found'; // works!

} else {

echo 'not found';

}

Test script:
---
$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



$q = '/test[text()="""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}



$q = '/test[text()="\\""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}

Expected result:

found

found

Actual result:
--
not found

Warning: DOMXPath::evaluate(): Invalid predicate...

Warning: DOMXPath::evaluate(): Invalid expression...

Fatal error: Call to a member function item() on non-object...






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


Bug #51785 [Bgs]: No way to escape quotes for XPath

2010-06-18 Thread pecoes at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=51785&edit=1

 ID:   51785
 User updated by:  pecoes at gmail dot com
 Reported by:  pecoes at gmail dot com
 Summary:  No way to escape quotes for XPath
 Status:   Bogus
 Type: Bug
 Package:  *XML functions
 Operating System: WinXP
 PHP Version:  5.3.2
 Assigned To:  rrichards

 New Comment:

Alright. It's not a PHP bug. So... what now? How do I deal with it in
PHP? Just because PHP is innocent, doesn't mean there's no need for a
fix. It's still a bug! Classifying it as "bogus" won't do a thing.


Previous Comments:

[2010-06-18 16:22:05] rricha...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to take into account PHP string escaping too.

$q = "/test[text()='\"']";

For more complex situations with mixed quote types, its a general
overall issue 

with XPath not a PHP bug.


[2010-05-10 18:43:43] pecoes at gmail dot com

Description:

There seems to be no way to escape single or double quotes for
XPath-Queries.



given: "



/test[text()="\""] produces an error message

/test[text()="\\""] dito

/test[text()="""] finds no match



This is not a PHP-Bug, I suppose. It may be a bug in the libxml2. It
might even be a bug in the XPath Spec itself. But regardless of where
the blame lies: This is serious! How is one supposed to use user-input
in an XPath, if it cannot be escaped?



I found a work-around, but it's fugly:



$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



function xquote ($str)

{

if (strpos($str, '"') === FALSE) {

return '"'.$str.'"';

}

if (strpos($str, "'") === FALSE) {

return "'".$str."'";

}

$parts = preg_split('/(")/', $str, 0,
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);

array_walk($parts,

function (&$val) {

if ($val == '"') $val = "'\"'";

else $val = '"'.$val.'"';

}

);

return 'concat('.implode(',', $parts).')';

}



$q = sprintf('/test[text()=%s]', xquote('"'));

if ($xpath->evaluate($q)->item(0)) {

echo 'found'; // works!

} else {

echo 'not found';

}

Test script:
---
$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



$q = '/test[text()="""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}



$q = '/test[text()="\\""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}

Expected result:

found

found

Actual result:
--
not found

Warning: DOMXPath::evaluate(): Invalid predicate...

Warning: DOMXPath::evaluate(): Invalid expression...

Fatal error: Call to a member function item() on non-object...






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


Bug #51785 [Asn->Bgs]: No way to escape quotes for XPath

2010-06-18 Thread rrichards
Edit report at http://bugs.php.net/bug.php?id=51785&edit=1

 ID:   51785
 Updated by:   rricha...@php.net
 Reported by:  pecoes at gmail dot com
 Summary:  No way to escape quotes for XPath
-Status:   Assigned
+Status:   Bogus
 Type: Bug
 Package:  *XML functions
 Operating System: WinXP
 PHP Version:  5.3.2
 Assigned To:  rrichards

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to take into account PHP string escaping too.

$q = "/test[text()='\"']";

For more complex situations with mixed quote types, its a general
overall issue 

with XPath not a PHP bug.


Previous Comments:

[2010-05-10 18:43:43] pecoes at gmail dot com

Description:

There seems to be no way to escape single or double quotes for
XPath-Queries.



given: "



/test[text()="\""] produces an error message

/test[text()="\\""] dito

/test[text()="""] finds no match



This is not a PHP-Bug, I suppose. It may be a bug in the libxml2. It
might even be a bug in the XPath Spec itself. But regardless of where
the blame lies: This is serious! How is one supposed to use user-input
in an XPath, if it cannot be escaped?



I found a work-around, but it's fugly:



$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



function xquote ($str)

{

if (strpos($str, '"') === FALSE) {

return '"'.$str.'"';

}

if (strpos($str, "'") === FALSE) {

return "'".$str."'";

}

$parts = preg_split('/(")/', $str, 0,
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);

array_walk($parts,

function (&$val) {

if ($val == '"') $val = "'\"'";

else $val = '"'.$val.'"';

}

);

return 'concat('.implode(',', $parts).')';

}



$q = sprintf('/test[text()=%s]', xquote('"'));

if ($xpath->evaluate($q)->item(0)) {

echo 'found'; // works!

} else {

echo 'not found';

}

Test script:
---
$dom = new DOMDocument;

$dom->loadXML('"');

$xpath = new DOMXPath($dom);



$q = '/test[text()="""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}



$q = '/test[text()="\\""]';

if ($xpath->evaluate($q)->item(0)) {

echo "found\r\n";

} else {

echo "not found\r\n";

}

Expected result:

found

found

Actual result:
--
not found

Warning: DOMXPath::evaluate(): Invalid predicate...

Warning: DOMXPath::evaluate(): Invalid expression...

Fatal error: Call to a member function item() on non-object...






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


Bug #51630 [Opn->Csd]: Can't call userland functions from __sleep()

2010-06-18 Thread peter dot dishman at telephoneticsvip dot co dot uk
Edit report at http://bugs.php.net/bug.php?id=51630&edit=1

 ID:   51630
 User updated by:  peter dot dishman at telephoneticsvip dot co dot uk
 Reported by:  peter dot dishman at telephoneticsvip dot co dot uk
 Summary:  Can't call userland functions from __sleep()
-Status:   Open
+Status:   Closed
 Type: Bug
 Package:  Session related
 Operating System: Windows XP SP2
 PHP Version:  5.2.13

 New Comment:

I've tried this again, and it appears to be caused by apc. If I disable
apc, the 

problem goes away.

I'm not on the latest version of apc so am closing this bug.


Previous Comments:

[2010-05-01 15:31:39] peter dot dishman at telephoneticsvip dot co dot
uk

There don't seem to be any snapshots available at that windows url?


[2010-04-30 01:26:53] fel...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

I cannot reproduce it on 5.2.14-dev.


[2010-04-22 10:49:03] peter dot dishman at telephoneticsvip dot co dot
uk

Description:

Prior to v5.2.10 you could call userland functions in the magic method 

__sleep(). Now in 5.2.10, .11, .12 and .13 I just get a fatal error
undefined 

function when I try to do so.



I've tested this in 5.3.2 and it works correctly as it does in 5.2.9 and
before.



This is running on the standard 5.2.13 TS VS6 build and my session
configuration 

is: 

[Session]

session.save_handler = files

session.save_path = "c:/php/tmp"

session.use_cookies = 1

session.use_only_cookies = 1

session.name = sID

session.auto_start = 0

session.cookie_lifetime = 0

session.cookie_path = /

session.cookie_domain =

session.cookie_httponly = 

session.serialize_handler = php

session.gc_probability = 1

session.gc_divisor = 1000

session.gc_maxlifetime = 9000

session.bug_compat_42 = 0

session.bug_compat_warn = 1

session.referer_check =

session.entropy_length = 0

session.entropy_file =

session.cache_limiter = nocache

session.cache_expire = 180

session.use_trans_sid = 0

session.hash_function = 0

session.hash_bits_per_character = 5

url_rewriter.tags = 

"a=href,area=href,frame=src,input=src,form=,fieldset=,iframe=src"

Test script:
---
bar = 0;

}

function __sleep() {

$this->bar = inc($this->bar);

return array('bar');

}   

public $bar;

}



session_start();

if (!isset($_SESSION['foo'])) {

$_SESSION['foo'] = new foo();

}

$foo = $_SESSION['foo'];



echo "foo->bar = ".$foo->bar."";

?>

Expected result:

As you refresh the page given by the script, you should just see the
number 

increment each time with no errors generated.

Actual result:
--
In 5.2.13, after refreshing the page you get:

Fatal error: Call to undefined function inc() in C:\test\sleeptest.php
on line 12 



This worked correctly in 5.2.9 and before, and also works in 5.3.2






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


Bug #51430 [Opn]: Numeric string array key is being implicitly cast to 32bit int and overflowing

2010-06-18 Thread will at flourishlib dot com
Edit report at http://bugs.php.net/bug.php?id=51430&edit=1

 ID:   51430
 User updated by:  will at flourishlib dot com
 Reported by:  will at flourishlib dot com
 Summary:  Numeric string array key is being implicitly cast to
   32bit int and overflowing
 Status:   Open
 Type: Bug
 Package:  Scripting Engine problem
-Operating System: Fedora 12
+Operating System: Fedora 12 x86, OpenSuse 11 x86
-PHP Version:  5.3.2
+PHP Version:  5.3.3RC1

 New Comment:

I just built PHP 5.3.3RC1 on both my Fedora x86 and OpenSuse x86
machines and the bug is present in 

both.





The commands used for each:



# wget http://downloads.php.net/johannes/php-5.3.3RC1.tar.bz2

# tar xvfj php-5.3.3RC1.tar.bz2

# cd php-5.3.3RC1

# ./configure

# make

# cd sapi/cli/

# ./php -r 'print_r(array("-2147483649" => TRUE, "-2147483648" =>
FALSE));'

Array

(

[2147483647] => 1

[-2147483648] =>

)





The uname -a from each:



Linux vm-fedora 2.6.31.12-174.2.22.fc12.i686.PAE #1 SMP Fri Feb 19
19:10:04 UTC 2010 i686 i686 i386 

GNU/Linux



Linux vm-opensuse 2.6.31.12-0.1-desktop #1 SMP PREEMPT 2010-01-27
08:20:11 +0100 i686 i686 i386 

GNU/Linux





Since there was some speculation that this may be a compiler issue, here
is gcc -v for each:



Using built-in specs.

Target: i686-redhat-linux

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-

bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap
--enable-shared --enable-threads=posix --

enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --

enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --

disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-

multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-

libjava-multilib --with-ppl --with-cloog --with-tune=generic
--with-arch=i686 --build=i686-redhat-linux

Thread model: posix

gcc version 4.4.3 20100127 (Red Hat 4.4.3-4) (GCC)



Using built-in specs.

Target: i586-suse-linux

Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --

libdir=/usr/lib --libexecdir=/usr/lib
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-

checking=release --with-gxx-include-dir=/usr/include/c++/4.4
--enable-ssp --disable-libssp --with-

bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--disable-libgcj --disable-libmudflap --

with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-

libstdcxx-pch --enable-version-specific-runtime-libs
--program-suffix=-4.4 --enable-linux-futex --

without-system-libunwind --with-arch-32=i586 --with-tune=generic
--build=i586-suse-linux

Thread model: posix

gcc version 4.4.1 [gcc-4_4-branch revision 150839] (SUSE Linux)


Previous Comments:

[2010-06-12 18:51:09] paj...@php.net

@colder I don't think we ever supported 64bit numeric on 32bit
platforms.


[2010-06-11 15:52:36] will at flourishlib dot com

Here is the info from the original 32bit machine that also sees the bug
in 

5.3.3-dev:



# ./php -v

PHP 5.3.3-dev (cli) (built: Jun 11 2010 09:48:12)

Copyright (c) 1997-2010 The PHP Group

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



# ./php -r 'print_r(array("-2147483649" => TRUE, "-2147483648" =>
FALSE));'

Array

(

[2147483647] => 1

[-2147483648] =>

)



# uname -a

Linux vm-fedora 2.6.31.12-174.2.22.fc12.i686.PAE #1 SMP Fri Feb 19
19:10:04 UTC 

2010 i686 i686 i386 GNU/Linux



# gcc -v

Using built-in specs.

Target: i686-redhat-linux

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --

infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --

enable-bootstrap --enable-shared --enable-threads=posix --enable-

checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-

exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-

c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi
--enable-plugin --

with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile 

--enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --

disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic
--with-

arch=i686 --build=i686-redhat-linux

Thread model: posix

gcc version 4.4.3 20100127 (Red Hat 4.4.3-4) (GCC)


[2010-06-11 15:35:56] will at flourishlib dot com

Both 5.3.3-dev and trunk were built on the following machine:



# uname -a

Linux vm-opensuse 2.6.31.12-0.1-desktop #1 SMP PREEMPT 2010-01-27
08:20:11 +010

Bug #52118 [Com]: preg_replace gives bad output if matching group equals whole string

2010-06-18 Thread tomasz dot slominski at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=52118&edit=1

 ID:   52118
 Comment by:   tomasz dot slominski at gmail dot com
 Reported by:  tomasz dot slominski at gmail dot com
 Summary:  preg_replace gives bad output if matching group equals
   whole string
 Status:   Bogus
 Type: Bug
 Package:  *Regular Expressions
 Operating System: WIN XP SP3
 PHP Version:  Irrelevant

 New Comment:

ok, but shouldn't greedy .* consume the whole string? 



 var_dump(preg_replace("/(.*)/U", '$1!','test'));

 gives

 string '!t!!e!!s!!t!!' (length=13)



and that's ok, but why 



  var_dump(preg_replace("/(.*)/", '$1!','test'));



is producing 



 string 'test!!' (matching 'test' - nothing)



instead of 



 string '!test!!'  (matching nothing - 'test' - nothing)  or string
'test!'   

(matching 'test')



it's at least counter-intuitive


Previous Comments:

[2010-06-18 12:04:20] sala...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is expected behaviour. When a match is found, PCRE checks for the
next 

possible match starting at the point immediately after the previous
match.  In 

your case, the .* first matches the entire subject string "test", then
also 

matches again at very end of the string since the * quantifier allows
matching 

nothing.


[2010-06-18 11:40:13] tomasz dot slominski at gmail dot com

Fast hack:   var_dump(preg_replace(array("/(.+)(.*)/"),
array('!$1$2'),'test')); 

gives good output (!test)


[2010-06-18 11:25:37] tomasz dot slominski at gmail dot com

Description:

preg replace is going mad when matching group equals to (.*). It seems
that 

substitution is made 2 times instead of 1.

Test script:
---
var_dump(preg_replace(array("/(.*)/"), array('!$1'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('$1!'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('!$1!'),'test'));

Expected result:

string '!test' (length=5)

string 'test!' (length=5)

string '!test!' (length=6)



Actual result:
--
string '!test!' (length=6)

string 'test!!' (length=6)

string '!test!!!' (length=8)






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


Bug #52118 [Opn->Bgs]: preg_replace gives bad output if matching group equals whole string

2010-06-18 Thread salathe
Edit report at http://bugs.php.net/bug.php?id=52118&edit=1

 ID:   52118
 Updated by:   sala...@php.net
 Reported by:  tomasz dot slominski at gmail dot com
 Summary:  preg_replace gives bad output if matching group equals
   whole string
-Status:   Open
+Status:   Bogus
 Type: Bug
 Package:  *Regular Expressions
 Operating System: WIN XP SP3
 PHP Version:  Irrelevant

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This is expected behaviour. When a match is found, PCRE checks for the
next 

possible match starting at the point immediately after the previous
match.  In 

your case, the .* first matches the entire subject string "test", then
also 

matches again at very end of the string since the * quantifier allows
matching 

nothing.


Previous Comments:

[2010-06-18 11:40:13] tomasz dot slominski at gmail dot com

Fast hack:   var_dump(preg_replace(array("/(.+)(.*)/"),
array('!$1$2'),'test')); 

gives good output (!test)


[2010-06-18 11:25:37] tomasz dot slominski at gmail dot com

Description:

preg replace is going mad when matching group equals to (.*). It seems
that 

substitution is made 2 times instead of 1.

Test script:
---
var_dump(preg_replace(array("/(.*)/"), array('!$1'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('$1!'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('!$1!'),'test'));

Expected result:

string '!test' (length=5)

string 'test!' (length=5)

string '!test!' (length=6)



Actual result:
--
string '!test!' (length=6)

string 'test!!' (length=6)

string '!test!!!' (length=8)






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


Bug #52118 [Opn]: preg_replace gives bad output if matching group equals whole string

2010-06-18 Thread tomasz dot slominski at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=52118&edit=1

 ID:   52118
 User updated by:  tomasz dot slominski at gmail dot com
 Reported by:  tomasz dot slominski at gmail dot com
 Summary:  preg_replace gives bad output if matching group equals
   whole string
 Status:   Open
 Type: Bug
 Package:  *Regular Expressions
 Operating System: WIN XP SP3
 PHP Version:  Irrelevant

 New Comment:

Fast hack:   var_dump(preg_replace(array("/(.+)(.*)/"),
array('!$1$2'),'test')); 

gives good output (!test)


Previous Comments:

[2010-06-18 11:25:37] tomasz dot slominski at gmail dot com

Description:

preg replace is going mad when matching group equals to (.*). It seems
that 

substitution is made 2 times instead of 1.

Test script:
---
var_dump(preg_replace(array("/(.*)/"), array('!$1'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('$1!'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('!$1!'),'test'));

Expected result:

string '!test' (length=5)

string 'test!' (length=5)

string '!test!' (length=6)



Actual result:
--
string '!test!' (length=6)

string 'test!!' (length=6)

string '!test!!!' (length=8)






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


[PHP-BUG] Bug #52118 [NEW]: preg_replace gives bad output if matching group equals whole string

2010-06-18 Thread tomasz dot slominski at gmail dot com
From: 
Operating system: WIN XP SP3
PHP version:  Irrelevant
Package:  *Regular Expressions
Bug Type: Bug
Bug description:preg_replace gives bad output if matching group equals whole 
string

Description:

preg replace is going mad when matching group equals to (.*). It seems that


substitution is made 2 times instead of 1.

Test script:
---
var_dump(preg_replace(array("/(.*)/"), array('!$1'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('$1!'),'test'));

var_dump(preg_replace(array("/(.*)/"), array('!$1!'),'test'));

Expected result:

string '!test' (length=5)

string 'test!' (length=5)

string '!test!' (length=6)



Actual result:
--
string '!test!' (length=6)

string 'test!!' (length=6)

string '!test!!!' (length=8)

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



Req #43233 [Csd]: SASL options do not load - Missing SASL support in windows builds

2010-06-18 Thread pajoye
Edit report at http://bugs.php.net/bug.php?id=43233&edit=1

 ID:   43233
 Updated by:   paj...@php.net
 Reported by:  scott dot thomas at inin dot com
 Summary:  SASL options do not load - Missing SASL support in
   windows builds
 Status:   Closed
 Type: Feature/Change Request
 Package:  LDAP related
 Operating System: Windows 2003 Server
 PHP Version:  5.2.5
 Assigned To:  pajoye

 New Comment:

5.3.3RC1 VC9 builds have SASL support now.


Previous Comments:

[2010-05-17 22:22:24] paj...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=299435
Log: - #43233


[2010-05-17 22:09:51] paj...@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




[2010-05-17 22:09:44] paj...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=299434
Log: - #43233, sasl support for ldap on windows


[2010-05-12 12:42:18] paj...@php.net

I don't think it can be done easily and it seems that even if it was
supported, there are some issues with this auth method and AD (wrong
enconding).



I will try to take a look at that for trunk, but don't hold your breath,
that won't happen in 5.3.x for now.


[2010-05-12 11:11:38] bruno dot chalopin at laposte dot net

There is still no sasl support in ldap on Windows binaries (5.2.x or
5.3.x)

Why isn't it activate by default on Windows ? A lot of Active Directory
Ldap server require a strong authentication like 'DIGEST-MD5' which is
only provided by ldap_sasl_bind.




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=43233


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


Bug #48866 [Asn->Fbk]: ldap.conf TLS_REQCERT directive fails for ldaps

2010-06-18 Thread pajoye
Edit report at http://bugs.php.net/bug.php?id=48866&edit=1

 ID:   48866
 Updated by:   paj...@php.net
 Reported by:  dev at lechat dot org
 Summary:  ldap.conf TLS_REQCERT directive fails for ldaps
-Status:   Assigned
+Status:   Feedback
 Type: Bug
 Package:  LDAP related
 Operating System: win32 only - windows server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye

 New Comment:

Please try 5.3.3RC1


Previous Comments:

[2010-04-28 10:55:09] paj...@php.net

Yes, the bug is not in php itself but in the build of the ldap
libraries. It will be fixed in the next release (5.3.3) while being
available in the snapshots (I'm working on restoring them as well).



The trick is to put it in the root of the current drive, not very clean
but it can help to work around this problem.


[2010-04-28 10:52:57] dietrich dot m dot 3 at pg dot com

correction to my last comment: placing the ldap.conf into the root
folder of the drive where my Apache Installation is located did work.

Note: HTROOT is on another drive. It might be bound to Server_Root ??


[2010-04-28 10:45:25] dietrich dot m dot 3 at pg dot com

No comments since more than 2 months ?

I do still have this issue. Any workarounds that I missed ?

the ldap.conf is not accepted in C:\ nor at C:\OpenLDAP\sysconf.



Using ProcessMonitor, I was not able to find any attempt to access a
file named ldap.conf...


[2010-02-03 15:21:09] akatherder at hotmail dot com

This bug still exists in PHP 5.3.1 for Windows/IIS.



There are no Windows binaries snapshots at
http://windows.php.net/snapshots/



"5.3 has no release."


[2010-01-25 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".




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=48866


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