#37730 [NoF-Bgs]: ImageTTFText ImageTTFBBox don't give accurate rectangle with angle

2009-03-18 Thread pajoye
 ID:   37730
 Updated by:   paj...@php.net
 Reported By:  marc dot lazzaro at st dot com
-Status:   No Feedback
+Status:   Bogus
 Bug Type: GD related
 Operating System: Win XP
 PHP Version:  5.1.4
 Assigned To:  pajoye
 New Comment:

see #43073.


Previous Comments:


[2007-09-28 00:53:31] lbayuk at pobox dot com

I am also finding that the TrueType font bounding box from ImageTTFBBox
and ImageTTFText seems to be wrong for text at angles other than 0
degrees.  Using PHP-5.2.4 on Linux.  My test script just draws the
returned bounding box for text and angles from 0 to 360. It shows that
for text at 0 degrees, the box encloses the text, but for all other
angles the box is off by different amounts. The worst case is for text
between 180 and 270 degrees, where the text is completely outside the
bounding box.

My test script is about 50 lines long, and I would be happy to post or
mail it but I'm not sure what is correct. Let's not abandon this bug
report until we figure out whether PHP is at fault or we are using it
wrong.



[2007-03-09 01:00:00] php-bugs at lists dot php dot net

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



[2007-03-01 12:00:29] hopka at hopka dot net

The font is standard Arial, the ttf i use is here:
http://hopka.net/Arial.ttf
However, i did try other fonts and i could not find any font that
produced different results.



[2007-03-01 11:45:44] paj...@php.net

so i don't see how i should rotate the offset to get the correct
bounding box.

Your script is wrong, you add 100 to each vertex, no matter where they
are. The result rectangle is then drawn at the wrong place.

About the offset pixel, what I asked here remains. Please provide the
font as well.



[2007-03-01 11:40:15] hopka at hopka dot net

If i draw the box that imagettftext (sorry, did not try that before)
returns without modifying the coordinates, it is almost (1 pixel off)
the same as the box i get after adding 100 to each coordinate of
imagettfbbox' return value. That would mean that either imagettftext is
also wrong (because it produces the same results as my script) or that
one would also have to modify the coordinates returned by imagettftext.
Also, the rectangles returned by both functions are already rotated, so
i don't see how i should rotate the offset to get the correct bounding
box.



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

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



#47673 [Fbk-Csd]: calling phpinfo() after tokenizer token_get_all() results in Segfault

2009-03-18 Thread serhii dot piddubchak at gmail dot com
 ID:   47673
 User updated by:  serhii dot piddubchak at gmail dot com
 Reported By:  serhii dot piddubchak at gmail dot com
-Status:   Feedback
+Status:   Closed
 Bug Type: Reproducible crash
 Operating System: FreeBSD 7.1
 PHP Version:  5.2.9
 New Comment:

Sorry, it works now after hosting support have rebuilded tokenizer
extension.


Previous Comments:


[2009-03-16 21:10:02] crrodriguez at opensuse dot org

Works for me, uing shared tokenizer and 5_2.



[2009-03-16 13:18:37] j...@php.net

For the record: It does not crash for me..



[2009-03-16 13:14:30] j...@php.net

What if you compile the tokenizer as normal (static) extension when you
compile PHP _yourself_ from sources, does it work then?



[2009-03-16 12:23:37] serhii dot piddubchak at gmail dot com

I've found this bug:
http://bugs.php.net/bug.php?id=38449
It is exactly the same problem, but the latest comment was Please
report FreeBSD bugs to FreeBSD peoples.. It doesn't look like a
solution since FreeBSD people won't fix this issue, It would be very
surprising if FreeBSD people must fix bugs in every piece of software
that is available for FreeBSD.
Moreover, previous bug was reported more then 2.5 years ago, PHP got a
5.2.8 version and FreeBSD got a 7.1 version. Looks for me that PHP
doesn't handle FreeBSD that well as Linux or Windows. If PHP compiles on
FreeBSD I expect it to work.



[2009-03-16 12:18:06] serhii dot piddubchak at gmail dot com

Description:

I'm getting a segmentation fault when trying to call phpinfo() after
token_get_all();
phpinfo() works fine if called before token_get_all();

Here is a short information about my system:
PHP Version 5.2.8
FreeBSD medved.hvosting.ua 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan
22 09:27:15 UTC 2009 r...@free.ds:/usr/obj/usr/src/sys/ISPSYSTEM amd64

Build Date  Feb 11 2009 15:20:04

Configure Command   './configure' '--with-layout=GNU'
'--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all'
'--enable-libxml' '--with-libxml-dir=/usr/local' '--with-pcre-regex=yes'
'--enable-reflection' '--program-prefix=' '--enable-fastcgi'
'--with-regex=php' '--with-zend-vm=CALL' '--enable-zend-multibyte'
'--disable-ipv6' '--prefix=/usr/local' '--mandir=/usr/local/man'
'--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd7.1'

Server API  CGI/FastCGI

Also there is no extensions like eAccelerator or ZendOptimizer.
Also I tried it on another FreeBSD 6.1 system, PHP5.2.8 configured as
apache module, the bug wasn't reproducible. So, it looks like
CGI/FastCGI or 64bit arch issue. Thanks in advance for any help.

I can't install PHP5.2.9 because I don't own the server, it is a
hosting account but I think it is reproducible in 5.2.9 since I didn't
notice something relevant fixed in Changelog for 5.2.9

Reproduce code:
---
?php

$tokens = token_get_all('/* comment */');
phpinfo();

?

Expected result:

Expected result is to see full output from phpinfo()

Actual result:
--
The first summary table of phpinfo is printed, then process crashes
with core dump.

Here is a backtrace:
This GDB was configured as amd64-marcel-freebsd...(no debugging
symbols found)...
Core was generated by `php-cgi'.
Program terminated with signal 11, Segmentation fault.

...

Reading symbols from /lib/libc.so.7...(no debugging symbols
found)...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /usr/local/lib/php/20060613/tokenizer.so...(no
debugging symbols found)...done.
Loaded symbols for /usr/local/lib/php/20060613/tokenizer.so

...

#0  0x00080121ee80 in ?? ()
[New Thread 0x8012b5180 (LWP 100392)]
(gdb) bt
#0  0x00080121ee80 in ?? ()
#1  0x005065e1 in zend_html_puts ()
#2  0x00494738 in php_print_info ()
#3  0x004948ae in zif_phpinfo ()
#4  0x005397d2 in zend_do_fcall_common_helper_SPEC ()
#5  0x0052ba87 in execute ()
#6  0x0050f177 in zend_execute_scripts ()
#7  0x004d2767 in php_execute_script ()
#8  0x00586773 in main ()





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



#40479 [Com]: zend_mm_heap corrupted

2009-03-18 Thread dwdkl dot pub at o2 dot pl
 ID:   40479
 Comment by:   dwdkl dot pub at o2 dot pl
 Reported By:  rrossi at maggioli dot it
 Status:   No Feedback
 Bug Type: Reproducible crash
 Operating System: Suse Linux 9.0
 PHP Version:  5.2.1
 New Comment:

Apache 2.0.x - problem does not occur.


Previous Comments:


[2009-03-13 10:57:32] dwdkl dot pub at o2 dot pl

I have this problem too.
Configuration: PHP 5.2.8 (Win32), Apache 2.2.11, MySQL 5.1.31, OS
WinXP.
I have this bug, when i try run phpmyadmin (all versions). Apache
restarted and i found in apache's logs the message zend_mm_heap
corrupted.

Sorry, my english is weak ;-)



[2009-03-12 08:32:43] john dot glazebrook at guava dot com

I'm surprised this isn't being talked about more. I see it
occasionally, and I am using Zend Framework. Why don't other people
using ZF see it?



[2009-03-12 07:52:07] laurynas dot butkus at gmail dot com

Soletan, thanks for advice but it seems that Suhosin is not 100%
solution. We are running Ubuntu Hardy (8.04 LTS) server, 32bit. Using
standard PHP 5.2.4 Apache2 module package which already includes Suhosin
patch. We still experience this bug...



[2009-03-06 14:22:25] soletan at toxa dot de

Ran into the same problem and read most of the posts in this report.
Well, I don't expect PHP developers to ever find this bug. Don't you get
annoyed by template-driven posts asking for information they can't use?

HERE COMES MY ADVICE: Reading hints on expecting a race condition lead
me to installing suhosin, which is an extension to PHP increasing its
integrity and security. Guess what, it helped me out of this trouble.
This is no ad, so I won't provide a link here. Just google the name ...

Maybe PHP developers shouldn't use templates requesting tons of
backtracks providing obviously useless information, but invest some time
in revising observers for the internal memory management of PHP as this
is obviously causing the trouble.



[2009-03-03 11:22:34] hakan dot koseoglu at gmail dot com

The same problem appears from a allegedly successful compilation op PHP
5.2.9 on RHEL5 64 bit using -m32 CFLAG so that the binaries are 32 bit.

The compilation appears to complete successfully:


Apache 2.0.59 compiled w/o any problems with the following configure
and it works fine.
./configure --prefix=/apps/apache2 --with-expat=builtin

PHP is configured with the following options:
./configure --with-apxs2=/apps/apache2/bin/apxs
--build=i386-redhat-linux --with-pic --with-gd --with-zlib
--with-config-file-path=/apps/apache2/conf --with-libdir=/lib/
--enable-debug

And after the successful run, make test was run with the following
errors:

[Tue Mar  3 11:16:22 2009]  Script: 
'/apps/source/php-5.2.9/run-tests.php'
---
/apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block
0x08c71270 status:
Beginning:  OK (allocated on
/apps/source/php-5.2.9/main/streams/plain_wrapper.c:144, 108 bytes)
Start:  OK
  End:  Overflown (magic=0x instead of 0xD03365E6)
At least 4 bytes overflown
---
[Tue Mar  3 11:16:22 2009]  Script: 
'/apps/source/php-5.2.9/run-test-info.php'
---
/apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block
0x097cdd80 status:
Beginning:  OK (allocated on
/apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes)
Start:  OK
  End:  Overflown (magic=0x instead of 0x512474AC)
At least 4 bytes overflown
---
[Tue Mar  3 11:16:22 2009]  Script: 
'/apps/source/php-5.2.9/run-test-info.php'
---
/apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block
0x097cdb78 status:
Beginning:  OK (allocated on
/apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes)
Start:  OK
  End:  Overflown (magic=0x instead of 0x512474AC)
At least 4 bytes overflown
---
[Tue Mar  3 11:16:22 2009]  Script: 
'/apps/source/php-5.2.9/run-test-info.php'
---
/apps/source/php-5.2.9/main/streams/plain_wrapper.c(421) : Block
0x097cd9ac status:
Beginning:  OK (allocated on
/apps/source/php-5.2.9/main/streams/plain_wrapper.c:160, 108 bytes)
Start:  OK
  End:  Overflown (magic=0x instead of 0x512474AC)
At least 4 bytes overflown
---
[Tue Mar  3 11:16:22 2009]  Script: 
'/apps/source/php-5.2.9/run-test-info.php'

#47673 [Csd-Bgs]: calling phpinfo() after tokenizer token_get_all() results in Segfault

2009-03-18 Thread scottmac
 ID:   47673
 Updated by:   scott...@php.net
 Reported By:  serhii dot piddubchak at gmail dot com
-Status:   Closed
+Status:   Bogus
 Bug Type: Reproducible crash
 Operating System: FreeBSD 7.1
 PHP Version:  5.2.9


Previous Comments:


[2009-03-18 09:18:07] serhii dot piddubchak at gmail dot com

Sorry, it works now after hosting support have rebuilded tokenizer
extension.



[2009-03-16 21:10:02] crrodriguez at opensuse dot org

Works for me, uing shared tokenizer and 5_2.



[2009-03-16 13:18:37] j...@php.net

For the record: It does not crash for me..



[2009-03-16 13:14:30] j...@php.net

What if you compile the tokenizer as normal (static) extension when you
compile PHP _yourself_ from sources, does it work then?



[2009-03-16 12:23:37] serhii dot piddubchak at gmail dot com

I've found this bug:
http://bugs.php.net/bug.php?id=38449
It is exactly the same problem, but the latest comment was Please
report FreeBSD bugs to FreeBSD peoples.. It doesn't look like a
solution since FreeBSD people won't fix this issue, It would be very
surprising if FreeBSD people must fix bugs in every piece of software
that is available for FreeBSD.
Moreover, previous bug was reported more then 2.5 years ago, PHP got a
5.2.8 version and FreeBSD got a 7.1 version. Looks for me that PHP
doesn't handle FreeBSD that well as Linux or Windows. If PHP compiles on
FreeBSD I expect it to work.



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

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



#47704 [NEW]: PHP crashes on some bad operations with string offsets

2009-03-18 Thread dmi...@php.net
From: dmi...@php.net
Operating system: *
PHP version:  5.3CVS-2009-03-18 (CVS)
PHP Bug Type: Scripting Engine problem
Bug description:  PHP crashes on some bad operations with string offsets

Description:

The following script chrashes

Reproduce code:
---
?php
$s = abd;
$s[0]-a += 4;
echo ok\n;
?

Expected result:

ok

Actual result:
--
Segmentation fault


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



#47704 [Opn-Asn]: PHP crashes on some bad operations with string offsets

2009-03-18 Thread dmitry
 ID:   47704
 Updated by:   dmi...@php.net
 Reported By:  dmi...@php.net
-Status:   Open
+Status:   Assigned
 Bug Type: Scripting Engine problem
 Operating System: *
 PHP Version:  5.3CVS-2009-03-18 (CVS)
-Assigned To:  
+Assigned To:  dmitry


Previous Comments:


[2009-03-18 10:39:32] dmi...@php.net

Description:

The following script chrashes

Reproduce code:
---
?php
$s = abd;
$s[0]-a += 4;
echo ok\n;
?

Expected result:

ok

Actual result:
--
Segmentation fault






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



#47684 [Fbk-Opn]: file_get_contents Content-Length problem

2009-03-18 Thread r-ser at yandex dot ru
 ID:   47684
 User updated by:  r-ser at yandex dot ru
 Reported By:  r-ser at yandex dot ru
-Status:   Feedback
+Status:   Open
 Bug Type: HTTP related
 Operating System: Linux 2.6.26
 PHP Version:  5.2.9
 New Comment:

/* this message is to change status.. =) */


Previous Comments:


[2009-03-17 19:55:06] r-ser at yandex dot ru

Add string
php_stream_context_set_option(context, http, method, (zval *)
GET);
Before 
stream = php_stream_url_wrap_http_ex(wrapper, new_path, mode, options,
opened_path, context, --redirect_max, 0 STREAMS_CC TSRMLS_CC);
In ext/standard/http_fopen_wrapper.c
Solved problem.



[2009-03-17 16:13:21] r-ser at yandex dot ru

I can write this code as
$header = Content-type: multipart/form-data,
boundary=$boundary\r\nContent-Length: .strlen($data).\r\n;
But nothing is changed.
Becouse error is in _second_ request.

cat test.php

?php
$context  = stream_context_create(array('http' =
array('method'='POST', 'header'= 'Content-Length: 0', 'content' =
'')));
echo file_get_contents('http://localhost/1.php', false, $context);
?


cat 1.php

?php
header(Location: 2.php);
?


cat 2.php

?
echo Method: .$_SERVER['REQUEST_METHOD'].\n;
$headers = getallheaders();
foreach ($headers as $header = $value) echo $header: $value\n;
?


Note: 1.php and 2.php are located in root of webserver

if change http://localhost/1.php to http://localhost/2.php you can see
differents headers..
This works with Apache web server.
But not work with some elses, like lighttpd/1.5.0 /* like in example in
first message */



[2009-03-17 11:00:15] j...@php.net

Why are you not passing the content-length in there..? I mean, isn't
that the obvious error..? :)



[2009-03-17 00:15:55] r-ser at yandex dot ru

Description:

When use file_get_contents + stream_context_create to post file to web
server and the page in web server return redirect to another page
(location field in answer), then file_get_contents requested
redirected page with POST header without Content-Length: field in
request and server response HTTP/1.0 411 Length Required.
I think, it's two ways to fix problem
1) 'method' must be change to GET in requests to redirect pages.
2) Add 'Content-Length: 0' to next POST redirect requests

Reproduce code:
---
$argv[1] = image.jpg;
$boundary = AaB03x1234567890;
$type = mime_content_type($argv[1]);
$data = --$boundary\r\nContent-Disposition: form-data;
name=\fileupload\; filename=\.basename($argv[1]).\
Content-Type: .$type. \r\nContent-Transfer-Encoding:
binary\r\n\r\n.file_get_contents($argv[1]).\r\n--$boundary--;
$header = Content-type: multipart/form-data, boundary=$boundary;
$context  = stream_context_create(array('http' =
array('method'='POST', 'header'= $header, 'content' = $data)));
$result = file_get_contents('http://load.imageshack.us', false,
$context);
echo $result;

Expected result:

failed to open stream: HTTP request failed! HTTP/1.0 411 Length
Required

Actual result:
--
Normal redirected page





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



#47705 [NEW]: Linux host.localhost 2.6.18-92.1.13.el5PAE #1 SMP Wed Sep 24 20:07:49 EDT 2008

2009-03-18 Thread plukyanchuk at rbc dot ru
From: plukyanchuk at rbc dot ru
Operating system: Linux
PHP version:  5.2.9
PHP Bug Type: Unknown/Other Function
Bug description:  Linux host.localhost 2.6.18-92.1.13.el5PAE #1 SMP Wed Sep 24 
20:07:49 EDT 2008 

Description:

strange work with compare long string


Reproduce code:
---
$s='9223372036854775810';
$w='9223372036854775809';
var_dump($w==$s);
var_dump($w===$s);


$s='01';
$w='02';
var_dump($s==$w);
var_dump($s===$w);


Expected result:

bool(false)
bool(false)
bool(false)
bool(false)

Actual result:
--
bool(true)
bool(false)
bool(false)
bool(false)

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



#47701 [Com]: print_r sends output when $return set to true if memory limit is reached

2009-03-18 Thread mmcnicklebugs at googlemail dot com
 ID:   47701
 Comment by:   mmcnicklebugs at googlemail dot com
 Reported By:  paul at paulmcgarry dot com
 Status:   Open
 Bug Type: Unknown/Other Function
 Operating System: Linux
 PHP Version:  5.2.9
 New Comment:

This has been fixed in CVS.

-- Martin McNickle


Previous Comments:


[2009-03-18 02:37:31] paul at paulmcgarry dot com

Description:

This relates to Bug #47020 which I believe has incorrectly set to 
bogus.

I have been using print_r() while processing $errcontext in an error 
handling function, ie one registered with set_error_handler()

It seems that when print_r() hits the memory limit it exposes my 
entire error context to the user.

print_r having a failure mode where it exposes potentially private 
data to the user is a security issue.

If it can't be fixed easily then it should be documented.












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



#47705 [Opn-Csd]: Linux host.localhost 2.6.18-92.1.13.el5PAE #1 SMP Wed Sep 24 20:07:49 EDT 2008

2009-03-18 Thread plukyanchuk at rbc dot ru
 ID:   47705
 User updated by:  plukyanchuk at rbc dot ru
 Reported By:  plukyanchuk at rbc dot ru
-Status:   Open
+Status:   Closed
 Bug Type: Unknown/Other Function
 Operating System: Linux
 PHP Version:  5.2.9
 New Comment:

not a bug
using 32bit system.
sorry


Previous Comments:


[2009-03-18 11:00:53] plukyanchuk at rbc dot ru

Description:

strange work with compare long string


Reproduce code:
---
$s='9223372036854775810';
$w='9223372036854775809';
var_dump($w==$s);
var_dump($w===$s);


$s='01';
$w='02';
var_dump($s==$w);
var_dump($s===$w);


Expected result:

bool(false)
bool(false)
bool(false)
bool(false)

Actual result:
--
bool(true)
bool(false)
bool(false)
bool(false)





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



#47701 [Opn]: print_r sends output when $return set to true if memory limit is reached

2009-03-18 Thread scottmac
 ID:   47701
 Updated by:   scott...@php.net
 Reported By:  paul at paulmcgarry dot com
 Status:   Open
 Bug Type: Unknown/Other Function
 Operating System: Linux
 PHP Version:  5.2.9
 New Comment:

Martin, where exactly is this fix?

I looked through the NEWS file and saw no entries.


Previous Comments:


[2009-03-18 11:06:36] mmcnicklebugs at googlemail dot com

This has been fixed in CVS.

-- Martin McNickle



[2009-03-18 02:37:31] paul at paulmcgarry dot com

Description:

This relates to Bug #47020 which I believe has incorrectly set to 
bogus.

I have been using print_r() while processing $errcontext in an error 
handling function, ie one registered with set_error_handler()

It seems that when print_r() hits the memory limit it exposes my 
entire error context to the user.

print_r having a failure mode where it exposes potentially private 
data to the user is a security issue.

If it can't be fixed easily then it should be documented.












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



#47705 [Csd-Bgs]: Linux host.localhost 2.6.18-92.1.13.el5PAE #1 SMP Wed Sep 24 20:07:49 EDT 2008

2009-03-18 Thread scottmac
 ID:   47705
 Updated by:   scott...@php.net
 Reported By:  plukyanchuk at rbc dot ru
-Status:   Closed
+Status:   Bogus
 Bug Type: Unknown/Other Function
 Operating System: Linux
 PHP Version:  5.2.9


Previous Comments:


[2009-03-18 11:41:34] plukyanchuk at rbc dot ru

not a bug
using 32bit system.
sorry



[2009-03-18 11:00:53] plukyanchuk at rbc dot ru

Description:

strange work with compare long string


Reproduce code:
---
$s='9223372036854775810';
$w='9223372036854775809';
var_dump($w==$s);
var_dump($w===$s);


$s='01';
$w='02';
var_dump($s==$w);
var_dump($s===$w);


Expected result:

bool(false)
bool(false)
bool(false)
bool(false)

Actual result:
--
bool(true)
bool(false)
bool(false)
bool(false)





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



#47630 [Com]: Unknown error using fsockopen() when with php-cgi through php cli

2009-03-18 Thread metala at metala dot org
 ID:   47630
 Comment by:   metala at metala dot org
 Reported By:  metala at metala dot org
 Status:   Feedback
 Bug Type: Network related
 Operating System: Windows XP SP2
 PHP Version:  5.2.9
 New Comment:

OK, problem solved.

The problem is in the Environment variables of the new process:
$env = array (
  'SCRIPT_FILENAME' = dirname(__FILE__).'\\child.php',
);
The missing variable is SystemRoot, which in my case is C:\WINDOWS.
So with the final settings:
$env = array (
  'SCRIPT_FILENAME' = dirname(__FILE__).'\\child.php',
  'SystemRoot' = $_ENV['SystemRoot'],
);

Network functionality is working perfectly.


Previous Comments:


[2009-03-16 21:04:30] metala at metala dot org

It failed again.

As I wrote in the description any network function fails.
What I did was:
$fp = fsockopen('google.com', 80, $errno, $errstr);
And the result was:
H:\test\phpphp parent.php
X-Powered-By: PHP/5.2.9-1
Content-type: text/html

br /
bWarning/b:  fsockopen() [a
href='function.fsockopen'function.fsockopen/a
]: php_network_getaddresses: getaddrinfo failed: No such host is
known.  in b
H:\test\php\child.php/b on line b2/bbr /
br /
bWarning/b:  fsockopen() [a
href='function.fsockopen'function.fsockopen/a
]: unable to connect to google.com:80 (php_network_getaddresses:
getaddrinfo fa
iled: No such host is known. ) in bH:\test\php\child.php/b on line
b2/b
br /
int(0)
string(69) php_network_getaddresses: getaddrinfo failed: No such host
is known.
 


When I run it in DOS:
SET SCRIPT_FILENAME=child.php
php-cgi

There appears to be no error.



[2009-03-16 20:37:06] metala at metala dot org

I disabled it before testing.

I have another Windows XP machine I can test on. Results coming soon.



[2009-03-16 19:53:11] johan...@php.net

Are you sure there is no firewall blocking?



[2009-03-12 13:01:43] metala at metala dot org

I tested it on another Windows XP machine and got the same result.

On the other hand with Debian GNU/Linux Squeeze I have no problems.



[2009-03-12 06:06:29] metala at metala dot org

Description:

The problem persists in 5.2.6, 5.2.9 and 5.2.9-1 in Windows only.
I have 2 script files, a parent.php and a child.php. The parent.php,
which is running in CLI, starts the child.php with php-cgi.exe.
fsockopen(), or any other network function fails.

Reproduce code:
---
parent.php
?php
$env = array (
  'SCRIPT_FILENAME' = dirname(__FILE__).'\\child.php',
);
$descriptorspec = array(
0 = array(pipe, r),
1 = array(pipe, w),
2 = array(pipe, w),
);
$procName = 'php-cgi';
$proc = proc_open($procName, $descriptorspec, $pipes, null, $env,
array('bypass_shell' = true));
$read = array($pipes[1]);
stream_select($read, $null = array(), $null = array(), 100);
echo fread($read[0], 1024);

child.php
?php
$fp = fsockopen('127.0.0.1', 445, $errno, $errstr);
var_dump($errno, $errstr);

Expected result:

I expect no error to be returned, because 445 is opened and even telnet
manages to connect.

Actual result:
--
H:\test\phpphp parent.php
X-Powered-By: PHP/5.2.9-1
Content-type: text/html

br /
bWarning/b:  fsockopen() [a
href='function.fsockopen'function.fsockopen/a
]: unable to connect to 127.0.0.1:445 (Unknown error) in
bH:\test\php\child.p
hp/b on line b2/bbr /
int(0)
string(0) 





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



#47689 [Fbk-Opn]: Apache crash with certain regular expression

2009-03-18 Thread vrana
 ID:   47689
 Updated by:   vr...@php.net
 Reported By:  vr...@php.net
-Status:   Feedback
+Status:   Open
 Bug Type: PCRE related
 Operating System: Windows
 PHP Version:  5.2.9-1
 New Comment:

I've uploaded the backtrace analysis to
http://www.vrana.cz/phpbug47689.zip


Previous Comments:


[2009-03-17 16:18:51] il...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to Open. Thank you for helping
us make PHP better.





[2009-03-17 13:57:03] vr...@php.net

Description:

Apache 2.2.11 crashes with PHP 5.2.9-1 on the following code. The same
script run from CLI executes without crash.

Reproduce code:
---
?php
$contents = '/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * License); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */';
// shortest possible example, omitting last line causes no crash

$contents = preg_replace('@/\\*(?:.|[\\n\\r])*?\\*/@', '', $contents);
?


Expected result:

Empty string in $contents.

Actual result:
--
Apache crash.





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



#47704 [Asn-Csd]: PHP crashes on some bad operations with string offsets

2009-03-18 Thread dmitry
 ID:   47704
 Updated by:   dmi...@php.net
 Reported By:  dmi...@php.net
-Status:   Assigned
+Status:   Closed
 Bug Type: Scripting Engine problem
 Operating System: *
 PHP Version:  5.3CVS-2009-03-18 (CVS)
 Assigned To:  dmitry
 New Comment:

This bug has been fixed in CVS.

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.




Previous Comments:


[2009-03-18 10:39:32] dmi...@php.net

Description:

The following script chrashes

Reproduce code:
---
?php
$s = abd;
$s[0]-a += 4;
echo ok\n;
?

Expected result:

ok

Actual result:
--
Segmentation fault






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



#47630 [Fbk-Csd]: Unknown error using fsockopen() when with php-cgi through php cli

2009-03-18 Thread metala at metala dot org
 ID:   47630
 User updated by:  metala at metala dot org
 Reported By:  metala at metala dot org
-Status:   Feedback
+Status:   Closed
 Bug Type: Network related
 Operating System: Windows XP SP2
 PHP Version:  5.2.9
 New Comment:

I don't think bug need a fix.
A note in the PHP manual, in proc_open() function or elsewhere, would
be OK.


Previous Comments:


[2009-03-18 12:50:34] metala at metala dot org

OK, problem solved.

The problem is in the Environment variables of the new process:
$env = array (
  'SCRIPT_FILENAME' = dirname(__FILE__).'\\child.php',
);
The missing variable is SystemRoot, which in my case is C:\WINDOWS.
So with the final settings:
$env = array (
  'SCRIPT_FILENAME' = dirname(__FILE__).'\\child.php',
  'SystemRoot' = $_ENV['SystemRoot'],
);

Network functionality is working perfectly.



[2009-03-16 21:04:30] metala at metala dot org

It failed again.

As I wrote in the description any network function fails.
What I did was:
$fp = fsockopen('google.com', 80, $errno, $errstr);
And the result was:
H:\test\phpphp parent.php
X-Powered-By: PHP/5.2.9-1
Content-type: text/html

br /
bWarning/b:  fsockopen() [a
href='function.fsockopen'function.fsockopen/a
]: php_network_getaddresses: getaddrinfo failed: No such host is
known.  in b
H:\test\php\child.php/b on line b2/bbr /
br /
bWarning/b:  fsockopen() [a
href='function.fsockopen'function.fsockopen/a
]: unable to connect to google.com:80 (php_network_getaddresses:
getaddrinfo fa
iled: No such host is known. ) in bH:\test\php\child.php/b on line
b2/b
br /
int(0)
string(69) php_network_getaddresses: getaddrinfo failed: No such host
is known.
 


When I run it in DOS:
SET SCRIPT_FILENAME=child.php
php-cgi

There appears to be no error.



[2009-03-16 20:37:06] metala at metala dot org

I disabled it before testing.

I have another Windows XP machine I can test on. Results coming soon.



[2009-03-16 19:53:11] johan...@php.net

Are you sure there is no firewall blocking?



[2009-03-12 13:01:43] metala at metala dot org

I tested it on another Windows XP machine and got the same result.

On the other hand with Debian GNU/Linux Squeeze I have no problems.



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

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



#40579 [Com]: $_SERVER['SERVER_PORT'] is invalid during apache redirect

2009-03-18 Thread peter at lvp-media dot com
 ID:   40579
 Comment by:   peter at lvp-media dot com
 Reported By:  ruslan dot kyrychuk at gmail dot com
 Status:   No Feedback
 Bug Type: *Web Server problem
 Operating System: Windows 2003
 PHP Version:  5.2.1
 New Comment:

This isn't a PHP-specific bug, it seems to be a problem within
mod_rewrite or Apache itself. I ran into this problem as well, but was
able to reproduce it with Perl and C scripts. For completeness, I'm
running PHP 5.3-dev on Linux with Apache 2.2.


Previous Comments:


[2009-01-26 15:06:38] tim at timloram dot me dot uk

I am experiencing this issue with exact same symptoms. Having used
mod_rewrite to redirect incoming requests to central gateway script,
$_SERVER['SERVER_PORT'] is always reading '80' even if my inital URL was
http://abc.com:86

Any ideas?



[2007-03-31 01:00:00] php-bugs at lists dot php dot net

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



[2007-03-23 11:10:51] tony2...@php.net

Works just fine here.

[SERVER_PORT]= string(4) 8887
[SCRIPT_NAME]= string(11) /index.html 



[2007-03-23 10:58:01] ruslan dot kyrychuk at gmail dot com

Reproduce code:
---
1. Configure Apache to use port 8080
2. Create .htaccess file:
Options +FollowSymLinks -Indexes
RewriteEngine on 

RewriteCond %{REQUEST_FILENAME}  (.+)\.html
RewriteRule ^(.+)$ test.php [QSA,L]
3. Create test.php file
?php
echo $_SERVER['SERVER_PORT'];
?
Run http://localhost:8080/test.html
Output: 80
Run http://localhost:8080/test.php
Output: 8080



[2007-03-01 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.



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

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




#47691 [Opn]: strtr bug. Not replace unicode values from array, in binary string.

2009-03-18 Thread strike at true-vision dot net
 ID:   47691
 User updated by:  strike at true-vision dot net
 Reported By:  strike at true-vision dot net
 Status:   Open
 Bug Type: Strings related
 Operating System: Fedora 8.0
 PHP Version:  6CVS-2009-03-17 (snap)
 New Comment:

Description:

Found bug in function strtr...
Not replace unicode values from array, in binary string.

Reproduce code:
---
?php
$a = (binary)AAA; // In my code I use file_get_contents
// function retrun binary value
$b = array(AAA = BBB);
$c = strtr($a, $b);
var_dump($a);
var_dump($b);
var_dump($c);
?

Expected result:

string(3) AAA 
array(1) { [uAAA]= unicode(3) BBB } 
string(3) BBB 

Actual result:
--
string(3) AAA 
array(1) { [uAAA]= unicode(3) BBB } 
string(3) AAA


Previous Comments:


[2009-03-17 14:22:09] strike at true-vision dot net

Description:

Found bug in function strtr...
Not replace unicode values from array, in binary string.

Reproduce code:
---
php
$a = (binary)AAA; // In my code I use file_get_contents
// function retrun finary value
$b = array(AAA = BBB);
$c = strtr($a, $b);
var_dump($a);
var_dump($b);
var_dump($c);
?

Expected result:

string(3) AAA 
array(1) { [uAAA]= unicode(3) BBB } 
string(3) AAA 

Actual result:
--
This is bug ?





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



#47687 [Opn-Fbk]: header(Location:) changing HTTP status in FCGI mode.

2009-03-18 Thread dmitry
 ID:   47687
 Updated by:   dmi...@php.net
 Reported By:  make dot fire at gmail dot com
-Status:   Open
+Status:   Feedback
 Bug Type: HTTP related
 Operating System: windows vista
 PHP Version:  5.3CVS-2009-03-17 (snap)
 New Comment:

The issue is probably caused by fastcgi module of web server. The PHP
sends proper headers, but it looks like fastcgi module sets status to
302 in case it finds Location header.


Previous Comments:


[2009-03-18 02:16:40] make dot fire at gmail dot com

I have tried using PHP 5.2 (5.2.10-dev), both VC6 x86 Non Thread Safe
(2009-Mar-18 00:00:00) and VC6 x86 Thread Safe (2009-Mar-18 00:00:00).
And have tried on windows vista and windows server 2008, got the same
results:

test code:

code1:
?php
header('HTTP/1.1 303 See Other');
header(Location: http://www.php.net/;);
exit;
?

code2:
?php
header('HTTP/1.1 303 See Other');
exit;
?

code3:
?php
header(Location: http://www.php.net/;);
exit;
?

the problem only occurs when run php in fastCGI mode(using
php-cgi.exe). 
code1 produce status line:
HTTP/1.1 302 Redirect  (expected: HTTP/1.1 303 See Other)
code2 porduct status line:
HTTP/1.1 303 See Other (expected: HTTP/1.1 303 See Other)
code3 product status line:
HTTP/1.1 302 Redirect  (expected: HTTP/1.1 302 Moved Temporarily)


when run php in ISAPI mode(using php5isapi.dll) or run php-cgi.exe
under commend line, both test codes will produce expected result.

it seems that something wrong with header(Location: ) with CGI
mode...



[2009-03-17 21:11:42] j...@php.net

Please try using this CVS snapshot:

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

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





[2009-03-17 14:30:46] make dot fire at gmail dot com

If change to ISAPI mode(use php5isapi.dll), the result is expected.

?php
header('HTTP/1.1 303 See Other');
header(Location: http://www.php.net/;);
exit;
?

will got status line:

HTTP/1.1 303 See Other



[2009-03-17 14:24:29] make dot fire at gmail dot com

when use this test code:
test.php:
?php
header(Location: http://www.php.net/;);
exit;
?

use broswer to visit http://localhost/test.php, the status line in
response is:

HTTP/1.1 302 Redirect

and use php-cgi.exe under commend line get:

D:\project\wwwphp-cgi ./test.php
Status: 302 Moved Temporarily
Location: http://www.php.net/
Content-type: text/html; charset=utf-8



[2009-03-17 14:13:28] make dot fire at gmail dot com

When run php-cgi.exe in command line, the result is expected:

D:\project\wwwphp-cgi ./test.php
Status: 303 See Other
Location: http://www.php.net/
Content-type: text/html; charset=utf-8


test.php:
?php
header('HTTP/1.1 303 See Other');
header(Location: http://www.php.net/;);
exit;
?

but visit same file throuth browser and webserver (use
http://localhost/test.php) will get 302 status code.



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

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



#45046 [Com]: Missing php5servlet.dll in PECL Collection package

2009-03-18 Thread ratheevikas at in dot com
 ID:   45046
 Comment by:   ratheevikas at in dot com
 Reported By:  steve at thebroughs dot com
 Status:   No Feedback
 Bug Type: Servlet related
 Operating System: Windows
 PHP Version:  5.2.6
 Assigned To:  pajoye
 New Comment:

The file is not there?


Previous Comments:


[2008-12-22 01:56:03] adsfadsf at dfadsfsdf dot com

Use this link to php_java.dll and phpsrvlt.dll (rename to
php5servlet.dll)
http://us3.php.net/get/pecl-5.2.5-Win32.zip/from/a/mirror



[2008-10-12 11:24:27] amit dot sanon at gmail dot com

The files are still missing from 
http://snaps.php.net/win32/php5.2-win32-latest.zip

Can someone please check and add the files php_java.dll and
php5servlet.dll to the pecl collection package



[2008-07-23 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.



[2008-07-15 06:32:32] paj...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi





[2008-07-15 00:04:45] j...@php.net

Pierre, fix.



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

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



#45046 [NoF-Bgs]: Missing php5servlet.dll in PECL Collection package

2009-03-18 Thread pajoye
 ID:   45046
 Updated by:   paj...@php.net
 Reported By:  steve at thebroughs dot com
-Status:   No Feedback
+Status:   Bogus
 Bug Type: Servlet related
 Operating System: Windows
 PHP Version:  5.2.6
 Assigned To:  pajoye
 New Comment:

Pecl is not php. Dll for pecl are being restored and there is already
bug reports about it.


Previous Comments:


[2009-03-18 14:45:02] ratheevikas at in dot com

The file is not there?



[2008-12-22 01:56:03] adsfadsf at dfadsfsdf dot com

Use this link to php_java.dll and phpsrvlt.dll (rename to
php5servlet.dll)
http://us3.php.net/get/pecl-5.2.5-Win32.zip/from/a/mirror



[2008-10-12 11:24:27] amit dot sanon at gmail dot com

The files are still missing from 
http://snaps.php.net/win32/php5.2-win32-latest.zip

Can someone please check and add the files php_java.dll and
php5servlet.dll to the pecl collection package



[2008-07-23 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.



[2008-07-15 06:32:32] paj...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi





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

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



#47620 [Opn-Bgs]: Weird static keyword behaviour

2009-03-18 Thread dmitry
 ID:   47620
 Updated by:   dmi...@php.net
 Reported By:  olemarkus dot with at student-media dot no
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: *
 PHP Version:  5.3CVS-2009-03-11 (snap)
-Assigned To:  
+Assigned To:  dmitry
 New Comment:

It's hard to explain, but it's expected.

In case the method getName() doesn't declared as static it's called
dynamically with current $this (A). This feature is kept for ages for
backward compatibility. You can even see strict warning:

Strict Standards: Non-static method B::getName() should not be called
statically, assuming $this from incompatible context in ...

In case you declare getName() static you'll get that you expect.


Previous Comments:


[2009-03-11 14:05:59] j...@php.net

And here is the code: 

?php
namespace A {
  class A  {
function __construct() {
  echo \C\C::getName() . \n;
}   
  }
}
namespace B {
  abstract class B {
static protected $name = '';
function getName() {
  return static::$name;
}
  } 
}
namespace C {
  class C extends \B\B {
static protected $name  = 'C';
  }
}
namespace {  
  echo \C\C::getName() . \n;
  $a = new \A\A();
}
?




[2009-03-11 07:18:24] olemarkus dot with at student-media dot no

Description:

When using static:: in a parent class to refer to the child class that
was called, the keyword is resolved to the caller class instead.


Reproduce code:
---
http://olemarkus.com/issue.txt

Expected result:

I expect both calls to \C\C::getName() to yield the same result:
C
C

Actual result:
--
The second one gives the following output:
C

Fatal error: Access to undeclared static property: A\A::$name in
issue.php on line 13






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



#47707 [NEW]: Swallowing a newline immediately following a closing tag is a poor idea

2009-03-18 Thread diepiapaopolopo at hotmail dot com
From: diepiapaopolopo at hotmail dot com
Operating system: All
PHP version:  5.2.9
PHP Bug Type: Feature/Change Request
Bug description:  Swallowing a newline immediately following a closing tag is a 
poor idea

Description:

Can the decision to call bugs #13954 and #21891 bogus be revisited,
please?

Reproduce code:
---
?
$quality=red;
?
pYour apple is more ?=$quality?
than mine./p

Expected result:

Your apple is more red than mine.

Actual result:
--
Your apple is more redthan mine.


Even though the behavior is documented
(http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php),
swallowing a newline that immediately follows a closing tag seems to be a
pretty poor idea, especially if the rationale is to pretty up formatting as
is alluded to (http://bugs.php.net/bug.php?id=13954) by jeroen.

Swallowing the newline is a surprise to anyone who encounters this bug
(yes, bug). Additionally, it can easily lead to malformatted output (see
sample included in this report). This malformatting can be difficult to
detect and the solution--adding a trailing space after every closing tag
(seriously???)--is a kludge through and through. This malformatting becomes
catastrophic if you're using PHP to generate input to another program, as
is the case for many of the people that have discussed the issue over the
years.

I realize this discussion has been going on for nearly a decade. I have to
assume this topic has become largely a political discussion, rather than a
problem solving one, because the problem hasn't been solved yet.

In the spirit of problem solving, several people have suggested adding a
setting to php.ini to re-enable the current behavior, which should
eliminate the need to refactor any scripts affected by the correction. In
any case, the current behavior should not be the default behavior.

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



#47708 [NEW]: explode() with empty delimiter

2009-03-18 Thread david at grudl dot com
From: david at grudl dot com
Operating system: 
PHP version:  5.3.0beta1
PHP Bug Type: Feature/Change Request
Bug description:  explode() with empty delimiter

Description:

Splitting a string into array of characters is not easy in PHP. It must be
done using preg_split (slow) and with a lot of parameters:

$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);

Feature request: allow function explode() to split string into characters.
Usage:

$chars = explode('', $str);

Rationale: there is counterpart function implode() which allows to use
empty separator:

$str = explode('', $chars); // works


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



#41966 [Com]: cannot set include_path in php.ini

2009-03-18 Thread jeffreyd dot davis at gmail dot com
 ID:   41966
 Comment by:   jeffreyd dot davis at gmail dot com
 Reported By:  badaboom003-asdf at yahoo dot com
 Status:   No Feedback
 Bug Type: PHP options/info functions
 Operating System: Ubuntu 7.04 Feisty Fawn AMD64
 PHP Version:  5.2.3
 New Comment:

This is still a problem with PHP 5.2.5. I am running on a Redhat
system.

I can confirm that I am loading the correct php.ini file but my changes
have no effect. My changes to the path show up in phpinfo(), But when I
run get_include_path() it always shows the default path instead of my
changes. Also, running set_include_path() no longer has any effect,
either. This latter problem is only true as of PHP 5.2.5


Previous Comments:


[2007-07-19 01:00:04] 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.



[2007-07-11 18:39:53] sni...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

And check phpinfo() output for what php.ini files was loaded and
actually in use.



[2007-07-11 17:28:07] badaboom003-asdf at yahoo dot com

Description:

Using:
Apache/2.2.3 (Ubuntu) PHP/5.2.1

can't change the include_path in php.ini. it always defaults to:
.:/usr/share/php:/usr/share/pear.

i know i'm using the correct php.ini file because it shows the correct
Configuration File Path in phpinfo().

i can successfully set other variables in php.ini such as memory_limit
or whatever, restart apache, and everything works fine. however, when i
try to change the include_path, nothing happens.

Reproduce code:
---
; UNIX: /path1:/path2
include_path =
.:/usr/share/php:/usr/share/php/PEAR:/var/somesite/app/classes
;
; Windows: \path1;\path2
;include_path = .;c:\php\includes

Expected result:

when i run phpinfo() i should see:

include_path .:/usr/share/php:/usr/share/pear:/var/somesite/app/classes

Actual result:
--
what i actually see is:

include_path .:/usr/share/php:/usr/share/pear





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



#47709 [NEW]: file_get_contents causes kernel to load ipv6-modul

2009-03-18 Thread jh2000 at root24 dot eu
From: jh2000 at root24 dot eu
Operating system: Debian
PHP version:  5.2.9
PHP Bug Type: Network related
Bug description:  file_get_contents causes kernel to load ipv6-modul

Description:

php with ipv6 support tris to get ipv6 ready even if it´s not needed.
I noticed this while updating the kernel to enable ipv6. I haven't done a
restart yet, so there is the ipv6 module for the new kernel and the old
kernel without ipv6 still running, php does something which causes the
system to try to load the module (failing, as expected since it´s the wrong
version)
There should just be an additional check whether php realy needs ipv6 for
the url or not. (the target url has no  entry and no ipv6 so far)

Reproduce code:
---
---
From manual page: function.file-get-contents
---
?
echo file_get_contents(http://somewhere.internet.tld/file;);
?


Expected result:

content of url

Actual result:
--
content of url (with ipv6-failure message in system-log)

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



#47710 [NEW]: Undefined Index when accessing results by array

2009-03-18 Thread grant at coolhandjob dot com
From: grant at coolhandjob dot com
Operating system: CentOS 5.2
PHP version:  6CVS-2009-03-18 (snap)
PHP Bug Type: PDO related
Bug description:  Undefined Index when accessing results by array

Description:

When trying to access the returned associative array I get a undefined
index error. Works as expected in PHP5.2.9 but have the same error with the
latest PHP5.3.

Reproduce code:
---
?php
try {
$pdo = new PDO(mysql:host=localhost;dbname=dbname;, dbuser,
password);
$pdo-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$sql = 'SELECT id, name FROM games ORDER BY name';

foreach ($pdo-query($sql) as $row) {
print $row['id'] .  - ;
print $row['name'] . br /;
}
print_r($row);
}
catch(PDOException $e) {
echo $e-getMessage();
}
?

Expected result:

2 - cod
1 - mohaa
Array ( [id] = 1 [0] = 1 [name] = mohaa [1] = mohaa )

Actual result:
--
Notice: Undefined index: id in /var/www/html/temp.php on line 9
-
Notice: Undefined index: name in /var/www/html/temp.php on line 10


Notice: Undefined index: id in /var/www/html/temp.php on line 9
-
Notice: Undefined index: name in /var/www/html/temp.php on line 10

Array ( [id] = 1 [0] = 1 [name] = mohaa [1] = mohaa ) 

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



#39312 [Com]: Cannot install PDO_OCI

2009-03-18 Thread esimard at mediagrif dot com
 ID:   39312
 Comment by:   esimard at mediagrif dot com
 Reported By:  andrew dot nagy at villanova dot edu
 Status:   Assigned
 Bug Type: PDO related
 Operating System: Linux
 PHP Version:  5.2.4
 Assigned To:  sixd
 New Comment:

I will assume that assigned means open since this bug doesn't seem
fixed yet.

I tried to install instantclient 10.2.0.4 with php-5.2.9 on RHEL5.

Tried it with the RPMs, didn't work, so I followed the instructions
that other people suggested here on the php.net instantclient page.

I installed the client in /usr/lib/oracle/10.2.0.4/client/
and the sdk in /usr/lib/oracle/10.2.0.4/client/sdk/include/

I tried to configure with the switches: 

--with-oci8=shared,instantclient,/usr/lib/oracle/10.2.0.4/client
--with-pdo-oci=instantclient,/usr/lib/oracle,10.2.0.4

without success, getting the error I'm too dumb to figure out where the
libraries are in your Instant Client install. 

After checking it out with strace, it seems that it tries to find the
files(headers and libs in the wrong directories). Also a import of
ld.so.conf with the libs dir did not help apparently.

So here is what I saw:

stat64(/usr/lib/oracle/include/oracle/10.2.0.4/client/oci.h,
0xbf7f53b8) = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
stat64(/usr/lib/oracle/lib/oracle/10.2.0.4/client/include/oci.h,
0xbf7f52e8) = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
stat64(/usr/lib/oracle/sdk/include/oci.h, 0xbf7f5218) = -1 ENOENT (No
such file or directory)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
stat64(/usr/lib/oracle/client/include/oci.h, 0xbf7f5148) = -1 ENOENT
(No such file or directory)

fixed temporary with ln -s /usr/lib/oracle/10.2.0.4/client/sdk/
/usr/lib/oracle/sdk

and

stat64(/usr/lib/oracle/lib/oracle/10.2.0.4/client/lib/libclntsh.so,
0xbfa5a858) = -1 ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
stat64(/usr/lib/oracle/client/lib/libclntsh.so, 0xbfa5a788) = -1
ENOENT (No such file or directory)
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
stat64(/usr/lib/oracle/libclntsh.so, 0xbfa5a6b8) = -1 ENOENT (No such
file or directory)

fixed temporary with ln -s /usr/lib/oracle/10.2.0.4/client/
/usr/lib/oracle/client

ln -s /usr/lib/oracle/10.2.0.4/client/
/usr/lib/oracle/10.2.0.4/client/lib

which is somewhat ghetto.

I would like to hear if you have a smoother way to do that. If this bug
is not considered open, can someone please email me if you have another
workaround if this comment gets deleted?


Previous Comments:


[2009-01-29 11:37:33] michael-ring at t-online dot de

I've found a problem under MacOSX, the extension'.so' is hardcoded in
the library detection for pdo_oci. This breaks under MacOSX because
libclntsh has '.dylib' extension instead of '.so'.

To solve this problem the following patch has to be applied. Shall I
open a new bug in order to get this included in upcomming php-Versions?

--- ext/pdo_oci/config.m4.orig  2009-01-28 23:31:07.0
+0100
+++ ext/pdo_oci/config.m4   2009-01-28 23:34:39.0 +0100
@@ -97,11 +97,11 @@
 else
   AC_MSG_ERROR([I'm too dumb to figure out where the include dir
is in your Instant Client install])
 fi
-if test -f
$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib/libclntsh.so
; then
+if test -f
$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib/libclntsh.$SHLIB_SUFFIX_NAME
; then
  
PDO_OCI_LIB_DIR=$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib
-elif test -f $PDO_OCI_IC_PREFIX/client/lib/libclntsh.so ; then
+elif test -f
$PDO_OCI_IC_PREFIX/client/lib/libclntsh.$SHLIB_SUFFIX_NAME ; then
   PDO_OCI_LIB_DIR=$PDO_OCI_IC_PREFIX/client/lib
-elif test -f $PDO_OCI_IC_PREFIX/libclntsh.so ; then
+elif test -f $PDO_OCI_IC_PREFIX/libclntsh.$SHLIB_SUFFIX_NAME ;
then
   PDO_OCI_LIB_DIR=$PDO_OCI_IC_PREFIX
 else
   AC_MSG_ERROR([I'm too dumb to figure out where the libraries are
in your Instant Client install])



[2009-01-20 11:42:00] fernando dot wendt at gmail dot com

More info about the lastest Oracle Instant Client under Linux: i'm
configuring a web server with Apache2.2.11, PHP5.2.8, and OIC11.1, and
PDO compile only works with this syntax:

./configure --with-oci8=shared,instantclient,/usr/lib/oracle
--with-pdo-oci=instantclient,/usr/lib/oracle,11.1

Presuming /usr/lib/oracle is your Instant Client base directory. The
great stuff is pass the version number at the command line, just as
Andrew point us.

Thanks a lot, and i do suggest you to put this detail on the 

#47689 [Opn]: Apache crash with certain regular expression

2009-03-18 Thread felipe
 ID:   47689
 Updated by:   fel...@php.net
 Reported By:  vr...@php.net
 Status:   Open
 Bug Type: PCRE related
 Operating System: Windows
 PHP Version:  5.2.9-1
 New Comment:

Hi Jakub,
please check the pcre.backtrack_limit and pcre.recursion_limit value.


Previous Comments:


[2009-03-18 13:10:15] vr...@php.net

I've uploaded the backtrace analysis to
http://www.vrana.cz/phpbug47689.zip



[2009-03-17 16:18:51] il...@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to Open. Thank you for helping
us make PHP better.





[2009-03-17 13:57:03] vr...@php.net

Description:

Apache 2.2.11 crashes with PHP 5.2.9-1 on the following code. The same
script run from CLI executes without crash.

Reproduce code:
---
?php
$contents = '/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * License); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */';
// shortest possible example, omitting last line causes no crash

$contents = preg_replace('@/\\*(?:.|[\\n\\r])*?\\*/@', '', $contents);
?


Expected result:

Empty string in $contents.

Actual result:
--
Apache crash.





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



#47701 [Opn-Bgs]: print_r sends output when $return set to true if memory limit is reached

2009-03-18 Thread felipe
 ID:   47701
 Updated by:   fel...@php.net
 Reported By:  paul at paulmcgarry dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Unknown/Other Function
 Operating System: Linux
 PHP Version:  5.2.9
 New Comment:

Please, see bug #47020.

Thanks.


Previous Comments:


[2009-03-18 12:08:43] scott...@php.net

Martin, where exactly is this fix?

I looked through the NEWS file and saw no entries.



[2009-03-18 11:06:36] mmcnicklebugs at googlemail dot com

This has been fixed in CVS.

-- Martin McNickle



[2009-03-18 02:37:31] paul at paulmcgarry dot com

Description:

This relates to Bug #47020 which I believe has incorrectly set to 
bogus.

I have been using print_r() while processing $errcontext in an error 
handling function, ie one registered with set_error_handler()

It seems that when print_r() hits the memory limit it exposes my 
entire error context to the user.

print_r having a failure mode where it exposes potentially private 
data to the user is a security issue.

If it can't be fixed easily then it should be documented.












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



#47665 [Opn-Bgs]: Closure as object property not directly executable

2009-03-18 Thread felipe
 ID:   47665
 Updated by:   fel...@php.net
 Reported By:  al dot james at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: Mac OS 10.5
 PHP Version:  5.3.0beta1
 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




Previous Comments:


[2009-03-15 19:22:46] al dot james at gmail dot com

Description:

If I assign an instance of the Closure object as a property of an 
object, I would expect to be able to execute that property as a 
function.

E.g.

$o = new stdClass;

$o-test = function(){
echo Executing function;  
};

I would expect this to work:

$o-test();

However, it does not. This does:

call_user_func($o-test);

The $o-test() syntax is more concise and in keeping with other 
languages with such features.

Reproduce code:
---
$o = new stdClass;

$o-test = function(){
echo Executing function;  
};

$o-test();

Expected result:

Executing function

Actual result:
--
PHP Fatal error:  Call to undefined method stdClass::test()





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



#47701 [Bgs]: print_r sends output when $return set to true if memory limit is reached

2009-03-18 Thread paul at paulmcgarry dot com
 ID:   47701
 User updated by:  paul at paulmcgarry dot com
 Reported By:  paul at paulmcgarry dot com
 Status:   Bogus
 Bug Type: Unknown/Other Function
 Operating System: Linux
 PHP Version:  5.2.9
 New Comment:

I mentioned 47020 in the first sentence of my initial report so 
referring me to it is hardly enlightening or productive and pretty 
much indicates you didn't bother to read the report at all (we are 
all no doubt time poor, so I understand the temptation!).

If this is bogus then please explain why.

Personally I cannot see how a failure mode that potentially exposes 
private data to the user can not be a genuine issue.


Previous Comments:


[2009-03-18 23:25:30] fel...@php.net

Please, see bug #47020.

Thanks.



[2009-03-18 12:08:43] scott...@php.net

Martin, where exactly is this fix?

I looked through the NEWS file and saw no entries.



[2009-03-18 11:06:36] mmcnicklebugs at googlemail dot com

This has been fixed in CVS.

-- Martin McNickle



[2009-03-18 02:37:31] paul at paulmcgarry dot com

Description:

This relates to Bug #47020 which I believe has incorrectly set to 
bogus.

I have been using print_r() while processing $errcontext in an error 
handling function, ie one registered with set_error_handler()

It seems that when print_r() hits the memory limit it exposes my 
entire error context to the user.

print_r having a failure mode where it exposes potentially private 
data to the user is a security issue.

If it can't be fixed easily then it should be documented.












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



#47712 [NEW]: Weird behavior under high load

2009-03-18 Thread ninzya at inbox dot lv
From: ninzya at inbox dot lv
Operating system: Windows XP
PHP version:  5.3.0beta1
PHP Bug Type: Scripting Engine problem
Bug description:  Weird behavior under high load

Description:

My configuration is Windows XP, Apache 2.2.11.0, PHP 5.3.0beta1, i'm
coding a framework and periodically i am performing stress tests with
apache's ab.exe. Once my framework has become quite processive (lotsa
operations involved in request processing), there started to appear
unexpected PHP errors/warning in a PHP error log file. For details see
reproduce code.

Reproduce code:
---
I was performing periodical stress testing by running ab.exe -c 30 -n
1 http:///myframeworkpage.php;. Sometimes PHP error log had been
empty after 1 req. stress testing, sometimes there were some
errors/warning (from 1 to 10 usually), and these errors were reporting
absurd things happening around. What i noticed, is that under heavy load
PHP manages to implicitly reset some variables to NULL value, or lose
value, which results in NULL value. Here are some of those errors and my
assumptions for those errors:

1) PHP Notice:  Use of undefined constant  - assumed '' in ... on line
25, where line #25 is $Db-connect( DB_PERS, DB_HOST, DB_PORT, DB_USER,
DB_PASS);. This is definately failure of PHP.

2) PHP Fatal error:  Call to a member function fetch() on a non-object in
... on line 611 where line #611 is while( $this-Db-fetch(
$this-query));. Please note that this cycle is contained within
__destruct() method (probably $Db property is being destroyed too soon when
php execution ends, but i assume it was also implicitly reset to NULL).
Definately failure of PHP.

3) PHP Warning:  mysql_pconnect(): Access denied for user
'root'@'localhost' (using password: NO) in ... on line 163 where line #163
is $link =mysql_pconnect( $host .':' .$port, $user, $pass, $clientFlags);
and $pass was never set to null or whatsoever (it contains string password,
always). I could assume here failure of MySQL server.

4) PHP Warning:  mysql_real_escape_string() expects parameter 2 to be
resource, null given in ... on line 483 where line #483 is return '\''
.mysql_real_escape_string( $data, $this-link) .'\''; and i'm 100% sure
$link property is not null at the step, when call to
mysql_real_escape_string is issued. I could assume here failure of MySQL
server, which resulted in resource to become null (which is also absurd).

5) PHP Warning:  Invalid argument supplied for foreach() in ... on line
414 where line #414 is foreach( $patchset as $blockId =$fill), and
$patchset is a reference to an array, always. Definately failure of PHP.

And much more such examples, which all say the same thing - i got the
null value, what the hell?.

I tried to make some stress testings for such code as:

class X {
  
  public function __construct() {

  }
  
  public function __destruct() {

  }
  
  public function test() {

  }
  
  public function Y() {
return new Y( $this);
  }
  
}

class Y {
  
  protected $X;
  
  public function __construct( $X) {
$this-X =$X;
  }
  
  public function __destruct() {
$this-X-test();
  }
  
}

$X =new X();
$Y =$X-Y();
$C =$X-Y();
$A =$X-Y();

but it executed successfully with no errors. I tried 30 requests,
everything went fine. But, when i stress-test my framework, PHP *sometimes*
acts weird. So far i failed to find compact reproduction code for this
issue.

Expected result:

I expect to see no warnings described in Reproduce code section.

Actual result:
--
PHP under heavy load implicitly resets random variable's value to NULL or
looses random variable's value, which results in assignment of NULL value
to that variable.

-- 
Edit bug report at http://bugs.php.net/?id=47712edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47712r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47712r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47712r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47712r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47712r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47712r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=47712r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=47712r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=47712r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=47712r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=47712r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=47712r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=47712r=submittedtwice
register_globals:

#47709 [Com]: file_get_contents causes kernel to load ipv6-modul

2009-03-18 Thread crrodriguez at opensuse dot org
 ID:   47709
 Comment by:   crrodriguez at opensuse dot org
 Reported By:  jh2000 at root24 dot eu
 Status:   Open
 Bug Type: Network related
 Operating System: Debian
 PHP Version:  5.2.9
 New Comment:

PHP does not load kernel modules, it is the OS that does that.


Previous Comments:


[2009-03-18 20:13:53] jh2000 at root24 dot eu

Description:

php with ipv6 support tris to get ipv6 ready even if it´s not needed.
I noticed this while updating the kernel to enable ipv6. I haven't done
a restart yet, so there is the ipv6 module for the new kernel and the
old kernel without ipv6 still running, php does something which causes
the system to try to load the module (failing, as expected since it´s
the wrong version)
There should just be an additional check whether php realy needs ipv6
for the url or not. (the target url has no  entry and no ipv6 so
far)

Reproduce code:
---
---
From manual page: function.file-get-contents
---
?
echo file_get_contents(http://somewhere.internet.tld/file;);
?


Expected result:

content of url

Actual result:
--
content of url (with ipv6-failure message in system-log)





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



#47712 [Opn-Fbk]: Weird behavior under high load

2009-03-18 Thread scottmac
 ID:   47712
 Updated by:   scott...@php.net
 Reported By:  ninzya at inbox dot lv
-Status:   Open
+Status:   Feedback
 Bug Type: Scripting Engine problem
 Operating System: Windows XP
 PHP Version:  5.3.0beta1
 New Comment:

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

A proper reproducing script starts with ?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.

We need an actual reproduce script we can use, I took your small script
and ran it under 5.3.0 without issue.

I'm guessing our errors probably all stem from the same issue, if step
1 or 3 happen then 2 and 4 would be expected due to a lack of database
connection.


Previous Comments:


[2009-03-19 00:02:49] ninzya at inbox dot lv

Description:

My configuration is Windows XP, Apache 2.2.11.0, PHP 5.3.0beta1, i'm
coding a framework and periodically i am performing stress tests with
apache's ab.exe. Once my framework has become quite processive (lotsa
operations involved in request processing), there started to appear
unexpected PHP errors/warning in a PHP error log file. For details see
reproduce code.

Reproduce code:
---
I was performing periodical stress testing by running ab.exe -c 30 -n
1 http:///myframeworkpage.php;. Sometimes PHP error log had been
empty after 1 req. stress testing, sometimes there were some
errors/warning (from 1 to 10 usually), and these errors were reporting
absurd things happening around. What i noticed, is that under heavy load
PHP manages to implicitly reset some variables to NULL value, or lose
value, which results in NULL value. Here are some of those errors and
my assumptions for those errors:

1) PHP Notice:  Use of undefined constant  - assumed '' in ... on line
25, where line #25 is $Db-connect( DB_PERS, DB_HOST, DB_PORT,
DB_USER, DB_PASS);. This is definately failure of PHP.

2) PHP Fatal error:  Call to a member function fetch() on a non-object
in ... on line 611 where line #611 is while( $this-Db-fetch(
$this-query));. Please note that this cycle is contained within
__destruct() method (probably $Db property is being destroyed too soon
when php execution ends, but i assume it was also implicitly reset to
NULL). Definately failure of PHP.

3) PHP Warning:  mysql_pconnect(): Access denied for user
'root'@'localhost' (using password: NO) in ... on line 163 where line
#163 is $link =mysql_pconnect( $host .':' .$port, $user, $pass,
$clientFlags); and $pass was never set to null or whatsoever (it
contains string password, always). I could assume here failure of MySQL
server.

4) PHP Warning:  mysql_real_escape_string() expects parameter 2 to be
resource, null given in ... on line 483 where line #483 is return '\''
.mysql_real_escape_string( $data, $this-link) .'\''; and i'm 100% sure
$link property is not null at the step, when call to
mysql_real_escape_string is issued. I could assume here failure of MySQL
server, which resulted in resource to become null (which is also
absurd).

5) PHP Warning:  Invalid argument supplied for foreach() in ... on
line 414 where line #414 is foreach( $patchset as $blockId =$fill),
and $patchset is a reference to an array, always. Definately failure of
PHP.

And much more such examples, which all say the same thing - i got the
null value, what the hell?.

I tried to make some stress testings for such code as:

class X {
  
  public function __construct() {

  }
  
  public function __destruct() {

  }
  
  public function test() {

  }
  
  public function Y() {
return new Y( $this);
  }
  
}

class Y {
  
  protected $X;
  
  public function __construct( $X) {
$this-X =$X;
  }
  
  public function __destruct() {
$this-X-test();
  }
  
}

$X =new X();
$Y =$X-Y();
$C =$X-Y();
$A =$X-Y();

but it executed successfully with no errors. I tried 30 requests,
everything went fine. But, when i stress-test my framework, PHP
*sometimes* acts weird. So far i failed to find compact reproduction
code for this issue.

Expected result:

I expect to see no warnings described in Reproduce code section.

Actual result:
--
PHP under heavy load implicitly resets random variable's value to NULL
or looses random variable's value, which results in assignment of NULL
value to that variable.





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



#47638 [Fbk-Opn]: Random fatal error while using callback through array_udiff_assoc

2009-03-18 Thread luke at cywh dot com
 ID:   47638
 User updated by:  luke at cywh dot com
 Reported By:  luke at cywh dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: Linux, Mac OS X
 PHP Version:  5.2.9
 New Comment:

I'm having problems with my MacBook, so I can't get that working on
that 
(I had installed a seperate install of Apache 2 and PHP separate from 
the OS, and I get an error regarding libpng with the php5 module, which

is preventing me from stoping/starting the service).

I was, however, able to produce the same exact error on my development

machine, but this time I had used array('XC', 'greaterthan') instead of

'XC::greaterthan'.

This is a live server with a bunch of websites (cpanel install). Is 
there anyway to do this without interring with the rest of the server?

Perhaps start the apache instance on a different port?

Seems to always happen randomly... has happened twice today during 
development.


Previous Comments:


[2009-03-15 12:22:57] j...@php.net

Run single Apache child in gdb, then you can backtrace and dump 
variables once this happens. Or run the same in CLI. And I hope 
you're NOT using some threaded MPM with Apache? (I'm guessing you're 
using Apache2 of course since you didn't bother telling that 
either..)



[2009-03-13 14:10:28] luke at cywh dot com

Is there any way to log what happens when I reproduce it? It's really 
difficult to get it to occur.



[2009-03-13 01:03:50] fel...@php.net

I can't reproduce it.



[2009-03-12 17:02:10] luke at cywh dot com

Description:

When making a callback through array_udiff_assoc to a static function 
this fatal error is produced, but randomly:

Fatal error: Non-static method (null)::(null)() cannot be called 
statically in /opt/local/apache2/htdocs/site/cc.php on line 12

This error only occurs about 1/3 of the time or less, and usually 
seems to happen right after saving a file. At first I thought it was 
an eAccelerator issue as I could product this error almost every time 
after re-saving the file (with or without changes), but I was also 
able to reproduce this on my MacBook which I had installed the 5.2 
branch on without any cache engines.

On a stock PHP installation with no extras it is mighty difficult to 
reproduce this error. I was able to make it occur several times if I 
refreshed the page 5-20 times after saving.

In the callback I'm referencing the function as a string: 
XC::greaterthan. I *think* using array('XC', 'greaterthan') corrects

the problem, but I am unsure as this error seems to occur completely 
at random, and I have yet to have a 100% solid way of reproducing it.

The code below is the best way I was able to reproduce the occurrence.

Reproduce code:
---
class XC {
static public function greaterthan($value1, $value2) {
return $value1  $value2;
}
}

class test {
function tester($num1, $num2) {
var_dump(array_intersect(
array_keys(
array_udiff_assoc(array('if' = $num1), 
array('if' = $num2),
'XC::greaterthan')
), array('if')
));
}
}

$t = new test();

for($i=0; $i10; $i++) {
$num1 = mt_rand(1, 100);
$num2 = mt_rand(1, 100);
$t-tester($num1, $num2);
}

Expected result:

No fatal error, just var dumps.

Actual result:
--
Fatal error: Non-static method (null)::(null)() cannot be called 
statically in /opt/local/apache2/htdocs/site/cc.php on line 12

(Which points to the array_udiff_assoc function)





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



#15373 [Com]: mail() not working, no error with invalid SMTP or email address

2009-03-18 Thread rmsadik dot ece at gmail dot com
 ID:   15373
 Comment by:   rmsadik dot ece at gmail dot com
 Reported By:  alonso at admintek dot net
 Status:   No Feedback
 Bug Type: Mail related
 Operating System: win2000
 PHP Version:  4.2.1
 Assigned To:  mfischer
 New Comment:

i have problem sending email using mail(). it was working couple of
weeks before but now on its not working ...i dont know whats the problem
and here is the code

if ($db_result) {

echo Successful;
$to = $email;
$from = msa...@gmail.com;
$subject = Password Request From;
$message = PLEASE DO NOT REPLY TO THIS EMAIL\n\n;
$message .= unless others can read your email.\n\n\n;
$message .= Password: .$password;
$headers = From: .$from;
// Set the name of the server for mail processing. This should 
be
handled at the server level but the following
// statement allows dynamic setting of the SMPT server for 
testing
purposes.
ini_set(SMTP,mail.sunet.com.au);
// Attempt to send the mail message.
//$db_result = mail($to,$subject,$message,$headers);

mail($to,$subject,$message,$headers);
}


Previous Comments:


[2008-11-25 17:17:49] jeff at jouster dot org

I have this same problem.

I have Windows Server 2003 SP2 IIS 6. PHP6-dev (also same problem with
5.4)

Port 25 is open and I can telnet to the server from my home machine
completely outside the network and manually send an email. So I know
that SMTP is not the problem and relaying is not a problem.

Here's my script:

?php
  $success = mail(m...@address.tld, subject, body, From: My Name
m...@address.tld);
echo ($success);
if ($success)
{
echo ( success!);
}
else
{
echo ( problem...);
}
?

When I run this test script I see:

1 success!

However I never get an email. I have php.ini set to log errors (have
also tried display errors) and there is never any errors logged or
displayed.

php.ini SMTP section:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = m...@address.tld

phpinfo() shows all of this information properly (only after I moved
the .ini file into the PHP install directory.

I have PHPRC environment variable set to PHP install directory and have
added same directory to my PATH env var.

Mail was successfully being sent until another issue caused me to
uninstall and reinstall the SMTP Service portion of IIS.

I see no solutions or cause to this problem in this thread. Any new
news? Original issue was posted 6 years ago... I can't believe this is
still cropping up for people.



[2008-07-10 15:47:04] phpseven at yahoo dot com

smtp server can't run. i tried my best to solve it but it can't send
the mail.



[2007-10-25 11:13:44] vvel3000 at yahoo dot co dot in

Warning: mail() [function.mail]: Failed to connect to mailserver at
mail.yourisp.com port 25, verify your SMTP and smtp_port setting
in php.ini or use ini_set() in C:\wamp\www\1.php on line 7
There was an error


why so you error



[2007-09-17 18:06:22] johan dot jv at gmail dot com

Hello guys, I see that you are having a lot of problem in sending email
and some of you might not even been receiving any emails.  Couple of
things that you might need to check before sending any emails.
1- Anti-virus (make sure that the antivirus is not blocking port 25)
2- Your firewall, make sure that your fire wall are not blocking port
25, also make sure that you have your SMTP anable to receive email, you
can set that up in your Firewall - Start - Settings- Network Connections
- Advanced tab - Setting - exceptions if you SMTP is not there, click
Add Port , on the name field you can write (SMTP TCP) and under port
type 25, then hit ok. do that again but with the same port and name but
with UDP.
3 - REALLY IMPORTANT. if you are behind a router , you ISP might
blocked  25 or you might just need to forward port 25 from your router
seetings portforward dot com/
4- If you want to know if your port 25 is open or available go to this
website canyouseeme dot org and on the field type 25 that will tell you
if your port is active.

---
Something else you might try.
-==if you don't know if your SMTP is working or install, Click Start -
Setting - Control panel - add  Remove program - on the left side click
Add / Remove Window Components - under the Windows Components Wizard you
can see Internet Information Services (IIS) Click that and then Click
DETAIL (it's on the right side) after that you can see a list of the IIS
Server, Click or Check the SMTP Server  __Window 

#47701 [Bgs-Opn]: print_r sends output when $return set to true if memory limit is reached

2009-03-18 Thread felipe
 ID:   47701
 Updated by:   fel...@php.net
 Reported By:  paul at paulmcgarry dot com
-Status:   Bogus
+Status:   Open
 Bug Type: Unknown/Other Function
 Operating System: Linux
 PHP Version:  5.2.9
 New Comment:

My mistake, Paul. Sorry.


Previous Comments:


[2009-03-18 23:37:10] paul at paulmcgarry dot com

I mentioned 47020 in the first sentence of my initial report so 
referring me to it is hardly enlightening or productive and pretty 
much indicates you didn't bother to read the report at all (we are 
all no doubt time poor, so I understand the temptation!).

If this is bogus then please explain why.

Personally I cannot see how a failure mode that potentially exposes 
private data to the user can not be a genuine issue.



[2009-03-18 23:25:30] fel...@php.net

Please, see bug #47020.

Thanks.



[2009-03-18 12:08:43] scott...@php.net

Martin, where exactly is this fix?

I looked through the NEWS file and saw no entries.



[2009-03-18 11:06:36] mmcnicklebugs at googlemail dot com

This has been fixed in CVS.

-- Martin McNickle



[2009-03-18 02:37:31] paul at paulmcgarry dot com

Description:

This relates to Bug #47020 which I believe has incorrectly set to 
bogus.

I have been using print_r() while processing $errcontext in an error 
handling function, ie one registered with set_error_handler()

It seems that when print_r() hits the memory limit it exposes my 
entire error context to the user.

print_r having a failure mode where it exposes potentially private 
data to the user is a security issue.

If it can't be fixed easily then it should be documented.












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



#47671 [Asn-Csd]: Cloning of SplObjectStorage is undefined

2009-03-18 Thread colder
 ID:   47671
 Updated by:   col...@php.net
 Reported By:  robert at typo3 dot org
-Status:   Assigned
+Status:   Closed
 Bug Type: SPL related
 Operating System: Mac OS 10.5.6
 PHP Version:  5.3.0beta1
 Assigned To:  colder
 New Comment:

This bug has been fixed in CVS.

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.




Previous Comments:


[2009-03-16 11:42:11] robert at typo3 dot org

Description:

After cloning an instance of SplObjectStorage the number of objects 
which can be retrieved with count() is very high and foreach() causes a

segfault.

Reproduce code:
---
class Foo {}

$storageA = new \SplObjectStorage();
$storageA-attach(new \Foo);
$storageA-attach(new \Foo);

echo (Count storage A:  . count($storageA));
foreach ($storageA as $object) {
echo ' x ';
}

$storageB = clone $storageA;
echo (Count storage B:  . count($storageB));
foreach ($storageB as $object) {
echo ' x ';
}


Expected result:

Count storage A: 2 x x Count storage B: 2 x x

Actual result:
--
Count storage A: 2 x x Count storage B: 1953394499





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



#47231 [Asn-Csd]: ArrayIterator offsetGet return incorrect error message

2009-03-18 Thread colder
 ID:   47231
 Updated by:   col...@php.net
 Reported By:  dsa1982 at gmail dot com
-Status:   Assigned
+Status:   Closed
 Bug Type: SPL related
 Operating System: linux
 PHP Version:  5.2.8
 Assigned To:  colder
 New Comment:

This bug has been fixed in CVS.

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.




Previous Comments:


[2009-01-28 16:30:50] dsa1982 at gmail dot com

Description:

method offsetGet return incorrect error message when offset float type

Reproduce code:
---
$array_object = new ArrayIterator(
   array(
 'first','second'
   )
);

$array_object-offsetGet((float)3);


Expected result:

Fatal error: Uncaught [Undefined offset: 4613937818241073152] in: Array
thrown in 






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



#46750 [Com]: allow additional, optional arguements to __get()

2009-03-18 Thread rarioj at gmail dot com
 ID:   46750
 Comment by:   rarioj at gmail dot com
 Reported By:  ms419 at freezone dot co dot uk
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Debian
 PHP Version:  5.2.6
 New Comment:

The function func_get_args() can be used to capture all passed
arguments to the called method or function, regardless of the minimum
number of parameters required.

So for example:

function __get($key) {
  if (!isset($this-container[$key])) {
return func_get_arg(1); // default to the second parameter index
  }
  return $this-container[$key];
}

somewhere within the class:

$this-__get('name', 'default value'); // the second argument will be
the second parameter to the magic method __get().


Previous Comments:


[2008-12-04 16:51:09] ms419 at freezone dot co dot uk

Description:

I wish it were possible to declare a __get() magic method with
additional, optional arguments, in addition to the required $name
argument.

It makes total sense for any __get() magic method declaration to
*require* exactly one argument, but it would be nice to allow
additional, optional arguments. Optional arguments would get default
values when __get() is called magically, but could be specified if
__get() is called manually.

This is already the case with the ArrayAccess interface (it makes sense
that there is a difference between SPL interfaces and PHP magic methods,
but optional arguments is a pattern I find useful with ArrayAccess and
would find useful with __get()...)

I successfully declare offsetGet() with additional, optional
arguments:

?php

class Foo implements ArrayAccess
{
  public function offsetGet($offset, array $options = array())
  {
[...]
  }

  [...]
}

Reproduce code:
---
?php

class Foo
{
  public function __get($name, array $options = array())
  {
  }
}

Actual result:
--
ket% php foo.php 

Fatal error: Method Foo::__get() must take exactly 1 argument in
/home/jablko/foo.php on line 7
ket% 





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