#48507 [Com]: fgetcsv() ignoring special characters

2009-12-12 Thread pahan at hubbitus dot spb dot su
 ID:   48507
 Comment by:   pahan at hubbitus dot spb dot su
 Reported By:  krynble at yahoo dot com dot br
 Status:   Verified
 Bug Type: Filesystem function related
 Operating System: Unix
 PHP Version:  5.*
 New Comment:

Sorry for duplicate (#50456 is my), but in it, additionally to there
described problem in fgetcsv I also suggest fix fputcvs to allow [force]
enclosing single words in field.

Off course it does *not* solve this problem of incorrect fgetcsv
parsing, because RFC allow not quoted values (
http://www.faqs.org/rfcs/rfc4180.html , section 2.5 ), but, it is make
pair fputcsv/fgetcsv as minimum compatible in PHP implementation.


Previous Comments:


[2009-12-12 01:33:51] j...@php.net

See also bug #50456



[2009-09-22 15:09:20] phofstetter at sensational dot ch

below you'll find a small script which shows how to implement a user
filter that can be used to on-the-fly utf8-encode the data so that
fgetcsv is happy and returns correct output even if the first character
in a field has its high-bit set and is not valid utf-8:

Remember: This is a workaround and impacts performance. This is not a
valid fix for the bug.

I didn't yet have time to deeply look into the C implementation for
fgetcsv, but all these calls to php_mblen() feel suspicious to me.

I'll try and have a look into this later today, but for now, I'm just
glad I have this workaround (quickly hacked together - keep that in
mind):

?php

class utf8encode_filter extends php_user_filter {
  function is_utf8($string){
  return preg_match('%(?:
  [\xC2-\xDF][\x80-\xBF]# non-overlong 2-byte
  |\xE0[\xA0-\xBF][\x80-\xBF]   # excluding
overlongs
  |[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
  |\xED[\x80-\x9F][\x80-\xBF]   # excluding
surrogates
  |\xF0[\x90-\xBF][\x80-\xBF]{2}# planes 1-3
  |[\xF1-\xF3][\x80-\xBF]{3}  # planes 4-15
  |\xF4[\x80-\x8F][\x80-\xBF]{2}# plane 16
  )+%xs', $string);
  }
  
  function filter($in, $out, $consumed, $closing)
  {
while ($bucket = stream_bucket_make_writeable($in)) {
  if (!$this-is_utf8($bucket-data))
  $bucket-data = utf8_encode($bucket-data);
  $consumed += $bucket-datalen;
  stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
  }
}

/* Register our filter with PHP */
stream_filter_register(utf8encode, utf8encode_filter)
or die(Failed to register filter);

$fp = fopen($_SERVER['argv'][1], r);

/* Attach the registered filter to the stream just opened */
stream_filter_prepend($fp, utf8encode);

while($data = fgetcsv($fp, 0, ';', ''))
print_r($data);

fclose($fp);



[2009-09-22 14:45:22] phofstetter at sensational dot ch

I was looking into this (after having been bitten by it) and I can add
another tidbit that might help tracking this down:

The bug doesn't happen if the file fgetcsv() is reading is in
UTF-8-format.

I have created a test-file in ISO-8859-1 and then used
file_put_contents(utf8encode(file_get_contents())) to create the
UTF8-version of it (explaining this here because I'm not sure whether
this would write a BOM or not - probably not though).

That version could be read correctly.

I'm now writing a stream filter that does the UTF-8 conversion on the
fly to hook that in between the file and fgetcsv() - while I would lose
a bit of performance, in my case, this is the cleanest workaround.



[2009-09-21 18:11:47] dmulryan at calendarwiz dot com

Note: Previous comment has error where URL is shown in array element. 
This is not a bug but my error in the example.  Bug is in special
characters.



[2009-09-21 18:07:42] dmulryan at calendarwiz dot com

Similar problem when parsing the following line:

0909211132,1,ØÊááàÑ,äÆæç,CForm,Y,1,1,1,97.95.176.240,2530

which produces empty array elements for fields with special
characters:

Array ( [0] = 0909211132 [1] = 1 [2] = [3] = [4] = URL [5] = Y
[6] = 1 [7] = 1 [8] = 1 [9] = 97.95.176.240 [10] = 2530 )



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/48507

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



#50457 [Opn-Bgs]: chaoui37

2009-12-12 Thread felipe
 ID:   50457
 Updated by:   fel...@php.net
 Reported By:  chaouie60 at hotmail dot fr
-Status:   Open
+Status:   Bogus
 Bug Type: *General Issues
 Operating System: vroom
 PHP Version:  5.3.1
 New Comment:

?


Previous Comments:


[2009-12-12 03:46:39] chaouie60 at hotmail dot fr

Description:

?

Reproduce code:
---
---
From manual page: function.mysql-connect#Description
---


Expected result:

?

Actual result:
--
?





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



#50458 [NEW]: PDO::FETCH_FUNC fails with Closures

2009-12-12 Thread m dot kurzyna at crystalpoint dot pl
From: m dot kurzyna at crystalpoint dot pl
Operating system: Linux
PHP version:  5.3.1
PHP Bug Type: PDO related
Bug description:  PDO::FETCH_FUNC fails with Closures

Description:

PDOStatement::fetchAll(PDO::FETCH_FUNC,function() {}) fails not being able
to recognize Closure as valid callback.

Reproduce code:
---
?php
 $db = new PDO('sqlite::memory:');
 $db-exec('CREATE TABLE `a` ( `id` INTEGER )');

 $st = $db-query('SELECT * FROM `a`');
 $st-fetchAll(PDO::FETCH_FUNC,function() {});
?


Expected result:

No error

Actual result:
--
Warning: PDOStatement::fetchAll() [pdostatement.fetchall]:
SQLSTATE[HY000]: General error: user-supplied function must be a valid
callback in ... on line 6

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



#50433 [Opn]: mysql extensions don't work

2009-12-12 Thread darkdominiongr at gmail dot com
 ID:   50433
 User updated by:  darkdominiongr at gmail dot com
 Reported By:  darkdominiongr at gmail dot com
 Status:   Open
 Bug Type: MySQL related
 Operating System: win32 only - Windows 7 x64
 PHP Version:  5.3.1
 New Comment:

Can someone verify this on a Windows server?


Previous Comments:


[2009-12-10 07:03:06] j...@php.net

Some windows issue, on *nix everything works just fine.



[2009-12-09 23:13:59] darkdominiongr at gmail dot com

?php

$host = **;
$username = **;
$password = **;

mysql_connect($host,$username,$password) or die(couldn't
establish connection:  . mysql_error());
echo Connected to MySQL;
?

When i try this code in php 5.3.0 i get the connected to mysql
message correctly. But when i try it on 5.3.1 i get the following
message.

couldn't establish connection: A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to
respond.



[2009-12-09 21:54:08] paj...@php.net

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 ?php and ends 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.





[2009-12-09 21:31:46] darkdominiongr at gmail dot com

Description:

The mysql extensions for PHP 5.3.1 don't work. I never had a problem
with PHP 5.3.0 but when i upgraded to 5.3.1. i couldn't use the mysql
functions. 






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



#50462 [NEW]: mysqli_more_results does not play well with mysqli_multi_query()

2009-12-12 Thread pcdinh at gmail dot com
From: pcdinh at gmail dot com
Operating system: Windows XP
PHP version:  5.3.1
PHP Bug Type: MySQLi related
Bug description:  mysqli_more_results does not play well with 
mysqli_multi_query()

Description:

mysqli_more_results() will always return false after 
mysqli_multi_query() for both SELECT and non SELECT queries

Therefore I can not use the loop while (mysqli_more_results()) in 
combination with mysqli_next_result() to iterate through result sets 
produced by SELECT queries

mysqli_multi_query($conn, $query);

while (mysqli_more_results($conn))
{
mysqli_next_result($query);

/* store first result set */
if ($result = mysqli_store_result($conn)) {
 
}
}

Code example in http://php.net/manual/en/mysqli.multi-query.php is 
outdated because it causes E_STRICT in PHP 5.3.1. It requires 
mysqli_more_results() to be called before mysqli_next_result()

There is a workaround

if (mysqli_multi_query($link, $query)) {
do {
/* store first result set */
if ($result = mysqli_store_result($link)) {
while ($row = mysqli_fetch_row($result)) {
printf(%s\n, $row[0]);
}
mysqli_free_result($result);
}

// print divider = will never work
if (mysqli_more_results($link)) {
printf(-\n);
}
} while (mysqli_more_results($link)  mysqli_next_result($link));
}

but mysqli_more_results() seems to do nothing related to result sets 
here


Reproduce code:
---
?php
$link = mysqli_connect(localhost, root, 123456, test);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

$query  = SELECT 1;

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
var_dump(mysqli_more_results($link));  
}

/* close connection */
mysqli_close($link);
?

Expected result:

bool(true)

Actual result:
--
bool(false)

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



#50462 [Com]: mysqli_more_results does not play well with mysqli_multi_query()

2009-12-12 Thread pcdinh at gmail dot com
 ID:   50462
 Comment by:   pcdinh at gmail dot com
 Reported By:  pcdinh at gmail dot com
 Status:   Open
 Bug Type: MySQLi related
 Operating System: Windows XP
 PHP Version:  5.3.1
 New Comment:

Hi,

I found that mysqli_more_results() return true when there is more than

1 query

?php
$link = mysqli_connect(localhost, root, 123456, test);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

$query  = SELECT 1;;
$query  .= SELECT 1;; // second query

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
var_dump(mysqli_more_results($link)); 
}

?

bool(true)

However, this behavior is totally confused


Previous Comments:


[2009-12-12 21:41:44] pcdinh at gmail dot com

Description:

mysqli_more_results() will always return false after 
mysqli_multi_query() for both SELECT and non SELECT queries

Therefore I can not use the loop while (mysqli_more_results()) in 
combination with mysqli_next_result() to iterate through result sets 
produced by SELECT queries

mysqli_multi_query($conn, $query);

while (mysqli_more_results($conn))
{
mysqli_next_result($query);

/* store first result set */
if ($result = mysqli_store_result($conn)) {
 
}
}

Code example in http://php.net/manual/en/mysqli.multi-query.php is 
outdated because it causes E_STRICT in PHP 5.3.1. It requires 
mysqli_more_results() to be called before mysqli_next_result()

There is a workaround

if (mysqli_multi_query($link, $query)) {
do {
/* store first result set */
if ($result = mysqli_store_result($link)) {
while ($row = mysqli_fetch_row($result)) {
printf(%s\n, $row[0]);
}
mysqli_free_result($result);
}

// print divider = will never work
if (mysqli_more_results($link)) {
printf(-\n);
}
} while (mysqli_more_results($link)  mysqli_next_result($link));
}

but mysqli_more_results() seems to do nothing related to result sets 
here


Reproduce code:
---
?php
$link = mysqli_connect(localhost, root, 123456, test);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

$query  = SELECT 1;

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
var_dump(mysqli_more_results($link));  
}

/* close connection */
mysqli_close($link);
?

Expected result:

bool(true)

Actual result:
--
bool(false)





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



#50460 [Opn-Fbk]: fpassthru() memory exausted

2009-12-12 Thread jani
 ID:   50460
 Updated by:   j...@php.net
 Reported By:  ced at mediatecatoscana dot it
-Status:   Open
+Status:   Feedback
 Bug Type: Streams related
 Operating System: Fedora 10 linux
 PHP Version:  5.2.11
 New Comment:

Please try using this snapshot:

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

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




Previous Comments:


[2009-12-12 16:26:33] ced at mediatecatoscana dot it

Description:

After updating to PHP 5.2.11 i get the error Allowed memory size of
268435456 bytes exhausted (tried to allocate 1729609729 bytes) in .
while trying to stream video files larger than memory_limit. Before
all worked fine.






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



#50462 [Opn-Fbk]: mysqli_more_results does not play well with mysqli_multi_query()

2009-12-12 Thread jani
 ID:   50462
 Updated by:   j...@php.net
 Reported By:  pcdinh at gmail dot com
-Status:   Open
+Status:   Feedback
 Bug Type: MySQLi related
 Operating System: Windows XP
 PHP Version:  5.3.1
 New Comment:

Exactly what is confusing here? Your first script does single query -
there are no more results than the one. So why would
mysqli_more_results() return true since there are no more results..?


Previous Comments:


[2009-12-12 21:54:29] pcdinh at gmail dot com

Hi,

I found that mysqli_more_results() return true when there is more than

1 query

?php
$link = mysqli_connect(localhost, root, 123456, test);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

$query  = SELECT 1;;
$query  .= SELECT 1;; // second query

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
var_dump(mysqli_more_results($link)); 
}

?

bool(true)

However, this behavior is totally confused



[2009-12-12 21:41:44] pcdinh at gmail dot com

Description:

mysqli_more_results() will always return false after 
mysqli_multi_query() for both SELECT and non SELECT queries

Therefore I can not use the loop while (mysqli_more_results()) in 
combination with mysqli_next_result() to iterate through result sets 
produced by SELECT queries

mysqli_multi_query($conn, $query);

while (mysqli_more_results($conn))
{
mysqli_next_result($query);

/* store first result set */
if ($result = mysqli_store_result($conn)) {
 
}
}

Code example in http://php.net/manual/en/mysqli.multi-query.php is 
outdated because it causes E_STRICT in PHP 5.3.1. It requires 
mysqli_more_results() to be called before mysqli_next_result()

There is a workaround

if (mysqli_multi_query($link, $query)) {
do {
/* store first result set */
if ($result = mysqli_store_result($link)) {
while ($row = mysqli_fetch_row($result)) {
printf(%s\n, $row[0]);
}
mysqli_free_result($result);
}

// print divider = will never work
if (mysqli_more_results($link)) {
printf(-\n);
}
} while (mysqli_more_results($link)  mysqli_next_result($link));
}

but mysqli_more_results() seems to do nothing related to result sets 
here


Reproduce code:
---
?php
$link = mysqli_connect(localhost, root, 123456, test);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

$query  = SELECT 1;

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
var_dump(mysqli_more_results($link));  
}

/* close connection */
mysqli_close($link);
?

Expected result:

bool(true)

Actual result:
--
bool(false)





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



#49813 [NoF-Fbk]: Segfault during shutdown in php_stream_context_del_link

2009-12-12 Thread felipe
 ID:   49813
 Updated by:   fel...@php.net
 Reported By:  dmitry dot revenko at businessmedia dot ru
-Status:   No Feedback
+Status:   Feedback
 Bug Type: SOAP related
 Operating System: Linux Fedora Core 6  2.6.22
 PHP Version:  5.2SVN-2009-10-08 (snap)
 New Comment:

Please try using this snapshot:

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

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




Previous Comments:


[2009-11-24 01:00:01] 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.



[2009-11-16 21:46:19] fel...@php.net

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 ?php and ends 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.





[2009-10-08 13:40:01] dmitry dot revenko at businessmedia dot ru

Description:

This error occures both in CLI and Apache PHP module. If I use
SoapClient with client certificate I get segmentation fault. Soap
call(s) and all the script logic behaves as expected, but during PHP
shutdown there's segmentation fault occured.
I reproduced this on two workstations with the same Fedora Core 6 and
tried PHP versions 5.2.6 - 5.2.11 and 5.2.current.

Reproduce code:
---
?php
// Program requires client certificate (I can send the one)
try
{
$soap = new SoapClient('https://host/soap/?wsdl', array(
'exceptions' = 1,
'wsdl_cache' = WSDL_CACHE_NONE,
'local_cert' = dirname(__FILE__) . '/client-cert.pem',
'passphrase' = 'piglet'
));

$res = $soap-userLogin(array('login' = 'bugonek', 'password' =
md5('000'), 'save_session' = false));
if ($res !== false  $res-errorCode == 0)
echo SID: {$res-sid}\n;
else
echo Login error: {$res-errorMessage}\n;
}
catch (Exception $e)
{
echo 'Exception [' . $e-getCode() . '] ' . $e-getMessage() . \n;
}
?

Expected result:

SID: 3092b3e454a6f4c9bb8ccab01adce34c (this value is generated at
runtime and not exactly should be the one)

Actual result:
--
SID: 3092b3e454a6f4c9bb8ccab01adce34c
Segmentation fault (core dumped)

gdb backtrace
-
Core was generated by `/usr/local/bin/php index-simple.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x08412c9d in php_stream_context_del_link (context=0x88a06bc,
stream=0x88a1078) at
/usr/src/Software/php5.2-200910081030/main/streams/streams.c:2044
2044   
for(zend_hash_internal_pointer_reset(Z_ARRVAL_P(context-links));





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



#50463 [NEW]: PREG_SPLIT eating character

2009-12-12 Thread bellingan at email dot it
From: bellingan at email dot it
Operating system: Suse Linux 11.2
PHP version:  5.3.1
PHP Bug Type: PCRE related
Bug description:  PREG_SPLIT eating character

Description:

PREG_SPLIT whit the PREG_SPLIT_DELIM_CAPTURE flag, return the matched
string dropping the first charcater.
Like in http://bugs.php.net/bug.php?id=15413edit=2

Reproduce code:
---
$via=123Gatano_Rizzi;
$res=preg_split(/[a-z]../,$via,PREG_SPLIT_DELIM_CAPTURE);
var_dump($res);

Expected result:

array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(3) ata
  [2]=
  string(8) no_Rizzi
}


Actual result:
--
array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(8) no_Rizzi
}


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



#50463 [Opn]: PREG_SPLIT eating character

2009-12-12 Thread bellingan at email dot it
 ID:   50463
 User updated by:  bellingan at email dot it
 Reported By:  bellingan at email dot it
 Status:   Open
 Bug Type: PCRE related
 Operating System: Suse Linux 11.2
 PHP Version:  5.3.1
 New Comment:

Sorry it doesen't return at all the matched text...


Previous Comments:


[2009-12-12 22:21:25] bellingan at email dot it

Description:

PREG_SPLIT whit the PREG_SPLIT_DELIM_CAPTURE flag, return the matched
string dropping the first charcater.
Like in http://bugs.php.net/bug.php?id=15413edit=2

Reproduce code:
---
$via=123Gatano_Rizzi;
$res=preg_split(/[a-z]../,$via,PREG_SPLIT_DELIM_CAPTURE);
var_dump($res);

Expected result:

array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(3) ata
  [2]=
  string(8) no_Rizzi
}


Actual result:
--
array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(8) no_Rizzi
}






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



#50463 [Opn-Bgs]: PREG_SPLIT eating character

2009-12-12 Thread felipe
 ID:   50463
 Updated by:   fel...@php.net
 Reported By:  bellingan at email dot it
-Status:   Open
+Status:   Bogus
 Bug Type: PCRE related
 Operating System: Suse Linux 11.2
 PHP Version:  5.3.1
 New Comment:

The third param. is for the 'limit', not for flags.
See the examples in the documentation.


Previous Comments:


[2009-12-12 22:22:19] bellingan at email dot it

Sorry it doesen't return at all the matched text...



[2009-12-12 22:21:25] bellingan at email dot it

Description:

PREG_SPLIT whit the PREG_SPLIT_DELIM_CAPTURE flag, return the matched
string dropping the first charcater.
Like in http://bugs.php.net/bug.php?id=15413edit=2

Reproduce code:
---
$via=123Gatano_Rizzi;
$res=preg_split(/[a-z]../,$via,PREG_SPLIT_DELIM_CAPTURE);
var_dump($res);

Expected result:

array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(3) ata
  [2]=
  string(8) no_Rizzi
}


Actual result:
--
array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(8) no_Rizzi
}






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



#50463 [Bgs]: PREG_SPLIT eating character

2009-12-12 Thread bellingan at email dot it
 ID:   50463
 User updated by:  bellingan at email dot it
 Reported By:  bellingan at email dot it
 Status:   Bogus
 Bug Type: PCRE related
 Operating System: Suse Linux 11.2
 PHP Version:  5.3.1
 New Comment:

$res=preg_split(/[a-z]../,$via,-1,PREG_SPLIT_DELIM_CAPTURE);
Yes...

Now is even more oddy...
Giving
array(4) {
  [0]=
  string(4) 123G
  [1]=
  string(0) 
  [2]=
  string(1) R
  [3]=
  string(1) i
}

Now I'm using the 
preg_match(/[a-z]..+/,$via,$res,PREG_OFFSET_CAPTURE);
dump($m);
giving a 

Array
(
[0] = Array
(
[0] = ata
[1] = 4
)

)


Previous Comments:


[2009-12-12 22:31:28] fel...@php.net

The third param. is for the 'limit', not for flags.
See the examples in the documentation.



[2009-12-12 22:22:19] bellingan at email dot it

Sorry it doesen't return at all the matched text...



[2009-12-12 22:21:25] bellingan at email dot it

Description:

PREG_SPLIT whit the PREG_SPLIT_DELIM_CAPTURE flag, return the matched
string dropping the first charcater.
Like in http://bugs.php.net/bug.php?id=15413edit=2

Reproduce code:
---
$via=123Gatano_Rizzi;
$res=preg_split(/[a-z]../,$via,PREG_SPLIT_DELIM_CAPTURE);
var_dump($res);

Expected result:

array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(3) ata
  [2]=
  string(8) no_Rizzi
}


Actual result:
--
array(2) {
  [0]=
  string(4) 123G
  [1]=
  string(8) no_Rizzi
}






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



#50464 [NEW]: declare encoding doesn't work with

2009-12-12 Thread marco dot weber at uni-trier dot de
From: marco dot weber at uni-trier dot de
Operating system: ANY
PHP version:  5.3.1
PHP Bug Type: *General Issues
Bug description:  declare encoding doesn't work with 

Description:

When using the the declare encoding statement in your php script, you will
get an fatal error, when you try to include a subscript with a defined
encoding.

This only happens with php5.3.x version that was compiled with
'--enable-zend-multibyte'

When i'm using a php5.3.x version WITHOUT '--enable-zend-multibyte', there
is no fatal error. And everything works as expected.

Reproduce code:
---
i used a php5.3.1 with '--enable-zend-multibyte'

just try to call the index.php binary

index.php file:
?php
declare(encoding='UTF-8');

namespace marcotest;

require_once('sub.inc.php');

?


sub.inc.php file:
?php
declare(encoding='UTF-8');

namespace marcotest;

echo TEST;
//phpinfo();

?


Expected result:

NO FATAL ERROR...
( Same result as WITHOUT '--enable-zend-multibyte' )

Actual result:
--
Fatal error: Encoding declaration pragma must be the very first statement
in the script in /home/mweber/public_html/sub.inc.php on line 2

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



#50464 [Com]: declare encoding doesn't work with

2009-12-12 Thread marco dot weber at uni-trier dot de
 ID:   50464
 Comment by:   marco dot weber at uni-trier dot de
 Reported By:  marco dot weber at uni-trier dot de
 Status:   Open
 Bug Type: *General Issues
 Operating System: ANY
 PHP Version:  5.3.1
 New Comment:

http://lists.typo3.org/pipermail/flow3-general/2009-December/42.html


Previous Comments:


[2009-12-13 00:31:11] marco dot weber at uni-trier dot de

Description:

When using the the declare encoding statement in your php script, you
will get an fatal error, when you try to include a subscript with a
defined encoding.

This only happens with php5.3.x version that was compiled with
'--enable-zend-multibyte'

When i'm using a php5.3.x version WITHOUT '--enable-zend-multibyte',
there is no fatal error. And everything works as expected.

Reproduce code:
---
i used a php5.3.1 with '--enable-zend-multibyte'

just try to call the index.php binary

index.php file:
?php
declare(encoding='UTF-8');

namespace marcotest;

require_once('sub.inc.php');

?


sub.inc.php file:
?php
declare(encoding='UTF-8');

namespace marcotest;

echo TEST;
//phpinfo();

?


Expected result:

NO FATAL ERROR...
( Same result as WITHOUT '--enable-zend-multibyte' )

Actual result:
--
Fatal error: Encoding declaration pragma must be the very first
statement in the script in /home/mweber/public_html/sub.inc.php on line
2





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



#50432 [Opn]: setting for display_errors not being honored

2009-12-12 Thread bill dot mcclendon at digiconllc dot com
 ID:   50432
 User updated by:  bill dot mcclendon at digiconllc dot com
 Reported By:  bill dot mcclendon at digiconllc dot com
 Status:   Open
 Bug Type: PHP options/info functions
 Operating System: win32 only - Windows Server 2008
 PHP Version:  5.3.1
 New Comment:

It may be a Windows installation issue - but the installation was via
the install version from the windows.php.net download link.  So, it's
built into it.


Previous Comments:


[2009-12-11 22:35:36] j...@php.net

Quite likely some installation issue on windows, works fine on *nix.



[2009-12-11 20:42:18] bill dot mcclendon at digiconllc dot com

Am I sure?  You did see the reference to phpinfo() - right?

It shows the one and only php.ini file that exists on this server and
instance and it's the one I edited.

Bill



[2009-12-09 20:28:42] paj...@php.net

Are you sure the right php.ini is loaded?



[2009-12-09 20:11:04] bill dot mcclendon at digiconllc dot com

Description:

When using 5.3.1 for Windows (VC6 non thread safe) build, the php.ini
settings for display_errors=Off is ignored and E_NOTICE messages
display in the web page results from PHP.

This can also be seen via phpinfo() which shows the setting On.

If I run php -i  from the command window, the setting correctly shows
Off.

Windows Server 2008
IIS 7.0
PHP 5.3.1 (binary .msi install from windows.php.net)

Reproduce code:
---
? phpinfo();?

Expected result:

display_errors Off

Actual result:
--
display_errors On





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



#50460 [NEW]: fpassthru() memory exausted

2009-12-12 Thread ced at mediatecatoscana dot it
From: ced at mediatecatoscana dot it
Operating system: Fedora 10 linux
PHP version:  5.2.11
PHP Bug Type: Streams related
Bug description:  fpassthru() memory exausted

Description:

After updating to PHP 5.2.11 i get the error Allowed memory size of
268435456 bytes exhausted (tried to allocate 1729609729 bytes) in .
while trying to stream video files larger than memory_limit. Before all
worked fine.


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



#50459 [NEW]: CURLINFO_HEADER_OUT does not work

2009-12-12 Thread tony at marston-home dot demon dot co dot uk
From: tony at marston-home dot demon dot co dot uk
Operating system: Windows XP
PHP version:  5.3.1
PHP Bug Type: cURL related
Bug description:  CURLINFO_HEADER_OUT does not work

Description:

The following line always returns FALSE:

$info = curl_getinfo($ch, CURLINFO_HEADER_OUT);

Reproduce code:
---
$request = EOD
?xml version=1.0 encoding=UTF-8?
methodCall
methodNamemenu.getAnswer/methodName
params/
/methodCall

EOD;

$header[] = Content-type: text/xml;
$header[] = User-Agent: foobar;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($ch);
$info = curl_getinfo($ch, CURLINFO_HEADER_OUT);

Expected result:

According to the documentation this option has been available since
version 5.1.3, so I expect to see the request headers which were sent out.

Actual result:
--
The result is always FALSE.

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



#50462 [Com]: mysqli_more_results does not play well with mysqli_multi_query()

2009-12-12 Thread pcdinh at gmail dot com
 ID:   50462
 Comment by:   pcdinh at gmail dot com
 Reported By:  pcdinh at gmail dot com
 Status:   Feedback
 Bug Type: MySQLi related
 Operating System: Windows XP
 PHP Version:  5.3.1
 New Comment:

The problem is mysqli_more_results($conn) needs to be called first to 
check if there is at least one result returned.

The code below is valid if I make a single query that returns multiple

result set 

mysqli_multi_query($conn, $query);

while (mysqli_more_results($conn))
{
mysqli_next_result($query);

/* store first result set */
if ($result = mysqli_store_result($conn)) {
 
}
}

When I use mysqli_multi_query() I may not know how many queries are 
there in $query. Therefore I would like to use mysqli_more_results() 
to check if I can loop through the result sets. It is the same as in 
array iteration

Single element: array(1)= using for: yes
2 elements: array(1, 2) = using for: yes

But when it comes to mysqli_multi_query()

Single element: array(1)= using while: no
2 elements: array(1, 2) = using while: yes

Because mysqli_multi_query() deals with multiple result sets, it is 
expected to have unified iteration interface for both single result 
set and multiple result sets.

Also the behavior is defined in PHP Manual that 

Indicates if one or more result sets are available from a previous 
call to mysqli_multi_query().

It means that mysqli_more_results($conn) must return true in my case

mysqli_multi_query($conn, $query);

while (mysqli_more_results($conn))
{

}

because in fact I do not know if there is any result returned at all 
after calling mysqli_multi_query(). So while 
(mysqli_more_results($conn)) is a good way to do if any.


Previous Comments:


[2009-12-12 22:19:44] j...@php.net

Exactly what is confusing here? Your first script does single query -
there are no more results than the one. So why would
mysqli_more_results() return true since there are no more results..?



[2009-12-12 21:54:29] pcdinh at gmail dot com

Hi,

I found that mysqli_more_results() return true when there is more than

1 query

?php
$link = mysqli_connect(localhost, root, 123456, test);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

$query  = SELECT 1;;
$query  .= SELECT 1;; // second query

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
var_dump(mysqli_more_results($link)); 
}

?

bool(true)

However, this behavior is totally confused



[2009-12-12 21:41:44] pcdinh at gmail dot com

Description:

mysqli_more_results() will always return false after 
mysqli_multi_query() for both SELECT and non SELECT queries

Therefore I can not use the loop while (mysqli_more_results()) in 
combination with mysqli_next_result() to iterate through result sets 
produced by SELECT queries

mysqli_multi_query($conn, $query);

while (mysqli_more_results($conn))
{
mysqli_next_result($query);

/* store first result set */
if ($result = mysqli_store_result($conn)) {
 
}
}

Code example in http://php.net/manual/en/mysqli.multi-query.php is 
outdated because it causes E_STRICT in PHP 5.3.1. It requires 
mysqli_more_results() to be called before mysqli_next_result()

There is a workaround

if (mysqli_multi_query($link, $query)) {
do {
/* store first result set */
if ($result = mysqli_store_result($link)) {
while ($row = mysqli_fetch_row($result)) {
printf(%s\n, $row[0]);
}
mysqli_free_result($result);
}

// print divider = will never work
if (mysqli_more_results($link)) {
printf(-\n);
}
} while (mysqli_more_results($link)  mysqli_next_result($link));
}

but mysqli_more_results() seems to do nothing related to result sets 
here


Reproduce code:
---
?php
$link = mysqli_connect(localhost, root, 123456, test);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

$query  = SELECT 1;

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
var_dump(mysqli_more_results($link));  
}

/* close connection */
mysqli_close($link);
?

Expected result:

bool(true)

Actual result:
--
bool(false)





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