Req #55149 [Com]: Limit the result of print_r() to facilitate debugging

2011-07-07 Thread lenzai2004-dev at yahoo dot com
Edit report at https://bugs.php.net/bug.php?id=55149edit=1

 ID: 55149
 Comment by: lenzai2004-dev at yahoo dot com
 Reported by:victor at cmp dot es
 Summary:Limit the result of print_r() to facilitate
 debugging
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   Irrelevant
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Why not writing your own custom php function for that purpose ?
Also for debugging var_dump is sometimes more useful than print_r.


Previous Comments:

[2011-07-06 11:51:03] victor at cmp dot es

Description:

You could add an additional third parameter to print_r() function in order to 
limit the nesting level of output.
Instead of showing all levels of nested arrays/objects, it could be limited to 
N nesting levels.
If I only want to know my simple class member variables (with 3 or 4 of them) 
of an object but the object has members with references/alias to other big 
objects/classes, the screen is filled with a lot of (in this case) useless 
information.
If I could limit in this case the output to 1 or 2 nesting levels it would be 
much easier for me to debug.
If this third parameter were ommitted or zero, the whole tree would be shown 
(as done now).








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


Req #52569 [Com]: Implement ondemand process-manager (to allow zero children)

2011-07-07 Thread dbetz at df dot eu
Edit report at https://bugs.php.net/bug.php?id=52569edit=1

 ID: 52569
 Comment by: dbetz at df dot eu
 Reported by:mplomer at gmx dot de
 Summary:Implement ondemand process-manager (to allow zero
 children)
 Status: Analyzed
 Type:   Feature/Change Request
 Package:FPM related
 PHP Version:5.3.3
 Assigned To:fat
 Block user comment: N
 Private report: N

 New Comment:

Hello,

i know, but when i make an request, no child gets spawned.

My PHP-FPM has more pools. Every pool is listening to an different socket.
The mod_fastcgi 2.4.6 is patched, that it connects to the socket for the domain.

Example:

Hostname: www.domain.com has PHP Version 5.3.6

FPM Config for Pool is:
[domain.com]
listen = /etc/httpd/fastcgi/5.3.6-domain.com
user = u12345
group = nobody

pm = ondemand
pm.process_idle_timeout = 10
pm.min_delay_between_fork = 1
pm.max_children = 5

When now an request for www.domain.com to the apache arrives, the apache looks 
in the ldap for the PHP Version, then mod_fastcgi searches for socket 
/etc/httpd/fastcgi/5.3.6-www.domain.com, if not existent for 
/etc/httpd/fastcgi/5.3.6-domain.com (snips www. ). Now Apache connects over 
mod_fastcgi to the correct socket, but no child gets spawned with pm = ondemand

With dynamic and static all works fine.

Any suggestions ?

Greetings,
Daniel


Previous Comments:

[2011-07-06 12:12:34] f...@php.net

This is normal.

the ONDEMAND pm has been made to avoid forking unnecessary children. Children 
are forked when requests arrives.

Here is what I have on my side:

## conf: 
pm = ondemand
pm.process_idle_timeout = 10
pm.min_delay_between_fork = 1 # this to avoid the known bug
pm.max_children = 5


## log
[06-Jul-2011 18:05:42.236929] NOTICE: pid 2579, fpm_event_loop(), line 267: 
ready to handle connections
[06-Jul-2011 18:05:43.237287] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children

## at start, no children have been forked
[06-Jul-2011 18:05:44.237661] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children

## I request a page and a child is forked to serve the page
[06-Jul-2011 18:05:44.902976] DEBUG: pid 2579, fpm_children_make(), line 411: 
[pool direct] child 2580 started
[06-Jul-2011 18:05:44.902987] DEBUG: pid 2579, fpm_pctl_on_socket_accept(), 
line 543: [pool direct] got accept without idle child available  I forked, 
now=1970813.831429
[06-Jul-2011 18:05:45.238081] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:46.238388] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:47.238889] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:48.239385] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:49.239671] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:50.240080] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:51.240520] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:52.241133] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:53.241648] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:54.242040] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children
[06-Jul-2011 18:05:55.242414] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 1 spare children

## 10s (pm.process_idle_timeout) later, the child has been killed.
[06-Jul-2011 18:05:55.243492] DEBUG: pid 2579, fpm_got_signal(), line 76: 
received SIGCHLD
[06-Jul-2011 18:05:55.243514] DEBUG: pid 2579, fpm_children_bury(), line 254: 
[pool direct] child 2580 has been killed by the process managment after 
10.340552 seconds from start
[06-Jul-2011 18:05:56.242905] DEBUG: pid 2579, 
fpm_pctl_perform_idle_server_maintenance(), line 362: [pool direct] currently 0 
active children, 0 spare children

Bug #54488 [Asn]: SIGSEGV in zend_assign_to_variable

2011-07-07 Thread dbetz at df dot eu
Edit report at https://bugs.php.net/bug.php?id=54488edit=1

 ID: 54488
 User updated by:dbetz at df dot eu
 Reported by:dbetz at df dot eu
 Summary:SIGSEGV in zend_assign_to_variable
 Status: Assigned
 Type:   Bug
 Package:FPM related
 Operating System:   Gentoo
 PHP Version:5.3.6
 Assigned To:fat
 Block user comment: N
 Private report: N

 New Comment:

Hello,

with 5.3.7RC3-dev i cant hit the bug anymore ( i think )
I will keep on testing.

Thx,
Daniel


Previous Comments:

[2011-07-06 08:56:27] dbetz at df dot eu

Ah, what i have forgotten:
With debug flags in the php-fpm binary the segfaults seems not to occur so 
often.
I try now the latest snapshot to see if the problem is there too.


[2011-07-06 08:41:50] dbetz at df dot eu

Oh sorry, my failure.

Now its 5.3.6 and the problem still exists with that version.

Greetings,
Daniel


[2011-07-06 08:32:58] f...@php.net

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to Open.

Thank you for your interest in PHP.


you are reporting using 5.3.6 but on the phpinfo() page you provide us it's 
5.3.5.

Is it possible for you to test using the last snapshot of 5.3 please ?

thx
++ jerome


[2011-07-06 07:29:49] dbetz at df dot eu

Hello,

no problem. :-)

The apache config is a little bit difficult, so i only paste the relevant 
things:

  LoadModule fastcgi_module mod_fastcgi.so
  LoadModule ldap_modulemod_ldap.so
  LoadModule vhost_ldap_module  mod_vhost_ldap.so

  LDAPSharedCacheSize 200
  LDAPCacheEntries 4096
  LDAPCacheTTL 5
  LDAPOpCacheEntries 4096
  LDAPOpCacheTTL 5

  FastCgiExternalServer /etc/httpd/fastcgi/php-fcgi-starter -socket 
/etc/httpd/fastcgi/php5-53LATEST
  Action php-fastcgi /php/php-fcgi-starter

VirtualHost _default_:80
  ServerName domainname.de
  SuexecUserGroup apache nobody
  DocumentRoot /kunden/shadow/htdocs/

  ScriptAlias /php/ /etc/httpd/fastcgi/

  VhostLDAPEnabled on
  VhostLDAPUrl ldap://localhost/cn=bla,sec=hosting,o=domain,c=de;
  VhostLdapBindDN cn=username,cn=bla,sec=hosting,o=domain,c=de
  VhostLDAPBindPassword noone
/Virtualhost

FPM Config:

;
; FPM Configuration ;
;

; All relative paths in this configuration file are relative to PHP's install
; prefix.

; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
include=/usr/local/etc/fpm.d/5-53LATEST-*.conf

;;
; Global Options ;
;;

[global]

pid = /var/run/php5-53LATEST.pid

; Error log file
; Note: the default prefix is /usr/local/var
; Default Value: log/php-fpm.log
error_log = /var/log/php-fpm.log

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
log_level = warning

; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
emergency_restart_threshold = 10

[default]

listen = /etc/httpd/fastcgi/5-53LATEST
user = root
group = nobody

pm = dynamic
pm.max_children = 1000
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1
pm.max_requests = 1000

; PHP.ini Settings:

php_flag[track_errors] = Off
php_flag[allow_url_fopen] = On
php_flag[sql.safe_mode] = Off
..
tons of php_(admin)_flags



phpinfo() can be found at http://imageupgrade2.domainfactory-kunde.de/info.php

Thanks for your help


[2011-07-06 06:18:44] f...@php.net

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to Open.

Thank you for your interest in PHP.


I'm sorry to bother you again. Can you please give us the apache configuration 
and 
a phpinfo() output ?

thx




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

https://bugs.php.net/bug.php?id=54488


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


Req #46202 [Bgs]: Avoid SQL injection by design

2011-07-07 Thread aharvey
Edit report at https://bugs.php.net/bug.php?id=46202edit=1

 ID: 46202
 Updated by: ahar...@php.net
 Reported by:olafvdspek at gmail dot com
 Summary:Avoid SQL injection by design
 Status: Bogus
 Type:   Feature/Change Request
-Package:Feature/Change Request
+Package:*General Issues
 PHP Version:5.2.6
 Block user comment: N
 Private report: N

 New Comment:

Given the existence of both PDO and mysqli, I don't think anything Scott said 
three years ago has changed.


Previous Comments:

[2011-07-06 07:24:37] olafvdspek at gmail dot com

SQL injections are still happening today and in a lot of cases PHP is involved. 
In 
my opinion it'd not be so hard to implement this feature request. It'd make a 
lot 
of people happy!
Could you reconsider?


[2008-09-30 10:19:04] olafvdspek at gmail dot com

 Sorry, but your problem does not imply a bug in PHP itself. 

Guess why I used category: feature/change request. ;)

I'm aware of mysqli_prepare, but it's not what I requested, although the syntax 
might look similar.

mysqli_prepare is harder to use than mysql_query, instead of easier. That's no 
good...


[2008-09-30 10:14:45] scott...@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

mysqli_prepare() already exists.


[2008-09-30 09:26:54] olafvdspek at gmail dot com

Description:

The standard mysql_query function is very prone to abuse. Could a function be 
added that's safer? Like, for example:

mysql_query_safe(insert into T (A, B, C) values (?, ?, ?), $a, $b, $c);

The function would be a bit like sprintf, except it would automatically call 
mysql_real_escape_string on all non-int arguments and enclose them in single 
quotes. Safe types like int would not receive this treatment.

Reproduce code:
---
mysql_query(insert into T (A, B, C) values (?, ?, ?), $a, $b, $c);

Expected result:

No SQL injection vulnerability

Actual result:
--
SQL injection vulnerability






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


[PHP-BUG] Bug #55154 [NEW]: SQLite does not support stream wrappers to access to database file

2011-07-07 Thread ivan dot enderlin at hoa-project dot net
From: 
Operating system: 
PHP version:  5.4SVN-2011-07-07 (SVN)
Package:  SQLite related
Bug Type: Bug
Bug description:SQLite does not support stream wrappers to access to database 
file

Description:

It seems like SQLite does not considere stream wrappers to access to
database file (with \SQLite3 class or PDO driver).

Test script:
---
?php

/**
 * $ echo CREATE TABLE t ( x INTEGER PRIMARY KEY ASC, y, z ); |\
 *   sqlite3 -init 0 Foo.sqlite
 */

class W {

public function stream_open ( $path, $mode, $options, $openedPath ) {

return fopen('Foo.sqlite', $mode);
}

public function url_stat ( $path, $flags ) {

return stat('Foo.sqlite');
}
}

stream_wrapper_register('sw', 'W');

var_dump(fopen('sw://foo', 'r'));
var_dump(file_exists('sw://foo'));

var_dump(new \SQLite3('Foo.sqlite'));
var_dump(new \SQLite3('sw://foo'));

Expected result:

resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}
object(SQLite3)#2 (0) {
}

Actual result:
--
resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}

Fatal error: Uncaught exception 'Exception' with message 'Unable to open
database: unable to open database file' in ….php:27
Stack trace:
#0 ….php(27): SQLite3-__construct('sw://foo')
#1 {main}
  thrown in ….php on line 27

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



Req #46202 [Com]: Avoid SQL injection by design

2011-07-07 Thread olafvdspek at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=46202edit=1

 ID: 46202
 Comment by: olafvdspek at gmail dot com
 Reported by:olafvdspek at gmail dot com
 Summary:Avoid SQL injection by design
 Status: Bogus
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:5.2.6
 Block user comment: N
 Private report: N

 New Comment:

So mysql_query() is deprecated?
The mysql_query() page doesn't mention mysqli or PDO at all, wouldn't it be 
good 
to mention those if those are indeed the recommended way?


Previous Comments:

[2011-07-07 03:32:13] ahar...@php.net

Given the existence of both PDO and mysqli, I don't think anything Scott said 
three years ago has changed.


[2011-07-06 07:24:37] olafvdspek at gmail dot com

SQL injections are still happening today and in a lot of cases PHP is involved. 
In 
my opinion it'd not be so hard to implement this feature request. It'd make a 
lot 
of people happy!
Could you reconsider?


[2008-09-30 10:19:04] olafvdspek at gmail dot com

 Sorry, but your problem does not imply a bug in PHP itself. 

Guess why I used category: feature/change request. ;)

I'm aware of mysqli_prepare, but it's not what I requested, although the syntax 
might look similar.

mysqli_prepare is harder to use than mysql_query, instead of easier. That's no 
good...


[2008-09-30 10:14:45] scott...@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

mysqli_prepare() already exists.


[2008-09-30 09:26:54] olafvdspek at gmail dot com

Description:

The standard mysql_query function is very prone to abuse. Could a function be 
added that's safer? Like, for example:

mysql_query_safe(insert into T (A, B, C) values (?, ?, ?), $a, $b, $c);

The function would be a bit like sprintf, except it would automatically call 
mysql_real_escape_string on all non-int arguments and enclose them in single 
quotes. Safe types like int would not receive this treatment.

Reproduce code:
---
mysql_query(insert into T (A, B, C) values (?, ?, ?), $a, $b, $c);

Expected result:

No SQL injection vulnerability

Actual result:
--
SQL injection vulnerability






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


Bug #55135 [Csd]: Array keys are no longer type casted in unset()

2011-07-07 Thread damien at commerceguys dot com
Edit report at https://bugs.php.net/bug.php?id=55135edit=1

 ID: 55135
 User updated by:damien at commerceguys dot com
 Reported by:damien at commerceguys dot com
 Summary:Array keys are no longer type casted in unset()
 Status: Closed
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Linux
 PHP Version:5.4SVN-2011-07-05 (SVN)
 Assigned To:dmitry
 Block user comment: N
 Private report: N

 New Comment:

Confirmed that this issue is fixed. Thanks. The bulk of the Drupal 8 test suite 
now passes on PHP 5.4 ;)


Previous Comments:

[2011-07-06 08:04:03] dmi...@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.




[2011-07-06 08:04:02] dmi...@php.net

Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=313005
Log: Fixed bug #55135 (Array keys are no longer type casted in unset())


[2011-07-05 09:23:18] damien at commerceguys dot com

Description:

An array key passed to unset() from a variable doesn't seem to be typecasted 
anymore.


Test script:
---
This doesn't work anymore in PHP 5.4:

?php
// This fails.
$array = array(1 = 2);
$a = 1;
unset($array[$a]);
print_r($array);

// Those works.
$array = array(1 = 2);
$a = 1;
unset($array[$a]);
print_r($array);

$array = array(1 = 2);
unset($array[1]);
print_r($array);

$array = array(1 = 2);
$a = 1;
unset($array[1]);
print_r($array);
?

Expected result:

Array
(
)
Array
(
)
Array
(
)
Array
(
)


Actual result:
--
Array
(
[1] = 2
)
Array
(
)
Array
(
)
Array
(
)







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


Bug #55151 [Opn-Bgs]: Unable to open sessions while MySQL DB connection is open

2011-07-07 Thread johannes
Edit report at https://bugs.php.net/bug.php?id=55151edit=1

 ID: 55151
 Updated by: johan...@php.net
 Reported by:dkettmann at kmcis dot com
 Summary:Unable to open sessions while MySQL DB connection is
 open
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Session related
 Operating System:   RHEL/CentOS
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 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

If you do a session_start() the session file is locked till the session is 
closed again. This is needed to avoid loosing data from concurrent requests. In 
your example: If 2.php would change the session data this would be overwritten 
by the old state in 1.php.


Previous Comments:

[2011-07-06 14:34:32] dkettmann at kmcis dot com

Description:

On RHEL(or Centos) 5.6 running any available PHP package thru RedHat and the 
latest version of PHP (5.3.6).

Run first script provided in a browser, then while that is running, fire up the 
second script. The second script will not finish until the first one calls the 
session_write_close() function.

Test script:
---
=== 1.php ===
?php
$counter=1;
$DB= mysql_connect(localhost,$user,$pass,true);
mysql_select_db(database);

session_start();
echo Starting...\n;
while ( $counter = 5 ) 
{
echo $counter ... \n;
sleep(2);
$counter++;
}
echo Done!... \n;
session_write_close();
?

=== 2.php ===
?php
session_start();
echo TESTING!\n;
session_write_close();
?

Expected result:

When both scripts are run at the same time, the second script should exit 
(nearly) immediately after opening a session, echoing the TESTING line, then 
closing the session. After the while loop is done in the first script, it 
should exit as expected. 

Actual result:
--
When the both scripts are executed at the same time (or one right after the 
other), the second script hangs at the 'session_start()' line until the first 
script is done.






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


[PHP-BUG] Bug #55155 [NEW]: Cannot use non-bracketed namespaces in interactive shell on multiple lines

2011-07-07 Thread patrickalla...@php.net
From: patrickallaert
Operating system: Linux
PHP version:  5.3.6
Package:  Compile Failure
Bug Type: Bug
Bug description:Cannot use non-bracketed namespaces in interactive shell on 
multiple lines

Description:

When using PHP in interactive mode (php -a) namespaces must be used with
the 
bracketed form:

php  namespace a {class A {}}
php  namespace b {class A {}}

or on the same line:

php  namespace a; class A {};
php  namespace b; class A {};

Using:


php  namespace a;
php  class A {};
php  namespace b;
php  class A {};

should be semantically exactly the same but results in:

PHP Fatal error:  Cannot redeclare class A in php shell code on line 1

Test script:
---
$ php -a
php  namespace a;
php  class A {};
php  namespace b;
php  class A {};

Expected result:

No fatal error.

Actual result:
--
PHP Fatal error:  Cannot redeclare class A in php shell code on line 1

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



[PHP-BUG] Bug #55156 [NEW]: ReflectionClass::getDocComment() returns comment even though the class has none

2011-07-07 Thread schmittjoh at gmail dot com
From: 
Operating system: Ubuntu 10.04
PHP version:  5.3.6
Package:  Reflection related
Bug Type: Bug
Bug description:ReflectionClass::getDocComment() returns comment even though 
the class has none

Description:

In some cases, the ReflectionClass::getDocComment() method returns a doc
comment that belongs to another class than the one the ReflectionClass
represents.

I haven't been able to reproduce in a isolated script, but instead I have
added a failing unit test to Doctrine's unit test suite, see
https://github.com/schmittjoh/common/commit/2d77264758ddd9658791b4284a9492a38bb1b049

You can run this test, by performing the following steps:

git clone http://github.com/schmittjoh/common.git
cd common
git checkout strangePhpError
phpunit

Test script:
---
see above


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



Bug #55156 [Com]: ReflectionClass::getDocComment() returns comment even though the class has none

2011-07-07 Thread schmittjoh at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55156edit=1

 ID: 55156
 Comment by: schmittjoh at gmail dot com
 Reported by:schmittjoh at gmail dot com
 Summary:ReflectionClass::getDocComment() returns comment
 even though the class has none
 Status: Open
 Type:   Bug
 Package:Reflection related
 Operating System:   Ubuntu 10.04
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Note that this only happens if the class that ReflectionClass represents has no 
doc comment itself.


Previous Comments:

[2011-07-07 06:46:11] schmittjoh at gmail dot com

Description:

In some cases, the ReflectionClass::getDocComment() method returns a doc 
comment that belongs to another class than the one the ReflectionClass 
represents.

I haven't been able to reproduce in a isolated script, but instead I have added 
a failing unit test to Doctrine's unit test suite, see 
https://github.com/schmittjoh/common/commit/2d77264758ddd9658791b4284a9492a38bb1b049

You can run this test, by performing the following steps:

git clone http://github.com/schmittjoh/common.git
cd common
git checkout strangePhpError
phpunit

Test script:
---
see above







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


[PHP-BUG] Bug #55157 [NEW]: ArrayIterator::offsetUnset(); does not work correctly

2011-07-07 Thread olav at fwt dot no
From: 
Operating system: openSUSE 11.4/Debian 5
PHP version:  Irrelevant
Package:  SPL related
Bug Type: Bug
Bug description:ArrayIterator::offsetUnset(); does not work correctly

Description:

ArrayIterator always skips the second element in the array when calling 
offsetUnset(); on it while looping through.

Using the key from iterator and unsetting in the actual ArrayObject works
as 
expected.

Running php 5.3.5 on openSUSE 11.4
Replicated same bug on Debian 5 running PHP 5.2.6-1+lenny9.

php5 is installed as binary on both systems, SPL is builtin package.


Test script:
---
?php

// Create a array range from 0 to 9
$a = new ArrayObject( range( 0,9 ) );
$b = new ArrayIterator( $a );
 
for ( $b-rewind(); $b-valid(); $b-next() )
{
echo #{$b-current()} - \r\n;
$b-offsetUnset( $b-key() );
}
?

Expected result:

Expected a list of from 0 to 9 echoed out.

Actual result:
--
Lists out 0 and then 2-9 leaving index 1 untouched in the original
ArrayObject.


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



Bug #55157 [Opn-Asn]: ArrayIterator::offsetUnset(); does not work correctly

2011-07-07 Thread colder
Edit report at https://bugs.php.net/bug.php?id=55157edit=1

 ID: 55157
 Updated by: col...@php.net
 Reported by:olav at fwt dot no
 Summary:ArrayIterator::offsetUnset(); does not work
 correctly
-Status: Open
+Status: Assigned
 Type:   Bug
 Package:SPL related
 Operating System:   openSUSE 11.4/Debian 5
 PHP Version:Irrelevant
-Assigned To:
+Assigned To:colder
 Block user comment: N
 Private report: N



Previous Comments:

[2011-07-07 06:52:24] olav at fwt dot no

Description:

ArrayIterator always skips the second element in the array when calling 
offsetUnset(); on it while looping through.

Using the key from iterator and unsetting in the actual ArrayObject works as 
expected.

Running php 5.3.5 on openSUSE 11.4
Replicated same bug on Debian 5 running PHP 5.2.6-1+lenny9.

php5 is installed as binary on both systems, SPL is builtin package.


Test script:
---
?php

// Create a array range from 0 to 9
$a = new ArrayObject( range( 0,9 ) );
$b = new ArrayIterator( $a );
 
for ( $b-rewind(); $b-valid(); $b-next() )
{
echo #{$b-current()} - \r\n;
$b-offsetUnset( $b-key() );
}
?

Expected result:

Expected a list of from 0 to 9 echoed out.

Actual result:
--
Lists out 0 and then 2-9 leaving index 1 untouched in the original ArrayObject.







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


Bug #55157 [Asn]: ArrayIterator::offsetUnset(); does not work correctly

2011-07-07 Thread joey
Edit report at https://bugs.php.net/bug.php?id=55157edit=1

 ID: 55157
 Updated by: j...@php.net
 Reported by:olav at fwt dot no
 Summary:ArrayIterator::offsetUnset(); does not work
 correctly
 Status: Assigned
 Type:   Bug
 Package:SPL related
 Operating System:   openSUSE 11.4/Debian 5
 PHP Version:Irrelevant
 Assigned To:colder
 Block user comment: N
 Private report: N

 New Comment:

Just to narrow the scope of the bug a bit:

$a = range( 0,9 );
$b = new ArrayIterator( $a );
 
foreach($b as $k=$v) {
$b-offsetUnset($k);
}

var_dump($b-getArrayCopy()); // why is 1 still around?


Previous Comments:

[2011-07-07 06:52:24] olav at fwt dot no

Description:

ArrayIterator always skips the second element in the array when calling 
offsetUnset(); on it while looping through.

Using the key from iterator and unsetting in the actual ArrayObject works as 
expected.

Running php 5.3.5 on openSUSE 11.4
Replicated same bug on Debian 5 running PHP 5.2.6-1+lenny9.

php5 is installed as binary on both systems, SPL is builtin package.


Test script:
---
?php

// Create a array range from 0 to 9
$a = new ArrayObject( range( 0,9 ) );
$b = new ArrayIterator( $a );
 
for ( $b-rewind(); $b-valid(); $b-next() )
{
echo #{$b-current()} - \r\n;
$b-offsetUnset( $b-key() );
}
?

Expected result:

Expected a list of from 0 to 9 echoed out.

Actual result:
--
Lists out 0 and then 2-9 leaving index 1 untouched in the original ArrayObject.







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


Bug #55157 [Asn]: ArrayIterator::offsetUnset(); does not work correctly

2011-07-07 Thread joey
Edit report at https://bugs.php.net/bug.php?id=55157edit=1

 ID: 55157
 Updated by: j...@php.net
 Reported by:olav at fwt dot no
 Summary:ArrayIterator::offsetUnset(); does not work
 correctly
 Status: Assigned
 Type:   Bug
 Package:SPL related
 Operating System:   openSUSE 11.4/Debian 5
 PHP Version:Irrelevant
 Assigned To:colder
 Block user comment: N
 Private report: N

 New Comment:

Sorry, I should clarify that the code above gives:

array(1) { [1]= int(1) }

Whereas you'd probably expect:

array(0) { }


Previous Comments:

[2011-07-07 07:17:12] j...@php.net

Just to narrow the scope of the bug a bit:

$a = range( 0,9 );
$b = new ArrayIterator( $a );
 
foreach($b as $k=$v) {
$b-offsetUnset($k);
}

var_dump($b-getArrayCopy()); // why is 1 still around?


[2011-07-07 06:52:24] olav at fwt dot no

Description:

ArrayIterator always skips the second element in the array when calling 
offsetUnset(); on it while looping through.

Using the key from iterator and unsetting in the actual ArrayObject works as 
expected.

Running php 5.3.5 on openSUSE 11.4
Replicated same bug on Debian 5 running PHP 5.2.6-1+lenny9.

php5 is installed as binary on both systems, SPL is builtin package.


Test script:
---
?php

// Create a array range from 0 to 9
$a = new ArrayObject( range( 0,9 ) );
$b = new ArrayIterator( $a );
 
for ( $b-rewind(); $b-valid(); $b-next() )
{
echo #{$b-current()} - \r\n;
$b-offsetUnset( $b-key() );
}
?

Expected result:

Expected a list of from 0 to 9 echoed out.

Actual result:
--
Lists out 0 and then 2-9 leaving index 1 untouched in the original ArrayObject.







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


Bug #55154 [Opn-Wfx]: SQLite does not support stream wrappers to access to database file

2011-07-07 Thread scottmac
Edit report at https://bugs.php.net/bug.php?id=55154edit=1

 ID: 55154
 Updated by: scott...@php.net
 Reported by:ivan dot enderlin at hoa-project dot net
 Summary:SQLite does not support stream wrappers to access to
 database file
-Status: Open
+Status: Wont fix
 Type:   Bug
 Package:SQLite related
 PHP Version:5.4SVN-2011-07-07 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

The underlying library creates journal files and locking in the same directory 
as 
the file it's working on. A stream just wouldn't cut it here.


Previous Comments:

[2011-07-07 04:24:47] ivan dot enderlin at hoa-project dot net

Description:

It seems like SQLite does not considere stream wrappers to access to database 
file (with \SQLite3 class or PDO driver).

Test script:
---
?php

/**
 * $ echo CREATE TABLE t ( x INTEGER PRIMARY KEY ASC, y, z ); |\
 *   sqlite3 -init 0 Foo.sqlite
 */

class W {

public function stream_open ( $path, $mode, $options, $openedPath ) {

return fopen('Foo.sqlite', $mode);
}

public function url_stat ( $path, $flags ) {

return stat('Foo.sqlite');
}
}

stream_wrapper_register('sw', 'W');

var_dump(fopen('sw://foo', 'r'));
var_dump(file_exists('sw://foo'));

var_dump(new \SQLite3('Foo.sqlite'));
var_dump(new \SQLite3('sw://foo'));

Expected result:

resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}
object(SQLite3)#2 (0) {
}

Actual result:
--
resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}

Fatal error: Uncaught exception 'Exception' with message 'Unable to open 
database: unable to open database file' in ….php:27
Stack trace:
#0 ….php(27): SQLite3-__construct('sw://foo')
#1 {main}
  thrown in ….php on line 27






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


Bug #55154 [Wfx-Csd]: SQLite does not support stream wrappers to access to database file

2011-07-07 Thread ivan dot enderlin at hoa-project dot net
Edit report at https://bugs.php.net/bug.php?id=55154edit=1

 ID: 55154
 User updated by:ivan dot enderlin at hoa-project dot net
 Reported by:ivan dot enderlin at hoa-project dot net
 Summary:SQLite does not support stream wrappers to access to
 database file
-Status: Wont fix
+Status: Closed
 Type:   Bug
 Package:SQLite related
 PHP Version:5.4SVN-2011-07-07 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

I understand. So there is no possible workaround to fix this little issue?
In this case, I change the bug status to “closed”.

Thanks.


Previous Comments:

[2011-07-07 11:40:53] scott...@php.net

The underlying library creates journal files and locking in the same directory 
as 
the file it's working on. A stream just wouldn't cut it here.


[2011-07-07 04:24:47] ivan dot enderlin at hoa-project dot net

Description:

It seems like SQLite does not considere stream wrappers to access to database 
file (with \SQLite3 class or PDO driver).

Test script:
---
?php

/**
 * $ echo CREATE TABLE t ( x INTEGER PRIMARY KEY ASC, y, z ); |\
 *   sqlite3 -init 0 Foo.sqlite
 */

class W {

public function stream_open ( $path, $mode, $options, $openedPath ) {

return fopen('Foo.sqlite', $mode);
}

public function url_stat ( $path, $flags ) {

return stat('Foo.sqlite');
}
}

stream_wrapper_register('sw', 'W');

var_dump(fopen('sw://foo', 'r'));
var_dump(file_exists('sw://foo'));

var_dump(new \SQLite3('Foo.sqlite'));
var_dump(new \SQLite3('sw://foo'));

Expected result:

resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}
object(SQLite3)#2 (0) {
}

Actual result:
--
resource(7) of type (stream)
bool(true)
object(SQLite3)#1 (0) {
}

Fatal error: Uncaught exception 'Exception' with message 'Unable to open 
database: unable to open database file' in ….php:27
Stack trace:
#0 ….php(27): SQLite3-__construct('sw://foo')
#1 {main}
  thrown in ….php on line 27






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


Bug #55155 [Opn-Asn]: Cannot use non-bracketed namespaces in interactive shell on multiple lines

2011-07-07 Thread johannes
Edit report at https://bugs.php.net/bug.php?id=55155edit=1

 ID: 55155
 Updated by: johan...@php.net
 Reported by:patrickalla...@php.net
 Summary:Cannot use non-bracketed namespaces in interactive
 shell on multiple lines
-Status: Open
+Status: Assigned
 Type:   Bug
 Package:Compile Failure
 Operating System:   Linux
 PHP Version:5.3.6
-Assigned To:
+Assigned To:johannes
 Block user comment: N
 Private report: N

 New Comment:

Whenever you press enter and the shell assumes the code might be valid (crrect 
amount of quotes, braces etc.) it will be executed. So

php  namespace a;

and

php  class A {};

will be executed independently, similar to being in different files being 
included.

Maybe the logic for detecting whether it is executable code can be extended 
with this special case .. on second thought that's no good idea this would 
cause cases like this:

php  namespace a;
php  class A {} // declares a\A
php  class A {} // declares A

 ... so we'd probably need a magic to set the current namespace. Not sure I 
really want that. Becomes quite a hack.

Maybe it's best to document this limitation, but I'll try to think about a good 
thing to do.


Previous Comments:

[2011-07-07 05:32:46] patrickalla...@php.net

Description:

When using PHP in interactive mode (php -a) namespaces must be used with the 
bracketed form:

php  namespace a {class A {}}
php  namespace b {class A {}}

or on the same line:

php  namespace a; class A {};
php  namespace b; class A {};

Using:


php  namespace a;
php  class A {};
php  namespace b;
php  class A {};

should be semantically exactly the same but results in:

PHP Fatal error:  Cannot redeclare class A in php shell code on line 1

Test script:
---
$ php -a
php  namespace a;
php  class A {};
php  namespace b;
php  class A {};

Expected result:

No fatal error.

Actual result:
--
PHP Fatal error:  Cannot redeclare class A in php shell code on line 1






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


Bug #55155 [Asn]: Cannot use non-bracketed namespaces in interactive shell on multiple lines

2011-07-07 Thread patrickallaert
Edit report at https://bugs.php.net/bug.php?id=55155edit=1

 ID: 55155
 Updated by: patrickalla...@php.net
 Reported by:patrickalla...@php.net
 Summary:Cannot use non-bracketed namespaces in interactive
 shell on multiple lines
 Status: Assigned
 Type:   Bug
 Package:Compile Failure
 Operating System:   Linux
 PHP Version:5.3.6
 Assigned To:johannes
 Block user comment: N
 Private report: N

 New Comment:

 php  namespace a;
 php  class A {} // declares a\A
 php  class A {} // declares A

I would rather say that the second call to class A{} should remain as if we 
were still in the namespace a.

I would expect the following on the second declaration of class A:
PHP Fatal error:  Cannot redeclare class a\A in php shell code on ...


Previous Comments:

[2011-07-07 12:06:40] johan...@php.net

Whenever you press enter and the shell assumes the code might be valid (crrect 
amount of quotes, braces etc.) it will be executed. So

php  namespace a;

and

php  class A {};

will be executed independently, similar to being in different files being 
included.

Maybe the logic for detecting whether it is executable code can be extended 
with this special case .. on second thought that's no good idea this would 
cause cases like this:

php  namespace a;
php  class A {} // declares a\A
php  class A {} // declares A

 ... so we'd probably need a magic to set the current namespace. Not sure I 
really want that. Becomes quite a hack.

Maybe it's best to document this limitation, but I'll try to think about a good 
thing to do.


[2011-07-07 05:32:46] patrickalla...@php.net

Description:

When using PHP in interactive mode (php -a) namespaces must be used with the 
bracketed form:

php  namespace a {class A {}}
php  namespace b {class A {}}

or on the same line:

php  namespace a; class A {};
php  namespace b; class A {};

Using:


php  namespace a;
php  class A {};
php  namespace b;
php  class A {};

should be semantically exactly the same but results in:

PHP Fatal error:  Cannot redeclare class A in php shell code on line 1

Test script:
---
$ php -a
php  namespace a;
php  class A {};
php  namespace b;
php  class A {};

Expected result:

No fatal error.

Actual result:
--
PHP Fatal error:  Cannot redeclare class A in php shell code on line 1






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


[PHP-BUG] Req #55158 [NEW]: Add SORT_NATURAL type to array_multisort

2011-07-07 Thread joe dot lencioni+php at gmail dot com
From: 
Operating system: 
PHP version:  5.3.6
Package:  Arrays related
Bug Type: Feature/Change Request
Bug description:Add SORT_NATURAL type to array_multisort

Description:

Arrays often need to be sorted using a natural order algorithm. There are

currently functions in PHP for sorting single arrays this way (natsort, 
natcasesort), but nothing exists for a multisort.

It would be great to see a SORT_NATURAL option in the array_multisort
function.

Test script:
---
$a  = array(
'Second',
'First',
'Twentieth',
'Tenth',
'Third',
);

$b  = array(
'2 a',
'1 b',
'20 c',
'10 d',
'3 e',
);

array_multisort($b, SORT_NATURAL, $a);

var_dump($a, $b);

Expected result:

array
  0 = string 'First' (length=5)
  1 = string 'Second' (length=6)
  2 = string 'Third' (length=5)
  3 = string 'Tenth' (length=5)
  4 = string 'Twentieth' (length=9)
array
  0 = string '1 b' (length=3)
  1 = string '2 a' (length=3)
  2 = string '3 e' (length=3)
  3 = string '10 d' (length=4)
  4 = string '20 c' (length=4)


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



Bug #52601 [NoF-Csd]: make fails with error: conflicting types for 'int8_t'

2011-07-07 Thread gwolanin at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=52601edit=1

 ID: 52601
 User updated by:gwolanin at gmail dot com
 Reported by:gwolanin at gmail dot com
 Summary:make fails with error: conflicting types for
 'int8_t'
-Status: No Feedback
+Status: Closed
 Type:   Bug
 Package:Compile Failure
 Operating System:   Solaris 2.8
 PHP Version:5.2.14
 Assigned To:iliaa
 Block user comment: N
 Private report: N

 New Comment:

Sorry it took a while to retry this.

I am still getting this error with php 5.3.6

I have removed and updated pcre and perl from SunFreeware.com.  make stops at 
the same spot.

So I edited ext/pcre/pcrelib/pcre_internal.h
On line 198, I commented out #include stdint.h, compiles fine now.


Previous Comments:

[2011-06-01 12:01:55] il...@php.net

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.




[2010-12-13 17:26:32] il...@php.net

Please try using this snapshot:

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

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




[2010-08-24 20:49:50] gwolanin at gmail dot com

I was unable to post the full configure results here.  I just downloaded 5.3.3 
to compile.  I removed the --with-xsl from my previous configure command, I 
figured I didn't need it:

#! /bin/sh
#
# Created by configure

'./configure' \
'--prefix=/opt/php-5.3.3' \
'--with-mysql=/opt/mysql' \
'--with-mysql-sock=/tmp' \
'--with-pdo-mysql=/opt/mysql' \
'--with-apxs2=/opt/httpd-2.2.16/bin/apxs' \
'--with-jpeg-dir=/usr/local' \
'--with-png-dir=/usr/share/src/libpng-1.2.1' \
'--with-gd' \
'--with-freetype-dir=/usr/local/lib' \
'--with-curl=/usr/local/bin' \
'--enable-cli' \
'--enable-ftp' \
'--enable-zip' \
'--with-ldap=/opt/ldap' \
'--with-zlib' \
$@
~
~
~
~
~
~
~
~
~
~
config.nice 21 lines, 472 characters 

andromeda:/usr/share/src/php-5.3.3: make
/bin/sh /usr/share/src/php-5.3.3/libtool --silent --preserve-dup-deps 
--mode=compile gcc -I/usr/share/src/php-5.3.3/ext/pcre/pcrelib -Iext/pcre/ 
-I/usr/share/src/php-5.3.3/ext/pcre/ -DPHP_ATOM_INC 
-I/usr/share/src/php-5.3.3/include -I/usr/share/src/php-5.3.3/main 
-I/usr/share/src/php-5.3.3 -I/usr/share/src/php-5.3.3/ext/date/lib 
-I/usr/share/src/php-5.3.3/ext/ereg/regex -I/usr/local/include/libxml2 
-I/usr/local/include -I/usr/local/include/freetype2 -I/opt/ldap/include 
-I/opt/mysql/include/mysql -I/usr/share/src/php-5.3.3/ext/sqlite3/libsqlite 
-I/usr/share/src/php-5.3.3/TSRM -I/usr/share/src/php-5.3.3/Zend  
-D_POSIX_PTHREAD_SEMANTICS  -I/usr/local/include -g -O2   -c 
/usr/share/src/php-5.3.3/ext/pcre/pcrelib/pcre_chartables.c -o 
ext/pcre/pcrelib/pcre_chartables.lo 
In file included from 
/usr/share/src/php-5.3.3/ext/pcre/pcrelib/pcre_internal.h:197,
 from 
/usr/share/src/php-5.3.3/ext/pcre/pcrelib/pcre_chartables.c:25:
/usr/include/stdint.h:41: error: conflicting types for 'int8_t'
/usr/include/sys/int_types.h:62: error: previous declaration of 'int8_t' was 
here
/usr/include/stdint.h:42: error: conflicting types for 'int_least8_t'
/usr/include/sys/int_types.h:119: error: previous declaration of 'int_least8_t' 
was here
make: *** [ext/pcre/pcrelib/pcre_chartables.lo] Error 1
andromeda:/usr/share/src/php-5.3.3:


[2010-08-20 20:46:48] gwolanin at gmail dot com

Sorry for the late response.  I have d/l and tried to compile with the 'latest' 
and I get the same error.


[2010-08-14 00:53:31] fel...@php.net

This must be fixed by the fix for bug #52436
Could you check it? :) (trying the snapshot)

Thanks.




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

https://bugs.php.net/bug.php?id=52601


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


[PHP-BUG] Bug #55159 [NEW]: fopen encodes ampersand '' as 'amp;'

2011-07-07 Thread knappster_1 at hotmail dot com
From: 
Operating system: Unix 
PHP version:  5.2.17
Package:  Unknown/Other Function
Bug Type: Bug
Bug description:fopen encodes ampersand '' as 'amp;'

Description:

---
From manual page: http://www.php.net/function.fopen%23Parameters
---
The function used to return a csv file with a stock quote with PHP 5.2.9. 
However, now with 5.2.17 the function will replace '' with 'amp;' and it
returns a csv file with just the text: Missing Format Variable.

It is easy to verify by using a malformed URL with '' in it and on the
resulting html, view source and the error message will show 'amp;' where
'' should be.  I have been unable to locate a workaround.  

Test script:
---
fopen(http://finance.yahoo.com/d/quotes.csv?s=ABTf=sl1d1t1c1ohgvpnbaejkro=t;,
r);


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



Bug #28098 [Com]: mysql_pconnect never kills threads

2011-07-07 Thread jose dot nobile at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=28098edit=1

 ID: 28098
 Comment by: jose dot nobile at gmail dot com
 Reported by:moreau at myrealbox dot com
 Summary:mysql_pconnect never kills threads
 Status: Bogus
 Type:   Bug
 Package:MySQL related
 Operating System:   FreeBSD 5.2.1
 PHP Version:4.3.6
 Block user comment: N
 Private report: N

 New Comment:

I don't found any form to use persistent connections.

No threads, no working
threads, no working
php in console, no working


What is the enviroment to use persistent connections?

Apache + forker
Apache + Worker
Apache + PHP fastcgi

Which???

This is not a bogus, is a real BUG of 7 years old.


Previous Comments:

[2004-04-22 18:26:16] il...@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

When using threads you should not be using persistent 
connections, because PHP cannot identify existing 
connections as already avaliable and therefor opens a new 
persistent connection each time. 


[2004-04-22 08:36:07] moreau at myrealbox dot com

Thanks for your answer too, I didn't know that persistent connection is not 
closed after ending script.
But I don't agree that such behaviour as I describe is normal. As I mentioned 
pconnect generate new thread in each new running script.
BUT THIS IS THE SAME SCRIPT! So as said in documentation 
pconnect should REUSE old connection , BUT DON'T generate
new connection. In practice - pconnet don't close any connection at all, but 
don't reuse previous connection and
generate new.
Is this also correct behaviour ?


[2004-04-22 01:54:05] il...@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

Persistent connections remain active until the Apache is 
shutdown. This is expected behavior. 


[2004-04-21 22:02:35] moreau at myrealbox dot com

Yes, significantly.
Each script is successfully ended , so apache returns in 
normal state ( minimal threads and process - as pointed in config ) after long 
timeout ( when pages aren't requested ). But MySQL has many threads and no one 
of threads never die.


[2004-04-21 19:19:51] gschlossna...@php.net

mysql extension will create one connection per database 
connect string per PHP interpreter context, i.e. one per 
Apache thread or child.  Is the number of connections 
you are seeing exceeding your Apache thread count?





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

https://bugs.php.net/bug.php?id=28098


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


Req #49618 [Com]: spl_autoload_register destroys __autoload hook

2011-07-07 Thread staff at pro-unreal dot de
Edit report at https://bugs.php.net/bug.php?id=49618edit=1

 ID: 49618
 Comment by: staff at pro-unreal dot de
 Reported by:jost dot boekemeier at googlemail dot com
 Summary:spl_autoload_register destroys __autoload hook
 Status: Open
 Type:   Feature/Change Request
 Package:SPL related
 Operating System:   *
 PHP Version:5.2.11
 Block user comment: N
 Private report: N

 New Comment:

How about that (php 5.3):

?php
spl_autload_register(function($class) {
if (function_exists('__autoload') 
__autoload($class);
})


Previous Comments:

[2009-11-19 11:22:34] col...@php.net

There is no way to fix this in PHP.

__autoload in itself is not deprecated, but it is not a good idea to use it as 
part of a library, for obvious reasons. However, if you know your code will 
only have one autoload function, using __autoload will be just fine.

To me it seems that the library writers that still use __autoload are at fault 
here.


[2009-09-23 08:53:11] jost dot boekemeier at googlemail dot com

Right. In particular: 

?php // pjb library
function autoload_pjb($x) {echo pjb ; return false;}
spl_autoload_register(autoload_pjb);
if(function_exists(__autoload)) spl_autoload_register(__autoload);
?
?php // joomla library
function __autoload($x) {echo joomla ; return false;}
?

?php // application
require(pjb.php);
require(joomla.php);
@new Foo();
?

Please see the link posted with the bug report for all the details.


However, I think neither the user nor joomla nor I have to invent strange 
workarounds for bugs in the php implementation. Any new introduced PHP feature 
must be compatible with earlier PHP features, unless the earlier features have 
been 
deprecated and a clear migration path exists.

The old __autoload is neither deprecated nor is spl_autoload_register 
compatible with 
it. Whoever wrote it and the comment This is because 
spl_autoload_register() will 
effectively replace the engine cache fo the __autoload function by either 
spl_autoload()  or spl_autoload_call().   wrote a bug.


 Thus, calling spl_autoload_register() replaces __autoload()

If spl_autoload_register is intended to replace the old __autoload machinery, 
the old 
__autoload should have been deprecated and a clear migration path should have 
been given to those using it.


[2009-09-23 07:23:07] sjo...@php.net

So the problem occurs with:

include('spl_autoload_register.php'); // uses spl_autoload_register
include('autoload.php'); // defines __autoload


[2009-09-22 17:39:32] jost dot boekemeier at googlemail dot com

 if (function_exists(__autoload)) spl_autoload_register(__ autoload)

Doesn't work. In line 7 __autoload is not yet defined.

Note that every line in the given example comes from a separate include()d php 
library.

This is a link-time problem which only php can resolve: it must save a legacy 
__autoload handler before creating the spl_autoload stack and call the legacy 
autoload after all other registered spl_autoload hooks.


[2009-09-22 17:26:38] sjo...@php.net

If two or more of the libraries use __autoload, it won't work, and there is 
nothing anybody can do about it.

If all of the libraries use spl_autoload_register, it works as it should.

If one of the libraries uses __autoload and others use spl_autoload_register, 
it is the task of the library that uses spl_autoload_register to register 
__autoload as well, like this:

if (function_exists(__autoload)) spl_autoload_register(__autoload);




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

https://bugs.php.net/bug.php?id=49618


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


Bug #55156 [Opn-Csd]: ReflectionClass::getDocComment() returns comment even though the class has none

2011-07-07 Thread felipe
Edit report at https://bugs.php.net/bug.php?id=55156edit=1

 ID: 55156
 Updated by: fel...@php.net
 Reported by:schmittjoh at gmail dot com
 Summary:ReflectionClass::getDocComment() returns comment
 even though the class has none
-Status: Open
+Status: Closed
 Type:   Bug
 Package:Reflection related
 Operating System:   Ubuntu 10.04
 PHP Version:5.3.6
-Assigned To:
+Assigned To:felipe
 Block user comment: N
 Private report: N

 New Comment:

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

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:

[2011-07-07 06:50:20] schmittjoh at gmail dot com

Note that this only happens if the class that ReflectionClass represents has no 
doc comment itself.


[2011-07-07 06:46:11] schmittjoh at gmail dot com

Description:

In some cases, the ReflectionClass::getDocComment() method returns a doc 
comment that belongs to another class than the one the ReflectionClass 
represents.

I haven't been able to reproduce in a isolated script, but instead I have added 
a failing unit test to Doctrine's unit test suite, see 
https://github.com/schmittjoh/common/commit/2d77264758ddd9658791b4284a9492a38bb1b049

You can run this test, by performing the following steps:

git clone http://github.com/schmittjoh/common.git
cd common
git checkout strangePhpError
phpunit

Test script:
---
see above







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


Bug #55145 [Opn-Fbk]: SOAP Unspecified Error

2011-07-07 Thread felipe
Edit report at https://bugs.php.net/bug.php?id=55145edit=1

 ID: 55145
 Updated by: fel...@php.net
 Reported by:robertoregan at eircom dot net
 Summary:SOAP Unspecified Error
-Status: Open
+Status: Feedback
 Type:   Bug
 Package:SOAP related
 Operating System:   RHEL 5 - 64 bit
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Please try using this snapshot:

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

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




Previous Comments:

[2011-07-06 06:33:57] robertoregan at eircom dot net

I forgot to mention that one of the main issues with this is that no exception 
is thrown or any error generated. The script simply dies.


[2011-07-06 06:31:43] robertoregan at eircom dot net

Description:

* The PHP version is actually 5.3.3 (Wasn't an option on drop-down)

I have an application that generates a large amount of soap connections to 
external web services. Any errors that occur are caught and handled. A few 
months back I upgraded to 5.3.3. Fairly quickly we started to experience a 
strange error where a SOAP connection would fail and the whole application 
would bomb out. No error message or anything. The only way we were able to get 
any data on what was happening was by registering a shutdown function and using 
error_get_last() which printed...

SoapClient::__doRequest(): connect() failed: Unspecified error

This error only occurred in maybe one in every 1000 soap requests but was 
detrimental for our application. 
We were forced to revert to a 5.2.x version which works fine.

Test script:
---
NA

Expected result:

NA

Actual result:
--
NA






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


Bug #55159 [Com]: fopen encodes ampersand '' as 'amp;'

2011-07-07 Thread lonnyk at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55159edit=1

 ID: 55159
 Comment by: lonnyk at gmail dot com
 Reported by:knappster_1 at hotmail dot com
 Summary:fopen encodes ampersand '' as 'amp;'
 Status: Open
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   Unix
 PHP Version:5.2.17
 Block user comment: N
 Private report: N

 New Comment:

I tested this on the 5.4 alpha and did not have this problem.

Here is my test script:
--
?php
error_reporting(E_ALL);
$fh = fopen(http://finance.yahoo.com/d/quotes.csv?
s=ABTf=sl1d1t1c1ohgvpnbaejkro=t, r);
while( !feof( $fh ) ){
echo fgets( $fh ) . \n;
}

Result:
-

ABT,53.54,7/7/2011,4:01pm,+0.26,53.49,53.60,53.24,4932482,53.28,Abbott 
Laboratori,N/A,N/A,2.87,44.59,54.24,18.56


Previous Comments:

[2011-07-07 16:32:41] knappster_1 at hotmail dot com

Description:

---
From manual page: http://www.php.net/function.fopen%23Parameters
---
The function used to return a csv file with a stock quote with PHP 5.2.9.  
However, now with 5.2.17 the function will replace '' with 'amp;' and it 
returns a csv file with just the text: Missing Format Variable.

It is easy to verify by using a malformed URL with '' in it and on the 
resulting html, view source and the error message will show 'amp;' where '' 
should be.  I have been unable to locate a workaround.  

Test script:
---
fopen(http://finance.yahoo.com/d/quotes.csv?s=ABTf=sl1d1t1c1ohgvpnbaejkro=t;,
 r);







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