Bug #61124 [Asn->Csd]: Segmentation fault

2012-02-22 Thread scottmac
Edit report at https://bugs.php.net/bug.php?id=61124&edit=1

 ID: 61124
 Updated by: scott...@php.net
 Reported by:mangirdas at impresspages dot org
 Summary:Segmentation fault
-Status: Assigned
+Status: Closed
 Type:   Bug
 Package:OpenSSL related
 Operating System:   CentOS release 5.7 (Final)
 PHP Version:5.3.10
 Assigned To:scottmac
 Block user comment: N
 Private report: N

 New Comment:

Thanks, Fixed in 5.3, 5.4 and trunk.


Previous Comments:

[2012-02-23 01:26:43] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=323440
Log: Fixed bug #61124 (Crash when decoding an invalid base64 encoded string).


[2012-02-22 18:55:26] johan...@php.net

Scott said he'd look into it :-)


[2012-02-18 04:39:27] me at ktamura dot com

I think I know why. Basically, when the input data is malformed but $raw_input 
is set to false, we get a null pointer. Here is a suggested patch (Also 
available at https://gist.github.com/1857431)

Index: ext/openssl/openssl.c
===
--- ext/openssl/openssl.c   (revision 323312)
+++ ext/openssl/openssl.c   (working copy)
@@ -4801,6 +4801,11 @@
base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, 
&base64_str_len);
data_len = base64_str_len;
data = base64_str;
+
+if (data == NULL) {
+php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to decode the 
base64 input");
+RETURN_FALSE;
+}
}

keylen = EVP_CIPHER_key_length(cipher_type);


[2012-02-18 01:02:48] me at ktamura dot com

I feel that the real issue is that there is no input check on the first 
argument of 
openssl_decrypt. Looking at http://linux.die.net/man/3/evp_decryptupdate it is 
unclear what the expected behavior is if you feed invalid input into 
EVP_DecryptUpdate. Perhaps we can do input validation?


[2012-02-18 00:53:01] me at ktamura dot com

FYI...the said "hacky" patch of adding 16 as opposed to 1 bytes do not solve 
the 
problem for PHP 5.3.8 built with --enable-debug and --with-openssl 
--without-iconv 
options on snow leopard.




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

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


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


Bug #60536 [Opn]: Traits Segfault

2011-12-15 Thread scottmac
Edit report at https://bugs.php.net/bug.php?id=60536&edit=1

 ID: 60536
 Updated by: scott...@php.net
 Reported by:scott...@php.net
 Summary:Traits Segfault
 Status: Open
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   ubuntu 11.11
 PHP Version:5.4SVN-2011-12-15 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

backtrace:

#0  0x000100289c71 in zend_mm_check_ptr (heap=0x10100, ptr=0x100c4f730, 
silent=1, __zend_filename=0x1005476a8 "/Users/macvicar/dev/php-
src/branches/PHP_5_4/Zend/zend_vm_execute.h", __zend_lineno=10833, 
__zend_orig_filename=0x1005437a0 "/Users/macvicar/dev/php-
src/branches/PHP_5_4/Zend/zend_execute.h", __zend_orig_lineno=88) at 
zend_alloc.c:1380
#1  0x00010028c1ad in _zend_mm_free_int (heap=0x10100, p=0x100c4f730, 
__zend_filename=0x1005476a8 "/Users/macvicar/dev/php-
src/branches/PHP_5_4/Zend/zend_vm_execute.h", __zend_lineno=10833, 
__zend_orig_filename=0x1005437a0 "/Users/macvicar/dev/php-
src/branches/PHP_5_4/Zend/zend_execute.h", __zend_orig_lineno=88) at 
zend_alloc.c:2064
#2  0x00010028de9d in _efree (ptr=0x100c4f730, __zend_filename=0x1005476a8 
"/Users/macvicar/dev/php-src/branches/PHP_5_4/Zend/zend_vm_execute.h", 
__zend_lineno=10833, __zend_orig_filename=0x1005437a0 "/Users/macvicar/dev/php-
src/branches/PHP_5_4/Zend/zend_execute.h", __zend_orig_lineno=88) at 
zend_alloc.c:2436
#3  0x0001003742c8 in i_zval_ptr_dtor [inlined] () at 
/Users/macvicar/dev/php-src/branches/PHP_5_4/Zend/zend_execute.h:88
#4  0x0001003742c8 in ZEND_RETURN_SPEC_VAR_HANDLER 
(execute_data=0x1009802f8) 
at zend_execute.h:10833
#5  0x00010032a882 in execute (op_array=0x1009bad50) at 
zend_vm_execute.h:410
#6  0x0001002d733b in zend_execute_scripts (type=8, retval=0x0, 
file_count=3) 
at zend.c:1272
#7  0x000100219973 in php_execute_script (primary_file=0x7fff5fbff170) at 
main.c:2476


Previous Comments:

[2011-12-15 20:37:07] scott...@php.net

Description:

Following code crashes.



Test script:
---
x; }
}
class Z extends Y {
  function z() { return ++$this->x; }
}
$a = new Z();
$a->x();







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


Bug #60078 [Opn]: SIGSEGV in xhprof.c

2011-10-19 Thread scottmac
Edit report at https://bugs.php.net/bug.php?id=60078&edit=1

 ID: 60078
 Updated by: scott...@php.net
 Reported by:odou...@php.net
 Summary:SIGSEGV in xhprof.c
 Status: Open
 Type:   Bug
 Package:xhprof
 Operating System:   -
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Any more information about the OS or version of PHP? I have this working fine 
on 
OS X with PHP 5.3 and PHP 5.4.


Previous Comments:

[2011-10-18 13:22:27] odou...@php.net

More debugging : 

it seems bug is happening in get_cpu_frequency() that returned 0 on line 1335 
so 
array hp_globals.cpu_frequencies is 
wiped out by function clear_frequencies();


Just before, we have an error ("setaffinity: Invalid argument") thrown by line 
1228, so my guess is that function 
bind_to_cpu() failed, and at the end program is segfaulting because this has an 
impact on an array.


[2011-10-17 16:51:21] odou...@php.net

Description:

I'll try to be as precise as possible : 
This happens in a special case that can be reproduced 100%, but I cannot 
provide 
a test 
script (it is using 20MB of closed customer code).

This happens only whith xhprof_enable(). No problem is encountered when the 
module is just 
loaded with no call to xhprof_enable()


In latest clone from git (commit a6bae51236 for file xhprof.c) 
Program received signal SIGSEGV, Segmentation fault.
0x73575f49 in hp_mode_shared_endfn_cb (top=0xef0210, symbol=) 
at /usr/src/xhprof/extension/xhprof.c:1553


 bt
#0  hp_mode_shared_endfn_cb (top=0xef0210, symbol=) at 
/usr/src/xhprof/extension/xhprof.c:1553
#1  0x7357609e in hp_mode_hier_endfn_cb (entries=) 
at 
/usr/src/xhprof/extension/xhprof.c:1573
#2  0x73576e66 in hp_compile_file (file_handle=, 
type=8) at 
/usr/src/xhprof/extension/xhprof.c:1721
#3  0x007218a4 in ?? ()
#4  0x0071f294 in execute ()
#5  0x006faf7b in zend_execute_scripts ()
#6  0x006b573a in php_execute_script ()
#7  0x00772287 in main ()


Ok so problem is in the function "hp_mode_shared_endfn_cb"

Let's try to see what is the value of each variable here : 

 print /f hp_globals.cpu_frequencies[hp_globals.cur_cpu_id]
Cannot access memory at address 0x0


ok so problem is in this expression.

print hp_globals.cpu_frequencies
$8 = (double *) 0x0
(gdb) print /f hp_globals.cur_cpu_id
$9 = 0


Ok so I can see that hp_globals.cpu_frequencies equals NULL (right ?), and we 
attempt to 
access it as an array.
I read the source code quickly, and I can see that this array should be filled 
at some 
point. Seems it is not.


I made a dirty patch just to avoid the SIGSEGV, but all my timings in xhprof 
reports are 
inaccurate now.








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


Req #42060 [Fbk]: [PATCH] LDAP: Add pagedResults support and more

2011-08-23 Thread scottmac
Edit report at https://bugs.php.net/bug.php?id=42060&edit=1

 ID: 42060
 Updated by: scott...@php.net
 Reported by:iarenuno at eteo dot mondragon dot edu
 Summary:[PATCH] LDAP: Add pagedResults support and more
 Status: Feedback
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   *
 PHP Version:5CVS, 6CVS (2008-11-01)
 Assigned To:pajoye
 Block user comment: N
 Private report: N

 New Comment:

I fixed the tests, singular made more sense.


Previous Comments:

[2011-08-24 05:54:58] jeanseb at au-fil-du dot net

With Pierre we agreed to use singular form.

Could someone with karma fix this ?



https://bugs.php.net/bug.php?id=42060&edit=2#1288788479


[2011-08-23 15:55:40] peng1can at gmail dot com

Is this plural/singular typo the only thing holding this patch up?  Can't a 
choice just be made and move on?


[2011-06-02 11:48:21] sala...@php.net

The implemented functions are currently called 
"ldap_control_paged_result[_response]" but the tests try to use the plural 
"results" names.  Which are we going to keep, Scott is there any reason you 
chose 
the singular names?


[2011-05-19 19:42:24] scott...@php.net

I applied the rename patch and tidied up the code a little.

Anything else that needs done here?


[2011-05-19 19:41:24] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=311264
Log: Tidy up ldap paging code and rename the API as discussed in #42060




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

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


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


Bug #55185 [Opn->Bgs]: SplMaxHeap only once loopable

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

 ID: 55185
 Updated by: scott...@php.net
 Reported by:janwalther86 at gmail dot com
 Summary:SplMaxHeap only once loopable
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:SPL related
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

As it iterates over a heap it extracts the number from it.


Previous Comments:

[2011-07-12 04:19:23] janwalther86 at gmail dot com

Description:

I tried to loop through a SplMaxHeap object multiple times but it only loops 
once. As there is no option to reset or rewind the heap object I don't see a 
way to loop through it multiple times.

I noticed that $heap->count() decreases with every loop cycle, perhaps that is 
the reason.

Test script:
---
$heap = new SplMaxHeap();
$heap->insert(1);
$heap->insert(2);
foreach($heap as $number){
  echo $number."\n";
}
foreach($heap as $number){
  echo $number."\n";
}



Expected result:

2
1
2
1


Actual result:
--
2
1







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


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

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

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

 New Comment:

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


Previous Comments:

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

Description:

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

Test script:
---
__construct('sw://foo')
#1 {main}
  thrown in ….php on line 27






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


Bug #55131 [Opn->Bgs]: HUITA fix this bug

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

 ID: 55131
 Updated by: scott...@php.net
 Reported by:archon dot saratov at gmail dot com
 Summary:HUITA fix this bug
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:*Programming Data Structures
 Operating System:   Windows, FreeBSD
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

things returned by __get() are read only.

When you have

$c1->e1[] = 1;

It's really calling __get on e1 and then appending to the array the value 1. 
The 
latter can't happen since it's read only.


Previous Comments:

[2011-07-04 14:47:06] archon dot saratov at gmail dot com

Description:

bad working a __get method

Test script:
---

 array() );

public function __get($propertyName) {
if(isset($this->arr[$propertyName])) return $this->arr[$propertyName];
}

public function __set($propertyName, $value) {
if(isset($this->arr[$propertyName])) $this->arr[$propertyName] = $value;
}
}

$c1 = new C1();

var_dump($c1->e1);

$c1->e1[] = 1;

var_dump($c1->e1);

Expected result:

array
  empty

 array
  0 => int 1

Actual result:
--
array
  empty

( ! ) Notice: Indirect modification of overloaded property C1::$e1 has no 
effect 
in E:\Server\xampp\htdocs\test.php on line 18

 array
  empty


[2011-07-04 14:46:22] archon dot saratov at gmail dot com

Description:

bad working a __get method

Test script:
---

 array() );

public function __get($propertyName) {
if(isset($this->arr[$propertyName])) return $this->arr[$propertyName];
}

public function __set($propertyName, $value) {
if(isset($this->arr[$propertyName])) $this->arr[$propertyName] = $value;
}
}

$c1 = new C1();

var_dump($c1->e1);

$c1->e1[] = 1;

var_dump($c1->e1);

Expected result:

array
  empty

 array
  0 => int 1

Actual result:
--
array
  empty

( ! ) Notice: Indirect modification of overloaded property C1::$e1 has no 
effect 
in E:\Server\xampp\htdocs\test.php on line 18

 array
  empty


[2011-07-04 14:44:32] archon dot saratov at gmail dot com

Description:

bad working a __get method

Test script:
---

 array() );

public function __get($propertyName) {
if(isset($this->arr[$propertyName])) return $this->arr[$propertyName];
}

public function __set($propertyName, $value) {
if(isset($this->arr[$propertyName])) $this->arr[$propertyName] = $value;
}
}

$c1 = new C1();

var_dump($c1->e1);

$c1->e1[] = 1;

var_dump($c1->e1);

Expected result:

array
  empty

 array
  empty

Actual result:
--
array
  empty

( ! ) Notice: Indirect modification of overloaded property C1::$e1 has no 
effect 
in E:\Server\xampp\htdocs\test.php on line 18

 array
  0 => int 1






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


Bug #51636 [Fbk]: openssl_random_pseudo_bytes() painfully slow

2011-06-14 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=51636&edit=1

 ID: 51636
 Updated by: scott...@php.net
 Reported by:kaisellgren at gmail dot com
 Summary:openssl_random_pseudo_bytes() painfully slow
 Status: Feedback
 Type:   Bug
 Package:OpenSSL related
 Operating System:   Windows
 PHP Version:5.3.2
 Assigned To:pajoye
 Block user comment: N
 Private report: N

 New Comment:

It's a by reference parameter, not an option parameter.



I don't see the delay here on Win7 x64 with 5.3-dev


Previous Comments:

[2011-06-14 17:40:49] s...@php.net

On 5.3.6, Win7 x64, and it seems on other windows versions as well, the call to 
openssl_random_pseudo_bytes() still takes one second. Since apparently doing 
non-crypto-safe output is not possible on windows, it would be great to at 
least work on the delay for crypto-safe output.


[2011-06-14 11:18:05] paj...@php.net

Windows version?


[2011-06-14 10:22:18] s...@php.net

The changelog says this has been fixed in 5.3.4, but the function still takes 
1second to return on my machine (5.3.6). Note that the amount of bytes doesn't 
matter, and it's always around 1second.



$t = microtime(true);

openssl_random_pseudo_bytes(1, $strong);

var_dump(microtime(true) - $t, $strong);



Outputs:

float 1.0317049026489

boolean true


[2010-04-23 10:47:16] paj...@php.net

Under CLI or inside a web server?



Can you try under CLI please?


[2010-04-23 10:47:13] paj...@php.net

Under CLI or inside a web server?



Can you try under CLI please?




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

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


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


Bug #55011 [Opn->Bgs]: serialize a private attribute give it a bad length string

2011-06-08 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=55011&edit=1

 ID: 55011
 Updated by: scott...@php.net
 Reported by:nicolas dot giraud at maileva dot com
 Summary:serialize a private attribute give it a bad length
 string
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Class/Object related
 Operating System:   Windows XP SP3
 PHP Version:5.2.17
 Block user comment: N
 Private report: N

 New Comment:

The null bytes aren't shown by your browser, but they are there. You can 

unserialize() this value still and everything works.


Previous Comments:

[2011-06-08 18:35:57] nicolas dot giraud at maileva dot com

Description:

When you serialize an object with private or protected members, their length 
names are baddly calculated (maybe because of "These prepended values [which] 
have null bytes on either side" like the documentation says.

Anyway, this is a problem when you want to write your serialisation into a file 
and analyse it next.





Note that I'm not using PHP 5.2.17 but 5.2.3. But I haven't read a fix of this 
problem between both version.

Test script:
---
Here is an example:



class Ab {

private $_i = 0;

public function __construct() { $this->_i = 1; }

};



$oAB = new Ab();

$str = serialize($oAB);

echo $str;

Expected result:

O:2:"Ab":1:{s:4:"Ab_i";i:1;}

Actual result:
--
O:2:"Ab":1:{s:6:"Ab_i";i:1;}



Note the "s:6" instead of "s:4": this is why the unserialization from this 
string is impossible.






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


Bug #55010 [Opn->Dup]: POST requests send 4 extra bytes

2011-06-08 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=55010&edit=1

 ID: 55010
 Updated by: scott...@php.net
 Reported by:fidian at rumkin dot com
 Summary:POST requests send 4 extra bytes
-Status: Open
+Status: Duplicate
 Type:   Bug
 Package:HTTP related
 Operating System:   Ubuntu 11.04
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Was fixed in Bug #54137


Previous Comments:

[2011-06-08 18:01:21] fidian at rumkin dot com

Description:

PHP sends 4 extra bytes with a POST request when using stream_context_create 
and 

file_get_contents.  The extra bytes are CR LF CR LF.  The RFC does not state 
that 

CR LF CR LF should be after message-body.



This appears to be the same as Bug #43222: stream_context_create() bugs

Was there a test created to detect this problem?

Test script:
---
$url = 'http://localhost:8001/post';

$post = 'Sample';  // 6 bytes



$options = array(

'http' => array(

'method' => 'POST',

'protocol_version' => '1.1',

'content' => $post,

)

);



$urlParts = parse_url($url);



$headers = array();

$headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=utf-8';

$headers[] = 'Content-Length: ' . strlen($post);

$headers[] = 'Connection: close';  // Force servers to close the connection

$headers[] = 'Host: ' . $urlParts['host'];  // Required for HTTP 1.1

$options['http']['header'] = $headers;

$context = stream_context_create($options);

file_get_contents($url, false, $context);



Expected result:

The hexdump of the TCP traffic should appear like thus:





  50 4f 53 54 20 2f 70 6f  73 74 20 48 54 54 50 2f  |POST /post HTTP/|

0010  31 2e 31 0d 0a 43 6f 6e  74 65 6e 74 2d 54 79 70  |1.1..Content-Typ|

0020  65 3a 20 61 70 70 6c 69  63 61 74 69 6f 6e 2f 78  |e: application/x|

0030  2d 77 77 77 2d 66 6f 72  6d 2d 75 72 6c 65 6e 63  |-www-form-urlenc|

0040  6f 64 65 64 3b 20 63 68  61 72 73 65 74 3d 75 74  |oded; charset=ut|

0050  66 2d 38 0d 0a 43 6f 6e  74 65 6e 74 2d 4c 65 6e  |f-8..Content-Len|

0060  67 74 68 3a 20 36 0d 0a  43 6f 6e 6e 65 63 74 69  |gth: 6..Connecti|

0070  6f 6e 3a 20 63 6c 6f 73  65 0d 0a 48 6f 73 74 3a  |on: close..Host:|

0080  20 6c 6f 63 61 6c 68 6f  73 74 0d 0a 0d 0a 53 61  | localhostSa|

0090  6d 70 6c 65   |mple|

0094



Actual result:
--
This is what I actually capture as TCP traffic



  50 4f 53 54 20 2f 70 6f  73 74 20 48 54 54 50 2f  |POST /post HTTP/|

0010  31 2e 31 0d 0a 43 6f 6e  74 65 6e 74 2d 54 79 70  |1.1..Content-Typ|

0020  65 3a 20 61 70 70 6c 69  63 61 74 69 6f 6e 2f 78  |e: application/x|

0030  2d 77 77 77 2d 66 6f 72  6d 2d 75 72 6c 65 6e 63  |-www-form-urlenc|

0040  6f 64 65 64 3b 20 63 68  61 72 73 65 74 3d 75 74  |oded; charset=ut|

0050  66 2d 38 0d 0a 43 6f 6e  74 65 6e 74 2d 4c 65 6e  |f-8..Content-Len|

0060  67 74 68 3a 20 36 0d 0a  43 6f 6e 6e 65 63 74 69  |gth: 6..Connecti|

0070  6f 6e 3a 20 63 6c 6f 73  65 0d 0a 48 6f 73 74 3a  |on: close..Host:|

0080  20 6c 6f 63 61 6c 68 6f  73 74 0d 0a 0d 0a 53 61  | localhostSa|

0090  6d 70 6c 65 0d 0a 0d 0a   |mple|

0098








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


Bug #54918 [Asn->Csd]: browscap issues

2011-06-02 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54918&edit=1

 ID: 54918
 Updated by: scott...@php.net
 Reported by:neweracracker at gmail dot com
 Summary:browscap issues
-Status: Assigned
+Status: Closed
 Type:   Bug
 Package:Reproducible crash
 Operating System:   Windows 7
 PHP Version:5.3SVN-2011-05-24 (snap)
 Assigned To:cataphract
 Block user comment: N
 Private report: N

 New Comment:

This bug has been fixed in SVN.

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




Previous Comments:

[2011-06-03 02:42:09] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=311745
Log: Fix Bug #54918 - Crash when there is a failure to read the browscap file


[2011-06-02 22:26:42] neweracracker at gmail dot com

If I put the full path to lite_php_browscap.ini it no longer crashes.


[2011-06-02 22:22:57] neweracracker at gmail dot com

I've found why this happens. 



lite_php_browscap.ini is not in php.ini dir. I've also looked at php_errors.log 
and it says.



[02-Jun-2011 17:17:30] PHP Warning:  Cannot open 'lite_php_browscap.ini' for 
reading in Unknown on line 0



And after that it crashes with backtrace above.


[2011-06-01 16:09:57] neweracracker at gmail dot com

I can still reproduce the bug so I'll give details about configuration.



nginx.conf: http://pastebin.com/raw.php?i=iv0tvMjA

fastcgi_params: http://pastebin.com/raw.php?i=DZzhi3q2

php.ini: http://pastebin.com/raw.php?i=1betfPER

lite_php_browscap.ini: http://pastebin.com/raw.php?i=M0P1WUuk


[2011-06-01 12:59:13] cataphr...@php.net

I can't reproduce this.



I've tried 5.3.7-dev (after svn update) on Linux both as a CGI (non-TS) ran 
under mod_fcgid and Apache module (TS) with worker MPM. I tried setting the 
browscap ini directive on php.ini, on httpd.conf and on both simultaneously.



I've also tried the latest PHP 5.3.7-dev snapshot binaries (311680) on Windows, 
TS version, with fcgi and nginx. Setting browscap in php.ini worked as 
expected; no crash.



Could you please try the latest SVN and/or give more details on your setup?




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

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


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


Bug #54959 [Opn->Bgs]: Report One Bug For 08 And 09 Numbers In functions

2011-05-30 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54959&edit=1

 ID: 54959
 Updated by: scott...@php.net
 Reported by:farszabanan at yahoo dot com
 Summary:Report One Bug For 08 And 09 Numbers In functions
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:*General Issues
 Operating System:   All
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

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

Thank you for your interest in PHP.

Numbers beginning with a 0 are octal numbers.


Previous Comments:

[2011-05-31 07:32:52] farszabanan at yahoo dot com

Description:



Test script:
---


Expected result:



Actual result:
--







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


Req #42060 [Fbk]: [PATCH] LDAP: Add pagedResults support and more

2011-05-19 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=42060&edit=1

 ID: 42060
 Updated by: scott...@php.net
 Reported by:iarenuno at eteo dot mondragon dot edu
 Summary:[PATCH] LDAP: Add pagedResults support and more
 Status: Feedback
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   *
 PHP Version:5CVS, 6CVS (2008-11-01)
 Assigned To:pajoye
 Block user comment: N
 Private report: N

 New Comment:

I applied the rename patch and tidied up the code a little.



Anything else that needs done here?


Previous Comments:

[2011-05-19 19:41:24] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=311264
Log: Tidy up ldap paging code and rename the API as discussed in #42060


[2011-05-18 14:33:32] jeanseb at au-fil-du dot net

Can we expect to see ext-ldap-review.patch and api-rename.patch applied
on trunk and PHP5.4 branch ?



Thanks.


[2011-04-29 01:20:55] bryant dot david at gmail dot com

Hey guys,



I was not able to get the patches on this page to work, and paged
results was a must-have for our installation. I took 

jeanseb's patch (great work by the way - thank you!) and modified it. I
got it to work with the 5.3 build from 04/28/2011 

(over at http://snaps.php.net), but I am NOT a C developer by trade, so
I'm very open to *constructive* criticism. 



Here's a breakdown of how to get it installed (since I just had to go
through all this myself).



  - Obviously, you're going to be compiling PHP, so download the
appropriate version for your platform. (again, this patch 

is for 5.3)



  - Once you've got it compiling OK, install the (attached) patch,
paged-ldap-5.3, by doing the following (I'm on a Mac - 

you're on own if your in Windows, sorry): cd into ext/ldap in your PHP
source directory and run 



patch < /path/to/paged-ldap-5.3



  - Recompile



Assuming all went well, here's a modified version of jeanseb's script to
test it:









Good luck! And please, can we get paged LDAP support in some form or
another committed?


[2011-03-21 21:43:08] liveoutloud2day at gmail dot com

Can this be committed?  Please?  Pretty Please?



[2007-07-21 13:52 UTC] is a long time ago.  Can this get committed to
code that can become the next version of PHP?  



This just adds optional arguments to a call that you won't use unless
you know what you are doing.  It won't break anything else.  Can it
please get committed?



Is there anything I can do to help get it committed to the trunk?



Thanks!


[2010-12-10 14:43:07] paj...@php.net

It will be done when it is done. There is no real hurry. I was busy with
other branches than trunk, in case you missed the recent releases.




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

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


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


Bug #54723 [Opn->Csd]: getimagesize() incorrectly identifies files as ICO which aren't

2011-05-12 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54723&edit=1

 ID: 54723
 Updated by: scott...@php.net
 Reported by:don at smugmug dot com
 Summary:getimagesize() incorrectly identifies files as ICO
 which aren't
-Status: Open
+Status: Closed
 Type:   Bug
 Package:GetImageSize related
 Operating System:   CentOS 5.5
 PHP Version:5.3.6
-Assigned To:
+Assigned To:    scottmac
 Block user comment: N
 Private report: N

 New Comment:

This bug has been fixed in SVN.

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




Previous Comments:

[2011-05-13 07:06:51] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=310980
Log: Fixed bug #54723 - getimagesize() doesn't check the full ico
signature and misreports mpg files


[2011-05-12 19:13:40] don at smugmug dot com

Grr.  Instead of "are uploaded" that should read "are passed to
getimagesize()".  

Sorry about that.


[2011-05-12 19:12:45] don at smugmug dot com

Description:

When certain types of files are uploaded, including .MPGs,
getimagesize() 

incorrectly identifies them as ICOs with a MIME type of 

'image/vnd.microsoft.icon'. 



I suspect certain files probably have embedded icons in them, which is
what PHP is 

detecting and reporting, but the actual file isn't an ICO.



A ~500K sample file can be found here:  

http://www.smugmug.com/img/video/problem/php-getimagesize.mpg



Expected result:

I'd expect FALSE to return, since this isn't a picture and isn't a valid
type PHP 

knows about.

Actual result:
--
It returns this array:



array(0 => 45,

1 => 82,

2 => 17,

3 => 'width="45" height="82"',

'bits' = 65023,

'mime' = 'image/vnd.microsoft.icon');






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


Bug #54692 [Opn]: SQLite3::open() Return Value

2011-05-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54692&edit=1

 ID: 54692
 Updated by: scott...@php.net
 Reported by:ostico at gmail dot com
 Summary:SQLite3::open() Return Value
 Status: Open
 Type:   Bug
 Package:SQLite related
 Operating System:   Ubuntu Server
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

documentation is wrong, it returns void always. Exception on error


Previous Comments:

[2011-05-08 23:14:13] ostico at gmail dot com

Description:

As the Php Reference said:



SQLite3::open



Returns TRUE on success, FALSE on failure to open the database.



But this IS NOT TRUE.



It Returns NULL.

Test script:
---
class testSQLite3 extends SQLite3{

 

public function __construct(){

var_dump( $this->open('test.sqlite3') );

}

 

}

 

new testSQLite3();

Expected result:

//Create File 'test.sqlite3' And

//output

//bool(true)



Actual result:
--
//Create File 'test.sqlite3' And

//output

//NULL








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


Bug #54534 [Wfx]: Sessions fail when running PHP as multiple users

2011-04-20 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54534&edit=1

 ID: 54534
 Updated by: scott...@php.net
 Reported by:fredrik at dolda2000 dot com
 Summary:Sessions fail when running PHP as multiple users
 Status: Wont fix
 Type:   Bug
 Package:Session related
 Operating System:   Debian
 PHP Version:trunk-SVN-2011-04-14 (snap)
 Block user comment: N
 Private report: N

 New Comment:

Why would you have two sites on the same domain use the same session id
if they're 

considered different?



Call session_name() at the top of your code with a new value problem
solved.

Conversely call umask() and let your sessions be shared across users.



We can't change the format of the name easily since a PHP upgrade would
invalidate 

all the sessions that already exist.


Previous Comments:

[2011-04-20 03:19:16] fredrik at dolda2000 dot com

Are the precise filenames used an important part of this long-standing
behavior?


[2011-04-20 03:10:16] srina...@php.net

Honestly, I don't think this is a corner case. Also considering that the
submitter has filed the bug against trunk - should we not give a due
consideration to see if this can be addressed ?



IMO, closing a bug in haste will only cause couple of duplicate bugs to
be opened on the very same subject causing overhead for both the bug
submitter as well as for the evaluators. 



Moving it to a feedback status allows an opportunity for the bug
submitter to explain further providing a chance for every one to make a
right decision on a given issue. - Just my 2c thought..


[2011-04-19 08:31:04] ahar...@php.net

You can already handle this corner case with a custom session handler. I
don't think it's a common enough problem in practice to justify changing
the long-standing behaviour of PHP's default session handler.


[2011-04-14 16:29:48] fredrik at dolda2000 dot com

Description:

I'm running a website on which PHP runs as multiple different users on
the 

operating system, and I'm encountering problems when a visitor to the
site goes 

from a part where PHP runs as one user to another part where PHP runs as
another 

user.



Since PHP saves all sessions in one directory, it will attempt to load
the same 

session data as long as the visitor uses the same SID. When the session
was 

created by one user, it cannot be loaded by another. That is of course,
in 

itself, as it should.



I would argue, however, that the session filenames should contain the
UID of the 

user running PHP, so as to remove such conflicts. The resultant behavior
is 

probably reasonable, as the different users running PHP will most likely
not want 

to share session data with each other.







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


Bug #54513 [Opn->Fbk]: json_decode skips value where json_encode includes it

2011-04-12 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54513&edit=1

 ID: 54513
 Updated by: scott...@php.net
 Reported by:samu dot voutilainen at gmail dot com
 Summary:json_decode skips value where json_encode includes
 it
-Status: Open
+Status: Feedback
 Type:   Bug
 Package:JSON related
 Operating System:   Gentoo Linux x86
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

I need a reproduce script.



I just used:

a = 1;

$test->b = array();

$test->c = 'foo';



$json = json_encode($test);

var_dump($test);

var_dump(json_decode($json));



And I got the output:

object(stdClass)#1 (3) {

  ["a"]=>

  int(1)

  ["b"]=>

  array(0) {

  }

  ["c"]=>

  string(3) "foo"

}

object(stdClass)#2 (3) {

  ["a"]=>

  int(1)

  ["b"]=>

  array(0) {

  }

  ["c"]=>

  string(3) "foo"

}



Nothing missing there.


Previous Comments:

[2011-04-12 13:26:41] samu dot voutilainen at gmail dot com

Description:

If you have empty array inside object, json_encode() does encode the
value into JSON format, but when the data is decoded with json_decode(),
this empty JSON array is omitted from output.



Consider following structure:



 ["timetable"]=>

  object(pizzaonline\model\Timetable)#30 (9) {

["id"]=>

string(3) "774"

["timetable"]=>

array(0) {

}

["opening_hours"]=>

..



Corresponding json_encode would be:



"timetable":{

"id":"774",

"timetable":[



],

"opening_hours":[

  ..



This is all right, but I have a loop that removes this empty array with
unset(). So PHP structure from JSON is encoded is like:



["timetable"]=>

  object(pizzaonline\model\Timetable)#30 (8) {

["id"]=>

string(3) "774"

["opening_hours"]=>



But using json_encode() returns same result that is in snippet 2.



Just ask if any questions, I’ll do example script later...







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


Bug #54484 [Opn]: Empty string in json_decode doesn't set/reset json_last_error

2011-04-07 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54484&edit=1

 ID: 54484
 Updated by: scott...@php.net
 Reported by:wildcat at the-wildcat dot de
 Summary:Empty string in json_decode doesn't set/reset
 json_last_error
 Status: Open
 Type:   Bug
 Package:JSON related
 Operating System:   Linux
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

a string of length 0 skips the decoder and returns null. I'm thinking it
should 

set the error code to 4 so I'll fix it to do so.


Previous Comments:

[2011-04-07 14:24:55] wildcat at the-wildcat dot de

Description:

If you decode an empty json value, the internal error state doesn't
change.



Decode a valid json value and after that an empty value, the error state
is 0



Decode an invalid json value and after that an empty value, the error
state remains 4 (JSON_ERROR_SYNTAX) (I think it's the same for all error
states, but haven't actually tested)



I'm not quite sure whether an empty string is valid json and should
reset the error state to 0 or whether it is invalid json and should set
the error state to 4. Because a valid empty json string is '""' and not
''

Test script:
---


Expected result:

int(0)

int(0)

int(4)

int(0)





OR



int(0)

int(4)

int(4)

int(4)



Actual result:
--
int(0)

int(0)

int(4)

int(4)






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


Bug #54465 [Opn]: PHP crashes when passing large object to string functions

2011-04-05 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54465&edit=1

 ID: 54465
 Updated by: scott...@php.net
 Reported by:wwwound at gmail dot com
 Summary:PHP crashes when passing large object to string
 functions
 Status: Open
 Type:   Bug
 Package:Reproducible crash
 Operating System:   CentOs
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Isn't this just smashing the stack with a recursion 15603 levels deep?


Previous Comments:

[2011-04-04 16:04:07] wwwound at gmail dot com

Description:

PHP crashes when passing large object ( with __toString() method ) to
string functions (like substr(), urlencode() etc.)

Test script:
---
 obj = $obj;



// >5603 - segmentation fault or zend_mm_heap corrupted

// With some values can work as expected 

if ( $i < 15604) {  

$this -> rec(++$i, $this);

}



}



function __toString()

{

$this -> rec(0, $this);

return "Hello, world!";

}



}





$foo = new Foo();



substr($foo, 0, 5);



// This is ok

//echo "\nHello!\n";



// But if we begin using variables "zend_mm_heap corrupted" or
"Segmentation Fault"

$a = "a\n";

echo $a;



?>

Expected result:

Expecting correct appication exit

Actual result:
--
"Segmentation Fault" or "zend_mm_heap corrupted" errors






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


Req #54313 [Bgs]: What I thought before...

2011-03-21 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54313&edit=1

 ID: 54313
 Updated by: scott...@php.net
 Reported by:oop at dr dot com
 Summary:What I thought before...
 Status: Bogus
 Type:   Feature/Change Request
 Package:Unknown/Other Function
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

It's been this way for more than 10 years.



Also as a default, case sensitive makes more sense.


Previous Comments:

[2011-03-22 06:39:11] oop at dr dot com

This is counterintuitive. case_sensitive = true is definitely more
straightforward than case_insensitive = false.


[2011-03-22 06:33:58] oop at dr dot com

scottmac... you are right. shame...


[2011-03-22 06:20:12] oop at dr dot com

Changed Summary


[2011-03-22 06:04:44] oop at dr dot com

Changed Summary


[2011-03-19 11:53:16] scott...@php.net

the flag is case insensitive, not case sensitive




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

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


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


Req #54313 [Opn->Bgs]: Logical Flaw

2011-03-19 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54313&edit=1

 ID: 54313
 Updated by: scott...@php.net
 Reported by:oop at dr dot com
 Summary:Logical Flaw
-Status: Open
+Status: Bogus
 Type:   Feature/Change Request
 Package:Unknown/Other Function
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

the flag is case insensitive, not case sensitive


Previous Comments:

[2011-03-19 11:22:26] oop at dr dot com

Description:

---

>From manual page: http://www.php.net/function.define#Examples

---







If the case_sensitive is true, why GREETING and Greeting output the same
value (Hello you)? Then I put ,false just after "Hello world.", why
CONSTANT and Constant output the different values? Plus the echo
Constant; does not issue a notice.

Test script:
---




If the case_sensitive is true, why GREETING and Greeting output the same
value (Hello you)? Then I put ,false just after "Hello world.", why
CONSTANT and Constant output the different values? Plus the echo
Constant; does not issue a notice.

Expected result:



Actual result:
--







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


Bug #54288 [Opn->Bgs]: array_unshift and multidimension arrays bug

2011-03-17 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54288&edit=1

 ID: 54288
 Updated by: scott...@php.net
 Reported by:piotrekkr at piotrekkr dot info
 Summary:array_unshift and multidimension arrays bug
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Arrays related
 Operating System:   Ubuntu 10.10
 PHP Version:5.3SVN-2011-03-17 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

This isn't related to array_unshift, it happens to any function which
takes a 

parameter by reference. When you pass in a non existent value as a
reference PHP 

sets it to NULL. Else you'd have nothing to work with.



 Array

(

[0] => d

)



[1] => Array

(

[0] => 

)



[2] => Array

(

[0] => 

)



[3] => Array

(

[0] => 

)

)



Actual result:
--
PHP Warning:  array_unshift() expects parameter 1 to be array, null
given in /var/www/unshift_test.php on line 9

Array

(

[0] => Array

(

[0] => d

)



[1] => Array

(

[0] => 

)



[2] => Array

(

[0] => 

)



[3] => Array

(

[0] => 

)



[4] => 

)








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


Bug #54246 [Opn->Bgs]: DirectoryIterator object loses information once copied into a variable

2011-03-14 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54246&edit=1

 ID: 54246
 Updated by: scott...@php.net
 Reported by:ebert at woltlab dot com
 Summary:DirectoryIterator object loses information once
 copied into a variable
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Filesystem function related
 Operating System:   Windows 7 x64 (7601 w/ SP1)
 PHP Version:5.2.17
 Block user comment: N
 Private report: N

 New Comment:

It's a reference to a single object and as it goes through the loop it's
actually 

off the end making it empty.



If you want a copy use clone.


Previous Comments:

[2011-03-14 13:48:42] ebert at woltlab dot com

Description:

Storing all DirectoryIterator objects fetched previously with an
instance of DirectoryIterator within an array seems to make stored
objects to lose all data.



While methods like 'isDir()' work fine in first loop, they will always
fail within second loop.



---



C:\Program Files (x86)\PHP>php.exe -v

PHP 5.2.17 (cli) (built: Jan  6 2011 17:37:45)

Copyright (c) 1997-2010 The PHP Group

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



---



 Verzeichnis von C:\inetpub\wwwroot\di



14.03.2011  13:33  .

14.03.2011  13:33  ..

14.03.2011  13:41   427 di.php

14.03.2011  13:33  directory

14.03.2011  13:33 0 randomFile1.txt

14.03.2011  13:33 7.334 randomFile2.odt

14.03.2011  13:33 0 randomFile3.bmp

   4 Datei(en),  7.761 Bytes

   3 Verzeichnis(se), 23.774.224.384 Bytes frei

Test script:
---
isDot()) continue;

var_dump($obj);

if ($obj->isDir()) echo $obj->getFilename() . ' is a directory.';

else echo $obj->getFilename() . ' is a file';



$array[] = $obj;

}



echo '';



foreach ($array as $obj) {

var_dump($obj);

if ($obj->isDir()) echo $obj->getFilename() . ' is a directory.';

else echo $obj->getFilename() . ' is a file';

}

?>

Actual result:
--
object(DirectoryIterator)#1 (0) { } di.php is a file

object(DirectoryIterator)#1 (0) { } directory is a directory.

object(DirectoryIterator)#1 (0) { } randomFile1.txt is a file

object(DirectoryIterator)#1 (0) { } randomFile2.odt is a file

object(DirectoryIterator)#1 (0) { } randomFile3.bmp is a file

()

object(DirectoryIterator)#1 (0) { } is a directory.

object(DirectoryIterator)#1 (0) { } is a directory.

object(DirectoryIterator)#1 (0) { } is a directory.

object(DirectoryIterator)#1 (0) { } is a directory.

object(DirectoryIterator)#1 (0) { } is a directory.






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


Bug #54224 [Opn->Bgs]: Sum comutative operation fails with minus on front

2011-03-11 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54224&edit=1

 ID: 54224
 Updated by: scott...@php.net
 Reported by:philip dot almeida at freedomson dot com
 Summary:Sum comutative operation fails with minus on front
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Math related
 Operating System:   Linux
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Floating point values have a limited precision. Hence a value might 
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly 
printing it without any mathematical operations.

If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/

Thank you for your interest in PHP.




Previous Comments:

[2011-03-11 12:31:04] philip dot almeida at freedomson dot com

Description:

Making a comutative sum operation the result does not return the
expected value.

Test script:
---
echo -6.3536+5+1.3536;

= -2.22044604925E-16



echo -6.3537+5+1.3537

= 0

Expected result:

Always 0

Actual result:
--
-2.22044604925E-16






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


Bug #53182 [Wfx]: imap_search not valid with RFC 3501 (still stuck with IMAPv2)

2011-03-10 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53182&edit=1

 ID: 53182
 Updated by: scott...@php.net
 Reported by:william dot bessat at gmail dot com
 Summary:imap_search not valid with RFC 3501 (still stuck
 with IMAPv2)
 Status: Wont fix
 Type:   Bug
 Package:IMAP related
 Operating System:   All
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

PHP calls c-client with two functions, we don't have any control over
the syntax.



pgm = mail_criteria(search_criteria);



mail_search_full(imap_le_struct->imap_stream, (argc == 4 ? charset :
NIL), pgm, 

flags);


Previous Comments:

[2011-03-10 19:34:23] dkarp at zimbra dot com

The IMAP c-client certainly supports UID ranges.  This is a PHP issue.



   SEARCHSET *msgno;a set of message sequence numbers

   SEARCHSET *uid;  a set of unique identifiers



http://skull.piratehaven.org/~bapper/imap/mail_search_funcs.html


[2010-10-29 12:44:04] ahar...@php.net

PHP's IMAP extension simply calls c-client, so it's entirely dependent
on what that library supports in terms of search syntax. There's nothing
we can really do on the PHP side to help.


[2010-10-27 21:50:30] william dot bessat at gmail dot com

The search string I provided in the example is to fetch all messages
where UID>=200.



The goal of this search is to keep up to date a webmail, without
retriving the whole mailbox content each time you want to synchronize
it, since you can't rely on the SEEN/RECENT flag (if the mailbox is
opened with another software in the meantime). Using dates to achieve
that is a dirty workaround...



imap_search() is stuck with the RFC 1176 (august 1990 !!111!!!)



PS: Sorry for the triple-post, this is my first bug report and I didn't
know we can't edit things.


[2010-10-27 12:49:28] william dot bessat at gmail dot com

There's a typo in the imap_search(), the resource is, of course, before
the search string :)


[2010-10-27 12:45:58] william dot bessat at gmail dot com

Description:

Hi,



The imap_search function is not compliant with the RFC 3501.

We can not search messages using their UID.



Example : imap_search("UID 200:*, $link);



The output goes in the error_log with this message :



[27-Oct-2010 12:34:35] PHP Notice:  Unknown: Unknown search criterion:
UID (errflg=2) in Unknown on line 0



Imo, this functionnality should be implemented for building advanced
webmails.



This is not a real *bug*, but more a lack of functionnality.







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


Bug #54213 [Opn->Bgs]: intl support is broken (OS X)

2011-03-10 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54213&edit=1

 ID: 54213
 Updated by: scott...@php.net
 Reported by:atiware at gmx dot net
 Summary:intl support is broken (OS X)
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Compile Failure
 Operating System:   osx 10.6
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

OSX is broken here.



libxml forward declares UChar* so by including both libxml and intl you
get an 

error. We can't fix this, other than not including one or the other.


Previous Comments:

[2011-03-10 17:41:00] atiware at gmx dot net

Description:

On OS X is not possible to install php with intl support. both, the
internal and pecl versions are broken



i tried with php 5.3.3, php 5.3.5

icu version: 3.6 and 4.6



for the pecl bug see: http://pecl.php.net/bugs/bug.php?id=18656

Test script:
---
./configure --with-apxs2=/usr/local/apache/bin/apxs --enable-intl

make



Expected result:

compile with intl support

Actual result:
--
/bin/sh /Users/xy/install_2/packages-extracted/php/php-5.3.5/libtool
--silent --preserve-dup-deps --mode=compile gcc  -Imain/
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/main/
-DPHP_ATOM_INC
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/include
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/main
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/ext/date/lib
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/ext/ereg/regex
-I/usr/include/libxml2 -I/usr/local/icu/include
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/ext/sqlite3/libsqlite
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/TSRM
-I/Users/xy/install_2/packages-extracted/php/php-5.3.5/Zend 
-no-cpp-precomp  -I/usr/include -arch x86_64 -O2 -fvisibility=hidden  -c
main/internal_functions.c -o main/internal_functions.lo 

In file included from /usr/local/icu/include/unicode/utypes.h:36,

 from
/Users/xy/install_2/packages-extracted/php/php-5.3.5/ext/intl/grapheme/grapheme.h:21,

 from
/Users/xy/install_2/packages-extracted/php/php-5.3.5/ext/intl/php_intl.h:26,

 from main/internal_functions.c:41:

/usr/local/icu/include/unicode/umachine.h:328: error: redefinition of
typedef ‘UChar’

/usr/include/libxml2/libxml/encoding.h:41: error: previous declaration
of ‘UChar’ was here

make: *** [main/internal_functions.lo] Error 1

make: *** Waiting for unfinished jobs

ERROR: can't build php, custom builder exited with errorcode: 2






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


Req #54210 [Opn->Bgs]: provide a function to canonicalize timezone strings

2011-03-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54210&edit=1

 ID: 54210
 Updated by: scott...@php.net
 Reported by:giorgio dot liscio at email dot it
 Summary:provide a function to canonicalize timezone strings
-Status: Open
+Status: Bogus
 Type:   Feature/Change Request
 Package:Date/time related
 Operating System:   all
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

$tz = implode('/', array_map('ucfirst', explode('/', $tz)));



No need to add a new function for this, and if the timezone is set by
your app 

then you should probably store it in the correct format.


Previous Comments:

[2011-03-09 23:28:25] giorgio dot liscio at email dot it

Description:

hi, it is needed a function that converts "europe/rome" in
"Europe/Rome"



for example the intl module (ICU) of php 5.3 does not accept
"europe/rome" as timezone, but only "Europe/Rome", with uppercase first
letters



thank you







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


Req #54210 [Bgs]: provide a function to canonicalize timezone strings

2011-03-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54210&edit=1

 ID: 54210
 Updated by: scott...@php.net
 Reported by:giorgio dot liscio at email dot it
 Summary:provide a function to canonicalize timezone strings
 Status: Bogus
 Type:   Feature/Change Request
 Package:Date/time related
 Operating System:   all
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

$tz = implode('/', array_map('ucfirst', explode('/', $tz)));



No need to add a new function for this, and if the timezone is set by
your app 

then you should probably store it in the correct format.


Previous Comments:

[2011-03-10 07:16:21] scott...@php.net

$tz = implode('/', array_map('ucfirst', explode('/', $tz)));



No need to add a new function for this, and if the timezone is set by
your app 

then you should probably store it in the correct format.


[2011-03-09 23:28:25] giorgio dot liscio at email dot it

Description:

hi, it is needed a function that converts "europe/rome" in
"Europe/Rome"



for example the intl module (ICU) of php 5.3 does not accept
"europe/rome" as timezone, but only "Europe/Rome", with uppercase first
letters



thank you







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


Bug #54181 [Bgs]: MySQLi doesn't always reuse persistent link inside same script

2011-03-08 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54181&edit=1

 ID: 54181
 Updated by: scott...@php.net
 Reported by:carsten_sttgt at gmx dot de
 Summary:MySQLi doesn't always reuse persistent link inside
 same script
 Status: Bogus
 Type:   Bug
 Package:MySQLi related
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

The problem with using the same connection twice is that with unbuffered
results 

you can't run more than query at once. MySQLi only puts a connection up
for availability until after its done with it.



MySQL should behave the same but is probably affected by the new_link
parameter 

which returned the same connection if all the parameters matched. It
wasn't 

persistance just an optimization that caused more confusion than
anything else.


Previous Comments:

[2011-03-07 19:53:34] carsten_sttgt at gmx dot de

> This is working as expected, persistent connections are only

> re-used if they're no longer in use by another script.



OK, with "another Script" you also mean the same script. Just to
recapitulate:

| 



$con1 is already in use, so $con2 will results in a second connection.



If this is the expected behavior, why is this script:

|  true)

| );

| $con2 = new PDO(

| 'mysql:host=localhost',

| 'foo', '',

| array(PDO::ATTR_PERSISTENT => true)

| );

| ?>



or

| 



resulting in 1 connection? $con1 is already in use, but $con2 is using
the same connection as $1.


[2011-03-07 17:28:31] scott...@php.net

This doesn't have anything to do with persistent connections, with
mysql_connect() 

if you open a connection with the same parameters it won't return a new
link 

unless you set the 4th parameter to true.



This is working as expected, persistent connections are only re-used if
they're no 

longer in use by another script.


[2011-03-07 15:10:49] carsten_sttgt at gmx dot de

Description:

If I open an existing persistent link a second (or 3rd, ...) time inside
the same script, MySQLi is only reusing the existent link if I have
explicitly closed the link before. At the moment it's always creating a
new link.



With MySQL it's working as expected.



 

Test script:
---
thread_id);

$con2 = mysqli_connect('p:localhost', 'foo', '');

var_dump($con2->thread_id);

mysqli_close($con1);

mysqli_close($con2);



echo "---\n";



$con3 = mysqli_connect('p:localhost', 'bar', '');

var_dump($con3->thread_id);

mysqli_close($con3);

$con4 = mysqli_connect('p:localhost', 'bar', '');

var_dump($con4->thread_id);

mysqli_close($con4);



echo "===\n";



$con5 = mysql_pconnect('localhost', 'foo', '');

var_dump(mysql_thread_id($con5));

$con6 = mysql_pconnect('localhost', 'foo', '');

var_dump(mysql_thread_id($con6));

mysql_close($con5);

mysql_close($con6);



echo "---\n";



$con7 = mysql_pconnect('localhost', 'bar', '');

var_dump(mysql_thread_id($con7));

mysql_close($con7);

$con8 = mysql_pconnect('localhost', 'bar', '');

var_dump(mysql_thread_id($con8));

mysql_close($con8);



?>



Expected result:

int(1)

int(1)

---

int(2)

int(2)

===

int(3)

int(3)

---

int(4)

int(4)

Actual result:
--
int(1)

int(2)

---

int(3)

int(3)

===

int(4)

int(4)

---

int(5)

int(5)






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


Bug #54189 [Opn->Bgs]: foreach changes array values after iterating by reference followed by foreach

2011-03-08 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54189&edit=1

 ID: 54189
 Updated by: scott...@php.net
 Reported by:phazei at gmail dot com
 Summary:foreach changes array values after iterating by
 reference followed by foreach
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   RHEL 5.6
 PHP Version:5.2.17
 Block user comment: N
 Private report: N

 New Comment:

This is on the foreach manual page.



Between the two foreach loops, $value is a reference to the last entry
in the 

array.



When the second loop starts you then start assigning new values to
$value which 

reference the last element of the array.


Previous Comments:

[2011-03-08 08:11:41] phazei at gmail dot com

Description:

(I searched through the bug reports and found some foreach pointer
issues, but 

none related to this)



If I simply go through an array with a referenced value like so:

foreach ($array as &$value) {  }



And then go through it again, not referenced, like so:

foreach ($array as $value) {  }



Both times using the same variable $value, then during the second
foreach, the 

second to the last value is actually copied over the last value changing
the 

array.



If I simply use $value2 there is no issue.

Test script:
---
$array = array('a','b','c','d','e');

echo '1) '.print_r($array, true).'';

foreach ($array as &$value) {  }

echo '2) '.print_r($array, true).' 3) ';

foreach ($array as $key => $value) { echo "[$key] => $value "; }

echo ' 4) '.print_r($array, true).'';

Expected result:

1) Array ( [0] => a [1] => b [2] => c [3] => d [4] =>
e ) 

2) Array ( [0] => a [1] => b [2] => c [3] => d [4] =>
e ) 

3) [0] => a [1] => b [2] => c [3] => d [4] => e 

4) Array ( [0] => a [1] => b [2] => c [3] => d [4] =>
e ) 

Actual result:
--
1) Array ( [0] => a [1] => b [2] => c [3] => d [4] =>
e ) 

2) Array ( [0] => a [1] => b [2] => c [3] => d [4] =>
e ) 

3) [0] => a [1] => b [2] => c [3] => d [4] => d 

4) Array ( [0] => a [1] => b [2] => c [3] => d [4] =>
d ) 






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


Bug #54181 [Opn->Bgs]: MySQLi doesn't always reuse persistent link inside same script

2011-03-07 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54181&edit=1

 ID: 54181
 Updated by: scott...@php.net
 Reported by:carsten_sttgt at gmx dot de
 Summary:MySQLi doesn't always reuse persistent link inside
 same script
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:MySQLi related
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

This doesn't have anything to do with persistent connections, with
mysql_connect() 

if you open a connection with the same parameters it won't return a new
link 

unless you set the 4th parameter to true.



This is working as expected, persistent connections are only re-used if
they're no 

longer in use by another script.


Previous Comments:

[2011-03-07 15:10:49] carsten_sttgt at gmx dot de

Description:

If I open an existing persistent link a second (or 3rd, ...) time inside
the same script, MySQLi is only reusing the existent link if I have
explicitly closed the link before. At the moment it's always creating a
new link.



With MySQL it's working as expected.



 

Test script:
---
thread_id);

$con2 = mysqli_connect('p:localhost', 'foo', '');

var_dump($con2->thread_id);

mysqli_close($con1);

mysqli_close($con2);



echo "---\n";



$con3 = mysqli_connect('p:localhost', 'bar', '');

var_dump($con3->thread_id);

mysqli_close($con3);

$con4 = mysqli_connect('p:localhost', 'bar', '');

var_dump($con4->thread_id);

mysqli_close($con4);



echo "===\n";



$con5 = mysql_pconnect('localhost', 'foo', '');

var_dump(mysql_thread_id($con5));

$con6 = mysql_pconnect('localhost', 'foo', '');

var_dump(mysql_thread_id($con6));

mysql_close($con5);

mysql_close($con6);



echo "---\n";



$con7 = mysql_pconnect('localhost', 'bar', '');

var_dump(mysql_thread_id($con7));

mysql_close($con7);

$con8 = mysql_pconnect('localhost', 'bar', '');

var_dump(mysql_thread_id($con8));

mysql_close($con8);



?>



Expected result:

int(1)

int(1)

---

int(2)

int(2)

===

int(3)

int(3)

---

int(4)

int(4)

Actual result:
--
int(1)

int(2)

---

int(3)

int(3)

===

int(4)

int(4)

---

int(5)

int(5)






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


Req #54177 [Opn->Bgs]: php_check_syntax(), beloved and missed

2011-03-07 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54177&edit=1

 ID: 54177
 Updated by: scott...@php.net
 Reported by:epost at pomada dot se
 Summary:php_check_syntax(), beloved and missed
-Status: Open
+Status: Bogus
 Type:   Feature/Change Request
 Package:Scripting Engine problem
 Operating System:   all
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

It couldn't be implemented correctly so it was removed, the main problem
was it 

actually included files to test as it invoked them.


Previous Comments:

[2011-03-07 09:07:24] epost at pomada dot se

Description:

php_check_syntax() isn't supported anymore. Without knowing the reasons,
it's a 

valuable function as many CMS:es allows eval:ed statements.





---

>From manual page:
http://www.php.net/function.php-check-syntax#Changelog

---









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


Bug #54058 [Opn->Csd]: json_last_error() doesn't work properly with arrays/objects

2011-02-21 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54058&edit=1

 ID: 54058
 Updated by: scott...@php.net
 Reported by:slusarz at curecanti dot org
 Summary:json_last_error() doesn't work properly with
 arrays/objects
-Status: Open
+Status: Closed
 Type:   Bug
 Package:JSON related
 Operating System:   Linux
 PHP Version:5.3.5
-Assigned To:
+Assigned To:    scottmac
 Block user comment: N
 Private report: N

 New Comment:

This bug has been fixed in SVN.

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




Previous Comments:

[2011-02-21 09:09:04] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=308529
Log: Fix Bug #54058, invalid utf-8 doesn't set json_encode() in all
cases


[2011-02-21 07:05:47] slusarz at curecanti dot org

Description:

json_last_error() doesn't work properly in arrays/objects.  If an error
occurs when encoding a property/key, and it isn't the LAST property/key,
json_last_error() is reset to 0.



json_last_error() should report the last parsing error from the last
json_encode() call AS AN ENTIRETY, not the last internal encoding step
that takes place inside the function.

Test script:
---
$bad_utf8 = quoted_printable_decode('=B0');



json_encode($bad_utf8);

print "ERROR: " . json_last_error() . "\n";



$a = new stdclass;

$a->foo = quoted_printable_decode('=B0');

json_encode($a);

print "ERROR: " . json_last_error() . "\n";



$b = new stdclass;

$b->foo = $bad_utf8;

$b->bar = 1;

json_encode($b);

print "ERROR: " . json_last_error() . "\n";



$c = array(

'foo' => $bad_utf8,

'bar' => 1

);

json_encode($c);

print "ERROR: " . json_last_error() . "\n";



Expected result:

ERROR: 5

ERROR: 5

ERROR: 5

ERROR: 5

Actual result:
--
ERROR: 5

ERROR: 5

ERROR: 0

ERROR: 0






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


Bug #54053 [Opn->Bgs]: iconv returns strings with excessive memory usage

2011-02-19 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54053&edit=1

 ID: 54053
 Updated by: scott...@php.net
 Reported by:r3z at pr0j3ctr3z dot com
 Summary:iconv returns strings with excessive memory usage
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:ICONV related
 Operating System:   Windows XP SP3
 PHP Version:5.2.17
 Block user comment: N
 Private report: N

 New Comment:

.


Previous Comments:

[2011-02-19 20:38:24] scott...@php.net

Already works like you describe, only the memory required is copied from
the iconv 

buffer.



Add a check outside the loop and you'll see its stabilised again back to
4mb. This 

just the way the memory manager works.


[2011-02-19 06:43:23] r3z at pr0j3ctr3z dot com

Made minor alteration to the summary


[2011-02-19 06:30:51] r3z at pr0j3ctr3z dot com

Description:

PHP 5.2.17 / libiconv 1.11 / Windows XP SP3



It would appear that, on my machine at least, the result returned by
iconv uses the same amount of memory as the input string, even if it
doesn't actually need to. This only happens when the result is smaller
than the input string. When the result is bigger than the input string,
i.e. going from ISO-8859-1 characters above 0x7F, to UTF-8, the
resulting memory usage is as expected.



To demonstrate, the example code initializes an array of 4 UTF-8
strings, which I have named: n-tilde; multiplication; cyrillic-i; and
invalid. Each 1MB string is repeatedly (for dramatic effect)
transliterated to ASCII, and the resulting string is stored in a buffer
array. The memory usage before and after these repeated transliteration
is recorded and displayed. The difference in the memory usage before and
after, therefore closely approximates the memory usage of the buffer
array.



During the transliteration the following occurs:



n-tilde: each 2-byte UTF-8 character, U+00F1, is transliterated to the
2-byte ASCII sequence '~n', so each buffer should use 1MB.

multiplication: each 2-byte UTF-8 character, U+00D7, is transliterated
to the 1-byte ASCII sequence 'x', so each buffer should use 0.5MB.

cyrillic-i: each 2-byte UTF-8 character, U+0438, is ignored since there
is no transliteration. So iconv returns the empty string. Therefore,
each buffer should use 0MB.

invalid: 0xFF is invalid in UTF-8 so iconv stops processing the input
string at the first character, generates an E_NOTICE (which I mask to
make the output more readable) and returns the incomplete result, the
empty string. Therefore, each buffer should use 0MB.



I am aware that it takes ~68 bytes per entry, plus the size of the data
to store the array, however, in this case 16 entries, plus index
strings, only amounts to ~1KB, which is insignificant compared to the
results. Keeping this in mind though, you would expect additional memory
usage caused by the creation of the 16 entry, buffer array to be:



~16MB for n-tilde (16 buffers @ 1MB each);

~8MB for multiplication (16 buffers @ 0.5MB each);

~1KB for cyrillic-i (16 buffers @ 0MB each);

~1KB for invalid (16 buffers @ 0MB each).



This ties in very neatly with my expected results, as shown. However,
the actual results are significantly different. As you can see, the
buffer for each string uses 16MB. Note that this is 16 buffers @ 1MB
(the size of the input string). Obviously, this should not be the case.
An array of 16 empty strings, in the cases of the cyrillic-i and invalid
tests, should not use 16MB of memory. Although I haven't shown it here
for brevity, the contents of the buffer after, for example, the invalid
test, are indeed 16 empty strings which act like empty strings should.
They work just fine. They just use 1MB of memory each. When you strlen
them, they report being zero-length as you would expect. But they still
use 1MB each. The interesting thing about them is that if you
concatenate all the empty strings together and save it in a separate
string that string only uses a few bytes, as you would expect. So as
soon as you do any string operations of them, the resulting strings use
the expected amount of memory.



So to get the expected results shown here, I simply cast the result of
the iconv call as a string, i.e. $buffer = (string)@iconv(...);. Now,
obviously, at least logically, this should make no difference. After
all, I'm casting a string as a string. But since casts in PHP are an
operator they return a new value. In this case, a new string with the
same value and corrected memory usage.



You can change the number of repetitions, and/or the input string sizes.
The pattern remains the same. The result strings (if smaller) always end
up using the same amount of memory as the input string. Change the to-
and from-

Bug #54053 [Opn]: iconv returns strings with excessive memory usage

2011-02-19 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54053&edit=1

 ID: 54053
 Updated by: scott...@php.net
 Reported by:r3z at pr0j3ctr3z dot com
 Summary:iconv returns strings with excessive memory usage
 Status: Open
 Type:   Bug
 Package:ICONV related
 Operating System:   Windows XP SP3
 PHP Version:5.2.17
 Block user comment: N
 Private report: N

 New Comment:

Already works like you describe, only the memory required is copied from
the iconv 

buffer.



Add a check outside the loop and you'll see its stabilised again back to
4mb. This 

just the way the memory manager works.


Previous Comments:

[2011-02-19 06:43:23] r3z at pr0j3ctr3z dot com

Made minor alteration to the summary


[2011-02-19 06:30:51] r3z at pr0j3ctr3z dot com

Description:

PHP 5.2.17 / libiconv 1.11 / Windows XP SP3



It would appear that, on my machine at least, the result returned by
iconv uses the same amount of memory as the input string, even if it
doesn't actually need to. This only happens when the result is smaller
than the input string. When the result is bigger than the input string,
i.e. going from ISO-8859-1 characters above 0x7F, to UTF-8, the
resulting memory usage is as expected.



To demonstrate, the example code initializes an array of 4 UTF-8
strings, which I have named: n-tilde; multiplication; cyrillic-i; and
invalid. Each 1MB string is repeatedly (for dramatic effect)
transliterated to ASCII, and the resulting string is stored in a buffer
array. The memory usage before and after these repeated transliteration
is recorded and displayed. The difference in the memory usage before and
after, therefore closely approximates the memory usage of the buffer
array.



During the transliteration the following occurs:



n-tilde: each 2-byte UTF-8 character, U+00F1, is transliterated to the
2-byte ASCII sequence '~n', so each buffer should use 1MB.

multiplication: each 2-byte UTF-8 character, U+00D7, is transliterated
to the 1-byte ASCII sequence 'x', so each buffer should use 0.5MB.

cyrillic-i: each 2-byte UTF-8 character, U+0438, is ignored since there
is no transliteration. So iconv returns the empty string. Therefore,
each buffer should use 0MB.

invalid: 0xFF is invalid in UTF-8 so iconv stops processing the input
string at the first character, generates an E_NOTICE (which I mask to
make the output more readable) and returns the incomplete result, the
empty string. Therefore, each buffer should use 0MB.



I am aware that it takes ~68 bytes per entry, plus the size of the data
to store the array, however, in this case 16 entries, plus index
strings, only amounts to ~1KB, which is insignificant compared to the
results. Keeping this in mind though, you would expect additional memory
usage caused by the creation of the 16 entry, buffer array to be:



~16MB for n-tilde (16 buffers @ 1MB each);

~8MB for multiplication (16 buffers @ 0.5MB each);

~1KB for cyrillic-i (16 buffers @ 0MB each);

~1KB for invalid (16 buffers @ 0MB each).



This ties in very neatly with my expected results, as shown. However,
the actual results are significantly different. As you can see, the
buffer for each string uses 16MB. Note that this is 16 buffers @ 1MB
(the size of the input string). Obviously, this should not be the case.
An array of 16 empty strings, in the cases of the cyrillic-i and invalid
tests, should not use 16MB of memory. Although I haven't shown it here
for brevity, the contents of the buffer after, for example, the invalid
test, are indeed 16 empty strings which act like empty strings should.
They work just fine. They just use 1MB of memory each. When you strlen
them, they report being zero-length as you would expect. But they still
use 1MB each. The interesting thing about them is that if you
concatenate all the empty strings together and save it in a separate
string that string only uses a few bytes, as you would expect. So as
soon as you do any string operations of them, the resulting strings use
the expected amount of memory.



So to get the expected results shown here, I simply cast the result of
the iconv call as a string, i.e. $buffer = (string)@iconv(...);. Now,
obviously, at least logically, this should make no difference. After
all, I'm casting a string as a string. But since casts in PHP are an
operator they return a new value. In this case, a new string with the
same value and corrected memory usage.



You can change the number of repetitions, and/or the input string sizes.
The pattern remains the same. The result strings (if smaller) always end
up using the same amount of memory as the input string. Change the to-
and from- charsets, the pattern remains. Remove the ignore and/or
translit flags, it doesn't matter. You still end up with strings that
take up more spa

Bug #54010 [Opn->Bgs]: json_decode can not handle data like {"A":0000}, but {"A":0} is fine

2011-02-13 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=54010&edit=1

 ID: 54010
 Updated by: scott...@php.net
 Reported by:pan_yong_feng at hotmail dot com
 Summary:json_decode can not handle data like {"A":}, but
 {"A":0} is fine
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Apache2 related
 Operating System:   Ubuntu
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

I can't reproduce the cpu usage from cli on 5.3.5.



Looking at the json spec the number isn't valid.



I passed it through a linter too and you get.





syntax error, unexpected TNUMBER, expecting '}'


Previous Comments:

[2011-02-14 05:50:38] pan_yong_feng at hotmail dot com

e.g.

{"S":,"Y":5,"G":82.36431503,"T":33.99824477,"A":4,"Ai":0},


[2011-02-14 05:47:55] pan_yong_feng at hotmail dot com

Description:

I have json data to decode using php api: json_decode(), 

But I found if there is a number of  instead of 0. Such 

API will case thread of apache2 take 100% of cpu resource for about 

1 mins. 



I know  is the legal number, but I think there should be a way to 

indicate that apache cannot handle, instead of just running exhausted.



Hoping this is useful for other developer. 

Thanks a lot.

Expected result:

Send some warning information.







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


Bug #51900 [Bgs]: Abstract Method Not Overridden will Halt PHP.

2011-02-11 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=51900&edit=1

 ID: 51900
 Updated by: scott...@php.net
 Reported by:jrdoane at gmail dot com
 Summary:Abstract Method Not Overridden will Halt PHP.
 Status: Bogus
 Type:   Bug
 Package:Class/Object related
 Operating System:   Ubuntu 9.10/RHEL 4
 PHP Version:5.2.13
 Block user comment: N
 Private report: N

 New Comment:

I get



Fatal error: Abstract function Foo::test() cannot contain body in 

/private/tmp/foo.php on line 4



If i remove the body I get





Fatal error: Class Bar contains 1 abstract method and must therefore be
declared 

abstract or implement the remaining methods (Foo::test) in
/private/tmp/foo.php 

on line 7


Previous Comments:

[2011-02-12 01:22:04] justin dot rebelo at gmail dot com

For what it's worth, I have been having this same issue for some time on
my 

ubuntu-based workstation. It took me  while to narrow it down to just
this 

situation but I have the following issue.



Declare an abstract class:



abstract class Foo {

  abstract public function test () {

  }

}



class Bar extends Foo {

}



When Bar.php gets loaded, PHP dies instantly and silently. Nothing is
logged, 

nothing is printed to browser and when run on CLI, nothing prints to
console.



phpinfo verifies:



error_reporting = E_ALL

display_errors = 1

display_startup_errors = 1



I also use xdebug and have stepped through the code to the point where
it dies 

after including the offending file and I get no useful information
through it 

either.



I am using PHP Version 5.3.3-1ubuntu9.3


[2010-06-09 14:26:40] jrdoane at gmail dot com

Display_Errors is on.

E_ALL is being displayed.

No change, I checked this before submitting a bug report.


[2010-06-08 13:11:29] tony2...@php.net

Not reproducible.

Please enable error reporting and make sure display_errors is set to
On.



PHP 5.3.99-dev

PHP 5.3.3-dev 

PHP 5.2.14-dev 



All these versions report a fatal error:

Fatal error: Class example contains 1 abstract method and must therefore
be declared abstract or implement the remaining methods (abcEx::foo) in
/tmp/1.php on line 4


[2010-05-24 17:27:48] jrdoane at gmail dot com

Description:

if you have an abstract class that gets overridden, if a method that is
overridden has a default where the abstract doesn't, PHP just halts
without any error, warning, or fatal. For small projects this is
manageable, but when you have a large project, hunting down these things
take a long time, such as a multi-thousand lined library loaded with
abstract classes.



These are the folowing versions of PHP that I've tested:

$ php --version

PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cli) (built: Jan  6 2010
22:56:44)

Copyright (c) 1997-2009 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies



and





$ php --version

PHP 5.2.13 (cli) (built: Apr  6 2010 18:40:35)

Copyright (c) 1997-2010 The PHP Group

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



Test script:
---
runme.php





file1.php





file2.php



Expected result:

Error: Abstract method not overridden (Line: # OR method name)

Actual result:
--
# PHP halts suddenly with no error output.






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


Bug #53992 [Opn->Bgs]: ambiguous property/method access

2011-02-10 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53992&edit=1

 ID: 53992
 Updated by: scott...@php.net
 Reported by:msg2maciej at aol dot com
 Summary:ambiguous property/method access
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:*General Issues
 Operating System:   MAC OSX
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

See previous comment.


Previous Comments:

[2011-02-11 08:55:27] scott...@php.net

You're accessing hello() statically therefore there is no $this
context.



Add error_reporting(-1); to the top of your script and see all the
errors.


[2011-02-11 07:23:01] msg2maciej at aol dot com

Description:

I'm not sure if this is a bug. If you look in code why protected method
hello() can be accessed and property $this->var not, from that method?
PHP 5.3.3

Test script:
---
var = 'Undefined property??';

$this->B = new B(__CLASS__);

}

protected function  hello() {

echo 'accessing '.__CLASS__.'::protected method - 
hello()'.PHP_EOL;

echo $this->var;

}}

class B extends abstract_class

{   function __construct ( $class_A )

{   $class_A::hello();  }

protected function hello(){}

} new A; ?>

Expected result:

access $this->var , look into script.







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


Bug #53992 [Opn]: ambiguous property/method access

2011-02-10 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53992&edit=1

 ID: 53992
 Updated by: scott...@php.net
 Reported by:msg2maciej at aol dot com
 Summary:ambiguous property/method access
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   MAC OSX
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

You're accessing hello() statically therefore there is no $this
context.



Add error_reporting(-1); to the top of your script and see all the
errors.


Previous Comments:

[2011-02-11 07:23:01] msg2maciej at aol dot com

Description:

I'm not sure if this is a bug. If you look in code why protected method
hello() can be accessed and property $this->var not, from that method?
PHP 5.3.3

Test script:
---
var = 'Undefined property??';

$this->B = new B(__CLASS__);

}

protected function  hello() {

echo 'accessing '.__CLASS__.'::protected method - 
hello()'.PHP_EOL;

echo $this->var;

}}

class B extends abstract_class

{   function __construct ( $class_A )

{   $class_A::hello();  }

protected function hello(){}

} new A; ?>

Expected result:

access $this->var , look into script.







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


Req #53946 [Asn]: add json_encode option for not escaping unnecessary character

2011-02-10 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53946&edit=1

 ID: 53946
 Updated by: scott...@php.net
 Reported by:christian dot pernot at pingroom dot net
 Summary:add json_encode option for not escaping unnecessary
 character
 Status: Assigned
 Type:   Feature/Change Request
 Package:JSON related
 PHP Version:5.3.5
 Assigned To:scottmac
 Block user comment: N
 Private report: N

 New Comment:

Seems reasonable to add.


Previous Comments:

[2011-02-07 10:22:03] christian dot pernot at pingroom dot net

Description:

It would be great to have a option for json_encode which make possible
to keep non-ascii character "as such" in strings (and not \u), which
is the case for example with mozilla's JSON.stringify.



json.org states string can have
"any-Unicode-character-except-"-or-\-or-control-character"

Test script:
---
$str = "test accentué";

echo json_encode($str);



gives 



"test accentu\u00e9"

Expected result:

"test accentué"

Actual result:
--
"test accentu\u00e9"






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


Req #53968 [Bgs]: Non-breaking spaces are considered as a valid identifier character

2011-02-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53968&edit=1

 ID: 53968
 Updated by: scott...@php.net
 Reported by:ivan dot enderlin at hoa-project dot net
 Summary:Non-breaking spaces are considered as a valid
 identifier character
 Status: Bogus
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

It's in the manual.



A letter in PHP is considered to be a-z,A-Z and 0x7f-0xff


Previous Comments:

[2011-02-09 09:27:51] ivan dot enderlin at hoa-project dot net

To alert developers and prove that it is not a bug :-).


[2011-02-09 09:26:04] scott...@php.net

if its not a bug why report it here?


[2011-02-09 09:15:59] ivan dot enderlin at hoa-project dot net

Description:

Hey :-),



Just a noticeable think that PHP allows is the use of non-breaking space
(0x00A0) as a valid identifier character. Thus, we can have very strange
code (but I love it)! See bellow.



It is not a bug, just a fact that makes PHP awesome.

Test script:
---
f g h();



// Go deeper.

function   ( ) {



var_dump('succeed (2)');

}



 ();



// Go crazy!

class   {



public function    ( ) {



var_dump('succeed (3)');

}

}



$  = new  ();

$ ->  ();



echo 'PHP is awesome :-).' . "\n";

Expected result:

string(11) "succeed (1)"

string(11) "succeed (2)"

string(11) "succeed (3)"

PHP is awesome :-).

Actual result:
--
string(11) "succeed (1)"

string(11) "succeed (2)"

string(11) "succeed (3)"

PHP is awesome :-).






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


Req #53968 [Opn->Bgs]: Non-breaking spaces are considered as a valid identifier character

2011-02-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53968&edit=1

 ID: 53968
 Updated by: scott...@php.net
 Reported by:ivan dot enderlin at hoa-project dot net
 Summary:Non-breaking spaces are considered as a valid
 identifier character
-Status: Open
+Status: Bogus
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

if its not a bug why report it here?


Previous Comments:

[2011-02-09 09:15:59] ivan dot enderlin at hoa-project dot net

Description:

Hey :-),



Just a noticeable think that PHP allows is the use of non-breaking space
(0x00A0) as a valid identifier character. Thus, we can have very strange
code (but I love it)! See bellow.



It is not a bug, just a fact that makes PHP awesome.

Test script:
---
f g h();



// Go deeper.

function   ( ) {



var_dump('succeed (2)');

}



 ();



// Go crazy!

class   {



public function    ( ) {



var_dump('succeed (3)');

}

}



$  = new  ();

$ ->  ();



echo 'PHP is awesome :-).' . "\n";

Expected result:

string(11) "succeed (1)"

string(11) "succeed (2)"

string(11) "succeed (3)"

PHP is awesome :-).

Actual result:
--
string(11) "succeed (1)"

string(11) "succeed (2)"

string(11) "succeed (3)"

PHP is awesome :-).






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


Req #51915 [Opn->Bgs]: numeric string key escaped in type change

2011-02-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=51915&edit=1

 ID: 51915
 Updated by: scott...@php.net
 Reported by:laruence at yahoo dot com dot cn
 Summary:numeric string key escaped in type change
-Status: Open
+Status: Bogus
 Type:   Feature/Change Request
 Package:JSON related
 Operating System:   linux
 PHP Version:5.2.13
 Block user comment: N
 Private report: N

 New Comment:

When an array is of mixed type or doesn't contain sequential keys it has
to be 

treated as a hash and not as an integer



json_encode() turns the integer keys into strings which it has to do to
be valid 

json.



On json_decode() it see's string keys instead of numeric since this is a
hash 

not an array.



There is nothing unexpected happening here.


Previous Comments:

[2010-06-07 10:03:41] xiezhenye at gmail dot com

there is an easier way to build such an array.



$obj = new stdClass;

$obj->{'123'} = 1;

$arr = (array) $obj;

var_dump($obj);


[2010-05-27 04:15:01] laruence at yahoo dot com dot cn

change bug to Feature , nhancement


[2010-05-26 08:30:18] laruence at yahoo dot com dot cn

Description:

php treat numeric string key as interge,



bug sometimes there is some exception.



for example:

  while change a std object to array, numeric string key doesn't cast to
number 

Test script:
---
 'laruence',

"03"=> 'baidu',

);



$value = json_encode($data);

$obj   = json_decode($value);

$arr   = (array)$obj;

var_dump($arr);

?>

Expected result:

array(2) {

  [123]=>

  string(8) "laruence"

  ["03"]=>

  string(5) "baidu"

}



Actual result:
--
array(2) {

  ["123"]=>

  string(8) "laruence"

  ["03"]=>

  string(5) "baidu"

}








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


Bug #53963 [Asn->Csd]: Failed to decode, yet json_last_error() is JSON_ERROR_NONE

2011-02-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53963&edit=1

 ID: 53963
 Updated by: scott...@php.net
 Reported by:h...@php.net
 Summary:Failed to decode, yet json_last_error() is
 JSON_ERROR_NONE
-Status: Assigned
+Status: Closed
 Type:   Bug
 Package:JSON related
 PHP Version:5.3.5
 Assigned To:scottmac
 Block user comment: N
 Private report: N



Previous Comments:

[2011-02-09 09:05:02] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=308155
Log: Fix Bug #53963, error code isn't always set in certain error cases.


[2011-02-09 08:00:50] ahar...@php.net

Here's a much simpler test case based on the munged JSON from

atsearch.autotrader.co.uk:







Obviously json_last_error() should return something other than 0,

presumably JSON_ERROR_SYNTAX (4), since it's not syntactically

valid JSON.


[2011-02-08 20:23:48] h...@php.net

Description:

I'm trying the json_decode() function on real world strings, not just
from strings 

produced using json_encode().



I have included the test case from bug #52262 as well to show that this
issue is 

different.



Thanks.

Test script:
---


http://dealerservices.autotrader.co.uk/14184/cars.htm */

$urls[]='http://atsearch.autotrader.co.uk/js/uvl/InlineServlet.js?did=14184&configfile=http://dealerservices.autotrader.co.uk/dealers/14184/14184_config.xml&csslocation=http://dealerservices.autotrader.co.uk/dealers/14184/14184&dropdowntype=uvl&partner=TMG&postcode=me86ad&miles=1500&sort=5&action=searchresults';

/* from http://api.jquery.com/jQuery.getJSON/ */

$urls[]='http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=jQuery15094986786483787_1297190250272&tags=cat&tagmode=any&format=json&_=1297190250280';

/* from
http://code.google.com/apis/base/samples/javascript/tutorial.html */

$urls[]='http://www.google.com/base/feeds/attributes/-/vehicles?max-values=30&bq=[target%20country:GB]&alt=json-in-script&callback=showMake';

/* from http://code.google.com/apis/gdata/docs/json.html */

$urls[]='http://www.google.com/calendar/feeds/developer-calen...@google.com/public/full?alt=json';

/* from http://code.google.com/apis/gdata/docs/json.html */

$urls[]='http://www.google.com/calendar/feeds/developer-calen...@google.com/public/full?alt=json-in-script&callback=myFunction';

/* from http://bugs.php.net/bug.php?id=52262 */

$urls[]='http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0001/?gameid=440';



/* from http://php.net/manual/en/function.json-last-error.php */

$json_errors=array( -1 => 'An unknown error occured',


JSON_ERROR_NONE => 'No error has occurred',


JSON_ERROR_DEPTH => 'The maximum stack depth has been
exceeded',


JSON_ERROR_CTRL_CHAR => 'Control character error, possibly
incorrectly encoded',


JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',


JSON_ERROR_SYNTAX => 'Syntax error',


JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly
incorrectly encoded');



/* main loop */

foreach($urls as $url) {

echo PHP_EOL;



//call the json

$json=file_get_contents($url);

echo 'Decoding... ' . $url . PHP_EOL;



//convert from jsonp to json

$json=preg_replace('/.+?({.+}).+/','$1',$json);



//get a result

$result=json_decode($json);

if ($result) {

echo 'Decoded.';

} else {

  echo 'Failed to decode.';

}

echo PHP_EOL;



$err=json_last_error();

if ($err != JSON_ERROR_NONE) {

echo 'Error: ';

echo 
isset($json_errors[$err])?$json_errors[$err]:$json_errors[-1];

} else {

echo 'No error.';

}

echo PHP_EOL;

}



//eof

Expected result:

The first r

Bug #53963 [Ver->Asn]: Failed to decode, yet json_last_error() is JSON_ERROR_NONE

2011-02-08 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53963&edit=1

 ID: 53963
 Updated by: scott...@php.net
 Reported by:h...@php.net
 Summary:Failed to decode, yet json_last_error() is
 JSON_ERROR_NONE
-Status: Verified
+Status: Assigned
 Type:   Bug
 Package:JSON related
 PHP Version:5.3.5
-Assigned To:
+Assigned To:scottmac
 Block user comment: N
 Private report: N



Previous Comments:

[2011-02-09 08:00:50] ahar...@php.net

Here's a much simpler test case based on the munged JSON from

atsearch.autotrader.co.uk:







Obviously json_last_error() should return something other than 0,

presumably JSON_ERROR_SYNTAX (4), since it's not syntactically

valid JSON.


[2011-02-08 20:23:48] h...@php.net

Description:

I'm trying the json_decode() function on real world strings, not just
from strings 

produced using json_encode().



I have included the test case from bug #52262 as well to show that this
issue is 

different.



Thanks.

Test script:
---


http://dealerservices.autotrader.co.uk/14184/cars.htm */

$urls[]='http://atsearch.autotrader.co.uk/js/uvl/InlineServlet.js?did=14184&configfile=http://dealerservices.autotrader.co.uk/dealers/14184/14184_config.xml&csslocation=http://dealerservices.autotrader.co.uk/dealers/14184/14184&dropdowntype=uvl&partner=TMG&postcode=me86ad&miles=1500&sort=5&action=searchresults';

/* from http://api.jquery.com/jQuery.getJSON/ */

$urls[]='http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=jQuery15094986786483787_1297190250272&tags=cat&tagmode=any&format=json&_=1297190250280';

/* from
http://code.google.com/apis/base/samples/javascript/tutorial.html */

$urls[]='http://www.google.com/base/feeds/attributes/-/vehicles?max-values=30&bq=[target%20country:GB]&alt=json-in-script&callback=showMake';

/* from http://code.google.com/apis/gdata/docs/json.html */

$urls[]='http://www.google.com/calendar/feeds/developer-calen...@google.com/public/full?alt=json';

/* from http://code.google.com/apis/gdata/docs/json.html */

$urls[]='http://www.google.com/calendar/feeds/developer-calen...@google.com/public/full?alt=json-in-script&callback=myFunction';

/* from http://bugs.php.net/bug.php?id=52262 */

$urls[]='http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0001/?gameid=440';



/* from http://php.net/manual/en/function.json-last-error.php */

$json_errors=array( -1 => 'An unknown error occured',


JSON_ERROR_NONE => 'No error has occurred',


JSON_ERROR_DEPTH => 'The maximum stack depth has been
exceeded',


JSON_ERROR_CTRL_CHAR => 'Control character error, possibly
incorrectly encoded',


JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON',


JSON_ERROR_SYNTAX => 'Syntax error',


JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly
incorrectly encoded');



/* main loop */

foreach($urls as $url) {

echo PHP_EOL;



//call the json

$json=file_get_contents($url);

echo 'Decoding... ' . $url . PHP_EOL;



//convert from jsonp to json

$json=preg_replace('/.+?({.+}).+/','$1',$json);



//get a result

$result=json_decode($json);

if ($result) {

echo 'Decoded.';

} else {

  echo 'Failed to decode.';

}

echo PHP_EOL;



$err=json_last_error();

if ($err != JSON_ERROR_NONE) {

echo 'Error: ';

echo 
isset($json_errors[$err])?$json_errors[$err]:$json_errors[-1];

} else {

echo 'No error.';

}

echo PHP_EOL;

}



//eof

Expected result:

The first result should either:



* Decode successfully and have no error (preferable)

Or

* Fail to decode and have an error which explains why

Actual result:
--


Decoding... http://atsearch.autotrader.co.uk/js/uvl/InlineServlet.js?

did=14184&configfile=http://dealerservices.

Bug #53875 [Opn->Bgs]: file() fgets() fgetc() will read

2011-01-28 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53875&edit=1

 ID: 53875
 Updated by: scott...@php.net
 Reported by:rosshowatson at gmail dot com
 Summary:file() fgets() fgetc() will read 



Second file:  readFileViaPHP.php

';

print_r ($lines);

echo '';

echo  '' . "\n";

?>

Expected result:

You should see all records from phpinfo2.php



Array

(

[0] =>  phpinfo();

[2] =>  < ?

[4] => ?>

)

Actual result:
--
Array

(

[0] =>   phpinfo();

[2] =>< ?

[5] =>?>

)






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


Req #53874 [Opn->Bgs]: date_default_timezone_set() on header

2011-01-28 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53874&edit=1

 ID: 53874
 Updated by: scott...@php.net
 Reported by:frame at dynamiccreated dot de
 Summary:date_default_timezone_set() on header
-Status: Open
+Status: Bogus
 Type:   Feature/Change Request
 Package:Date/time related
 Operating System:   Windows x86
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

cookies are based on GMT and don't use a timezone.


Previous Comments:

[2011-01-28 23:09:41] frame at dynamiccreated dot de

Description:

date_default_timezone_set() does not affect any HTTP-header?

For example created with setcookie(), the setting has no effect.



Why is PHP given "It is not safe to rely on the system's timezone
settings" on date() but not on setcookie()?



So if the method is used to correct the timezone (eg. GMT to GMT+1) no
header generated by PHP will regarding the changed time. Any cookie set
to 1 hour expiration will fail.



If this is bogus, please add a warning to setcookie() linking with
date_default_timezone_set().







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


Bug #53858 [Opn]: infinite loop in __tostring() causes seg fault

2011-01-28 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53858&edit=1

 ID: 53858
 Updated by: scott...@php.net
 Reported by:alok at fb dot com
 Summary:infinite loop in __tostring() causes seg fault
 Status: Open
 Type:   Bug
 Package:Class/Object related
 Operating System:   All
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

This is a crash in stock PHP 5.2 too, Our version in APE has a patch
that adds 

fb.recursion_max and overrides zend_execute to do the counting.


Previous Comments:

[2011-01-27 19:01:25] alok at fb dot com

Description:

The following piece of code would cause "PHP Fatal error:  [php_fb]:
call depth has exceeded the maximum recursion setting of 500!, eject!
eject! eject!..." in 5.2.5. However, on versions 5.3.3 and 5.3.5, I am
seeing a segmentation fault.



Test script:
---
http://bugs.php.net/bug.php?id=53858&edit=1


Bug #53816 [Opn->Bgs]: htmlspecialchars_decode() only works on lower case stuff

2011-01-22 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53816&edit=1

 ID: 53816
 Updated by: scott...@php.net
 Reported by:zelnaga at gmail dot com
 Summary:htmlspecialchars_decode() only works on lower case
 stuff
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   Windows 7
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

entity names are case sensitive in the spec.


Previous Comments:

[2011-01-22 16:10:12] zelnaga at gmail dot com

Description:

htmlspecialchars_decode() and html_entity_decode() only convert lower
case entities.  eg. <, >, etc.  Upper case entities - <, >,
etc - are ignored.







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


Bug #53336 [Opn->Bgs]: queries on create_function return only one result

2011-01-05 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53336&edit=1

 ID: 53336
 Updated by: scott...@php.net
 Reported by:cbruner at quadro dot net
 Summary:queries on create_function return only one result
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:SQLite related
 Operating System:   linux
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

Actually you only return one row. fetchArray() only fetches the first
result since 

SQLite isn't buffered.



You need to loop and call fetchArray() multiple times.


Previous Comments:

[2011-01-06 01:13:38] scott...@php.net

Can you give me a full test script, I'll need data too to track this
down.


[2010-11-18 06:19:33] cbruner at quadro dot net

Description:

Using sqlite3, create a function to do a comparison
(SQLite3::createFunction)

Then query a table using the function. 

Only one result is returned when multiple results would be expected.

Test script:
---
// callback function for use by the sqlite3 class which returns the
distance between 2 points on the earth

function SqLDistance($Latitude,$Longitude,$Lat,$Long)

{

$result = 1.0;  // flag to be off the earth!

if (isset($Latitude) &&  isset($Longitude))

{

$lat1rad = $Latitude *  0.01745327;// degrees * pi over
180

$lat2rad = $Lat *  0.01745327;// degrees * pi over 180

$long1rad = $Longitude *  0.01745327;// degrees * pi
over 180

$long2rad = $Long *  0.01745327;// degrees * pi over
180

// apply the spherical law of cosines to our 

$earthRadius = 6378.1;  //km

$result =  $earthRadius *

acos(sin($lat1rad) * sin($lat2rad) +
cos($lat1rad) * cos($lat2rad) * cos($long2rad - $long1rad));

}

return $result;

}



class MyDB extends SQLite3

{

function __construct()

{

$this->open('zipcode.db');

$this->createFunction('Distance','SqlDistance',4);

}





 function Borked($lat,$long,$count)

{

$result = $this->query("Select *,Distance(Lat,Long,$lat,$long)
as Distance from agents order by Distance Limit 0,$count");

return $result->fetchArray();

}

}





Expected result:

An array of results with a length greater then 1.



Actual result:
--
An array of result.






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


Req #53466 [Opn->Csd]: sqlite3 columnType() returns SQLITE3_NULL when not in fetch loop

2011-01-05 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53466&edit=1

 ID: 53466
 Updated by: scott...@php.net
 Reported by:danielc at analysisandsolutions dot com
 Summary:sqlite3 columnType() returns SQLITE3_NULL when not
 in fetch loop
-Status: Open
+Status: Closed
 Type:   Feature/Change Request
 Package:SQLite related
 Operating System:   linux
 PHP Version:5.3SVN-2010-12-03 (SVN)
-Assigned To:
+Assigned To:scottmac
 Block user comment: N
 Private report: N

 New Comment:

This bug has been fixed in SVN.

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




Previous Comments:

[2011-01-06 01:09:01] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=307143
Log: Implemented FR #53466 (SQLite3Result::columnType() should return
false after all of the rows have been fetched).


[2010-12-03 18:28:15] danielc at analysisandsolutions dot com

Description:

The SQLite3Result::columnType() method returns SQLITE3_NULL (5) if not
looping over results.  This is done because the data type is unknown. 
But this leads to confusion, because SQLITE3_NULL is a legitimate answer
in some cases when inside the loop.  It would be clearer if PHP returned
NULL or FALSE instead.



Test script:
---
$db = new SQLite3(':memory:');



$db->exec('CREATE TABLE test (whatever INTEGER)');

$db->exec('INSERT INTO test (whatever) VALUES (1)');



$result = $db->query('SELECT * FROM test');

while ($row = $result->fetchArray(SQLITE3_NUM)) {

var_dump($result->columnType(0));  // int(1)  [SQLITE3_INTEGER]

}



// Seems returning null or false is more appropriate.

var_dump($result->columnType(0));  // int(5)  [SQLITE3_NULL]



$result->finalize();

$db->close();



echo "Done\n";



Expected result:

int(1)

bool(false)

Done



Actual result:
--
int(1)

int(5)

Done








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


Bug #53632 [Asn->Csd]: PHP hangs on numeric value 2.2250738585072011e-308

2011-01-04 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53632&edit=1

 ID: 53632
 Updated by: scott...@php.net
 Reported by:exploringbinary at gmail dot com
 Summary:PHP hangs on numeric value 2.2250738585072011e-308
-Status: Assigned
+Status: Closed
 Type:   Bug
 Package:Math related
 PHP Version:5.3.4
-Assigned To:dmitry
+Assigned To:scottmac
 Block user comment: N
 Private report: N

 New Comment:

This bug has been fixed in SVN.

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




Previous Comments:

[2011-01-04 23:36:26] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=307095
Log: Fix bug #53632 with x87 fpu


[2011-01-04 20:21:00] aloucks at cofront dot net

PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug  4 2010
03:25:57)

Copyright (c) 1997-2008 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies



The bug is NOT present in this version.


[2011-01-04 19:30:56] ras...@php.net

Guys, we already know the problem.  We are hitting an annoying x87 FPU
design 

flaw.  You can read all about it here if you are interested:



http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323



And there is a good paper on it here:



http://hal.archives-ouvertes.fr/docs/00/28/14/29/PDF/floating-point-article.pdf



We don't need any more compile reports.  If you are on an architecture
that uses 

the x87 FPU and you haven't forced SSE or float-store then you will see
this 

problem.


[2011-01-04 19:11:29] hieu dot ld at vnnb dot net

Re: last comment, I believe "-mfpmath=sse" did the trick. apologies for
cluttering the bug report.


[2011-01-04 19:06:34] hieu dot ld at vnnb dot net

Does not reproduce on php 5.3.4 (with gentoo patches, compiled -O2).



dri...@undine ~/h $ cat numericval.php





dri...@undine ~/h $ php numericval.php

2.2250738585072E-308



dri...@undine ~/h $ php -v

PHP 5.3.4-pl0-gentoo (cli) (built: Dec 24 2010 14:24:29)

Copyright (c) 1997-2010 The PHP Group

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



dri...@undine ~/h $ uname -a

Linux undine 2.6.28-hardened-r9-hrd-undine #1 SMP Thu Nov 12 02:29:42
CET 2009 i686 Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz GenuineIntel
GNU/Linux



Configure Command =>  './configure'  '--prefix=/usr'
'--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib'
'--prefix=/usr/lib/php5.3' '--mandir=/usr/lib/php5.3/man'
'--infodir=/usr/lib/php5.3/info' '--libdir=/usr/lib/php5.3/lib'
'--with-libdir=lib' '--without-pear' '--enable-maintainer-zts'
'--disable-bcmath' '--with-bz2' '--disable-calendar' '--with-curl'
'--without-curlwrappers' '--without-enchant' '--enable-exif'
'--enable-ftp' '--with-gettext' '--without-gmp' '--disable-intl'
'--without-kerberos' '--enable-mbstring' '--with-mcrypt'
'--without-mssql' '--with-onig=/usr' '--with-openssl'
'--with-openssl-dir=/usr' '--enable-pcntl' '--with-pgsql'
'--without-pspell' '--without-recode' '--disable-shmop' '--without-snmp'
'--disable-soap' '--disable-sockets' '--without-sybase-ct'
'--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm'
'--with-tidy' '--disable-wddx' '--with-xmlrpc' '--without-xsl'
'--enable-zip' '--with-zlib' '--disable-debug' '--enable-dba'
'--without-cdb' '--without-db4' '--disable-flatfile' '--with-gdbm'
'--disable-inifile' '--without-qdbm' '--with-freetype-dir=/usr'
'--with-t1lib=/usr' '--enable-gd-jis-conv' '--with-jpeg-dir=/usr'
'--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-im

Bug #53632 [Asn]: PHP hangs on numeric value 2.2250738585072011e-308

2011-01-04 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53632&edit=1

 ID: 53632
 Updated by: scott...@php.net
 Reported by:exploringbinary at gmail dot com
 Summary:PHP hangs on numeric value 2.2250738585072011e-308
 Status: Assigned
 Type:   Bug
 Package:Math related
 PHP Version:5.3.4
 Assigned To:dmitry
 Block user comment: N
 Private report: N

 New Comment:

looking like a gcc optimizer bug, -O0 is fine where -O2 hangs


Previous Comments:

[2011-01-04 09:02:31] scott...@php.net

This only seems to affect 32-bit systems.


[2011-01-04 08:59:21] yuv dot adm at gmail dot com

Check out the strace:



  lstat64("/home/ubuntu/junk/p.php", {st_mode=S_IFREG|0644, st_size=59,
...}) = 0

  lstat64("/home/ubuntu/junk", {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

  lstat64("/home/ubuntu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

  lstat64("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

  ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfe51238) = -1  ENOTTY
(Inappropriate ioctl for device)

  fstat64(3, {st_mode=S_IFREG|0644, st_size=59, ...}) = 0

  mmap2(NULL, 68, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb78d1000



and then it hangs...


[2011-01-04 08:55:01] aquilax at gmail dot com

It hangs on Debian:





aqui...@zelda /tmp> php -v

PHP Warning:  PHP Startup: Unable to load dynamic library 

'/usr/lib/php5/20090626+lfs/adodb.so' -
/usr/lib/php5/20090626+lfs/adodb.so: 

cannot open shared object file: No such file or directory in Unknown on
line 0

PHP 5.3.3-6 with Suhosin-Patch (cli) (built: Dec  7 2010 18:23:49) 

Copyright (c) 1997-2009 The PHP Group

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

with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins
GmbH

aqui...@zelda /tmp> cat t.php 



aqui...@zelda /tmp> time php t.php 

PHP Warning:  PHP Startup: Unable to load dynamic library 

'/usr/lib/php5/20090626+lfs/adodb.so' -
/usr/lib/php5/20090626+lfs/adodb.so: 

cannot open shared object file: No such file or directory in Unknown on
line 0

^CCommand terminated by signal 2

7.55user 0.02system 0:07.61elapsed 99%CPU (0avgtext+0avgdata
36720maxresident)k

0inputs+0outputs (0major+2620minor)pagefaults 0swaps


[2011-01-04 08:31:04] yuv dot adm at gmail dot com

Does not reproduce on a mac, confirmed:



mac:junk yuval$ cat p.php 

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


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


Bug #53632 [Asn]: PHP hangs on numeric value 2.2250738585072011e-308

2011-01-04 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53632&edit=1

 ID: 53632
 Updated by: scott...@php.net
 Reported by:exploringbinary at gmail dot com
 Summary:PHP hangs on numeric value 2.2250738585072011e-308
 Status: Assigned
 Type:   Bug
 Package:Math related
 PHP Version:5.3.4
 Assigned To:dmitry
 Block user comment: N
 Private report: N

 New Comment:

This only seems to affect 32-bit systems.


Previous Comments:

[2011-01-04 08:59:21] yuv dot adm at gmail dot com

Check out the strace:



  lstat64("/home/ubuntu/junk/p.php", {st_mode=S_IFREG|0644, st_size=59,
...}) = 0

  lstat64("/home/ubuntu/junk", {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0

  lstat64("/home/ubuntu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) =
0

  lstat64("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

  ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfe51238) = -1  ENOTTY
(Inappropriate ioctl for device)

  fstat64(3, {st_mode=S_IFREG|0644, st_size=59, ...}) = 0

  mmap2(NULL, 68, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb78d1000



and then it hangs...


[2011-01-04 08:55:01] aquilax at gmail dot com

It hangs on Debian:





aqui...@zelda /tmp> php -v

PHP Warning:  PHP Startup: Unable to load dynamic library 

'/usr/lib/php5/20090626+lfs/adodb.so' -
/usr/lib/php5/20090626+lfs/adodb.so: 

cannot open shared object file: No such file or directory in Unknown on
line 0

PHP 5.3.3-6 with Suhosin-Patch (cli) (built: Dec  7 2010 18:23:49) 

Copyright (c) 1997-2009 The PHP Group

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

with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins
GmbH

aqui...@zelda /tmp> cat t.php 



aqui...@zelda /tmp> time php t.php 

PHP Warning:  PHP Startup: Unable to load dynamic library 

'/usr/lib/php5/20090626+lfs/adodb.so' -
/usr/lib/php5/20090626+lfs/adodb.so: 

cannot open shared object file: No such file or directory in Unknown on
line 0

^CCommand terminated by signal 2

7.55user 0.02system 0:07.61elapsed 99%CPU (0avgtext+0avgdata
36720maxresident)k

0inputs+0outputs (0major+2620minor)pagefaults 0swaps


[2011-01-04 08:31:04] yuv dot adm at gmail dot com

Does not reproduce on a mac, confirmed:



mac:junk yuval$ cat p.php 

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


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


Bug #53416 [Opn->Bgs]: iterate over array of complex objects slower than array of simple objects

2010-11-26 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53416&edit=1

 ID: 53416
 Updated by: scott...@php.net
 Reported by:goetas at lignano dot it
 Summary:iterate over array of complex objects slower than
 array of simple objects
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Performance problem
 Operating System:   Ubuntu Server 10
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

foreach() copies the array to work on. Hence why a complex object takes
longer to 

iterate as it takes longer to copy.


Previous Comments:

[2010-11-26 14:44:50] goetas at lignano dot it

Description:

I do not understand if is an error or not, but iterating over arrays
with complex objects is slower than iterate over arrays made with more
simple objects. 



In some case (but i can't reproduce it), iterate over arrays with 100
elements is 100x slower than iterate other array made of 100 simpler
objects.



(sorry for my English)

Test script:
---
v = $v;

return $o; 

}, $vals);



// more complex object array (1000 items)

$objs = array_map(function($v)use(&$obj){ 

$o = new stdClass();

$o->res = array();

for ($i = 0; $i<500; $i++){

$o->res[$i] = $obj[$i];

}

for (true; $i<1000; $i++){

$o->{'res'.$i} = $obj[$i];

}

return $o; 

}, $vals);



// TESTS



// 1. loop over integer array 

// 100 iterations

$t = microtime(1);

foreach ($vals as $o1){

foreach ($vals as $o2){

}

}

echo microtime(1)-$t."\n";



// 2. loop over simple object array 

// 100 iterations 

// 15% slower than loop n.1

$t = microtime(1);

foreach ($obj as $o1){

foreach ($obj as $o2){

}

}

echo microtime(1)-$t."\n";



// 3. loop over complex object array 

// 100 iterations

// 50% slower than loop n.1

$t = microtime(1);

foreach ($objs as $o1){

foreach ($objs as $o2){

}

}

echo microtime(1)-$t."\n";



Expected result:

all loop  should take the same amount of time. (at most with slight
differences)



Actual result:
--
loop n.3 is 50% slower than loop 1

loop n.3 is 30% slower than loop 2

in some case iterate over complex array can be 100x slower






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


Bug #53415 [Opn->Bgs]: memory_get_usage is inaccurate

2010-11-26 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=53415&edit=1

 ID: 53415
 Updated by: scott...@php.net
 Reported by:thepixeldeveloper at googlemail dot com
 Summary:memory_get_usage is inaccurate
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Linux durango 2.6.36-020636rc8-g
 PHP Version:5.3.3
 Block user comment: N
 Private report: N

 New Comment:

$something is destroyed when the scope is lost and the memory is free'd
back to 

PHP to use again. Hence the low value outside.



Maybe you're looking for memory_get_peak_usage()


Previous Comments:

[2010-11-26 14:36:39] thepixeldeveloper at googlemail dot com

Description:

memory_get_usage does not work correctly with reflection calls such as
invoke.

Test script:
---
invoke(new HelloWorld(), 'a');

 

echo 'Outside: ';

echo memory_get_usage() - $s;

Expected result:

Inside: 1048760

Outside: 1048760

Actual result:
--
Inside: 1048760

Outside: 92






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


Bug #52829 [Ana->Bgs]: json_decode looses data

2010-09-13 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=52829&edit=1

 ID: 52829
 Updated by: scott...@php.net
 Reported by:pzbowen at gmail dot com
 Summary:json_decode looses data
-Status: Analyzed
+Status: Bogus
 Type:   Bug
 Package:JSON related
 Operating System:   Linux
 PHP Version:5.2.14
 Block user comment: N

 New Comment:

We meet the spec here, it says SHOULD be unique and we don't do anything
that 

violates that.



What you're asking is to make something noisy for no good reason.



How does Python or Perl handle this? My tests show that the last entry 

overwrites the first, this is just how JavaScript handles it too.



Nothing to fix here.


Previous Comments:

[2010-09-14 07:48:56] ahar...@php.net

The attached patch against trunk would cause the JSON parser to emit
warnings for duplicate keys. The behaviour otherwise would be unchanged;
the last value would be the one in the returned object/array.



I'm holding off on committing it, though, for two reasons:



1. I'm not thrilled about emitting warnings, since they're difficult to
handle. We could return false from json_decode() instead and add a
return value to json_last_error() along the lines of
JSON_ERROR_DUPLICATE_NAME, but that doesn't seem any better to me: I
don't think this should stop decoding if the file is otherwise valid.



2. There is a performance impact from doing the extra checks. Cursory
benchmarking would suggest it's on the order of a 5% slowdown in
decoding speed.



So, if we decide we can live with the speed hit, I'd still like to hear
any bright ideas people might have for signalling these warnings in a
way that's easy for users to handle and still allows decoding to succeed
where possible.


[2010-09-14 07:48:42] ahar...@php.net

The following patch has been added/updated:

Patch Name: json-decode-warnings
Revision:   1284443322
URL:   
http://bugs.php.net/patch-display.php?bug=52829&patch=json-decode-warnings&revision=1284443322


[2010-09-13 22:03:03] pzbowen at gmail dot com

Agreed, no easy way to handle it, so it should return an error when this
situation is encountered.


[2010-09-13 21:49:13] ka...@php.net

I can't see any really easy way to achieve this since properties and
array keys are unique in PHP. Perhaps some overloading with objects but
that would be dirty/hackish


[2010-09-13 20:31:49] pzbowen at gmail dot com

Description:

According to RFC 4627, section 2.2, "The names within an object SHOULD
be unique."  This is only a SHOULD not a MUST, so the following is
valid



{"foo":2,"foo":3}



Unfortunately in PHP this only returns the last object member.

Test script:
---
var_dump(json_decode('{"foo":2,"foo":3}'));



Expected result:

an object with a way of accessing both members or an error raised by
json_decode

Actual result:
--
object(stdClass)#1 (1) {

  ["foo"]=>

  int(3)

}






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


Bug #52803 [Opn->Bgs]: parse_url can't handle urls without a scheme.

2010-09-09 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=52803&edit=1

 ID: 52803
 Updated by: scott...@php.net
 Reported by:leif at flattr dot com
 Summary:parse_url can't handle urls without a scheme.
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:*General Issues
 Operating System:   osx and debian linux
 PHP Version:5.3.3
 Block user comment: N

 New Comment:

The function is designed to work with a fully qualified URL, does the
manual 

suggest otherwise?


Previous Comments:

[2010-09-09 18:02:23] leif at flattr dot com

Description:

parse_url will falsely use the hostname as path if url doesn't include
the scheme part.







Test script:
---
php > echo var_dump(parse_url('hejhopp.com/'));



Expected result:

array(1) {

  ["host"]=>

  string(11) "hejhopp.com"

  ["path"]=>

  string(1) "/"

}

Actual result:
--
array(1) {

  ["path"]=>

  string(12) "hejhopp.com/"

}






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


Bug #50291 [Csd->ReO]: incorrect usage of autoconf diversions

2010-08-10 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=50291&edit=1

 ID: 50291
 Updated by: scott...@php.net
 Reported by:vapier at gentoo dot org
 Summary:incorrect usage of autoconf diversions
-Status: Closed
+Status: Re-Opened
 Type:   Bug
 Package:*Compile Issues
 Operating System:   Linux
 PHP Version:5.3.1
 Block user comment: N

 New Comment:

This got lost when we re-branched trunk from 5_3


Previous Comments:

[2010-01-23 08:49:47] ras...@php.net

This fix is only in HEAD.  You need autoconf <2.60 for 5.3


[2010-01-23 08:13:13] ram...@php.net

I'm having this problem with a fresh checkout (revision 293858) from 

the PHP_5_3 branch. I running on Mac OS X 10.6.2 and have autoconf 

2.65 from macports.



$ ./buildconf

$ ./configure

cat: confdefs.h: No such file or directory

./configure: line 389: ac_fn_c_try_run: command not found

./configure: line 405: 5: Bad file descriptor

./configure: line 406: 6: Bad file descriptor

cat: confdefs.h: No such file or directory

./configure: line 445: ac_fn_c_try_run: command not found

..



I'm not having the problem when running configure on the 5.3.1 tar 

package.


[2009-11-25 01:37:52] ras...@php.net

Thanks, this motivated me to clean up our m4 crap and make it work with
the latest versions of autoconf.  Should still clean up the template
warnings eventually, but those are non-fatal and everything builds
nicely now with autoconf-2.65 for me.


[2009-11-25 00:01:36] vapier at gentoo dot org

Description:

autoconf-2.64+ has changed behavior with diversions in such a way that
php breaks.  the autoconf documentation has explained that using these
functions with any diversion not explicitly documented is subject to
breakage, and php is doing just that.



http://www.gnu.org/software/autoconf/manual/autoconf.html#Diversion-support



you can also review the discussion on the autoconf lists:

http://lists.gnu.org/archive/html/bug-autoconf/2009-11/msg00045.html

Reproduce code:
---
the code can either be changed to stop using divert() completely (since
it doesnt seem to accomplish anything), or increase the numbers used to
something higher than 1000.

Actual result:
--
after regenerating autotools, we see:

$ ./configure

cat: confdefs.h: No such file or directory

./configure: line 410: ac_fn_c_try_run: command not found

./configure: line 426: 5: Bad file descriptor

./configure: line 427: 6: Bad file descriptor

cat: confdefs.h: No such file or directory

./configure: line 466: ac_fn_c_try_run: command not found

cat: confdefs.h: No such file or directory








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


Bug #52438 [Opn->Bgs]: Parser error on a simple example

2010-07-25 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=52438&edit=1

 ID: 52438
 Updated by: scott...@php.net
 Reported by:dagdamor10 at mail dot ru
 Summary:Parser error on a simple example
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Windows
 PHP Version:5.2.14
 Block user comment: N

 New Comment:

It's always been http://www.phpc.ru) uses automatic code generation, and
when I was fine-tuning it, I discovered a weird error in the PHP parser.

Test script:
---
This is a test.

Expected result:

Empty screen (since the function is never called)

Actual result:
--
Parse error: syntax error, unexpected $end in index.php on line 6





If you add a space character between "http://bugs.php.net/bug.php?id=52438&edit=1


Req #52352 [Opn->Bgs]: SQL Like Requests For Arrays

2010-07-15 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=52352&edit=1

 ID:   52352
 Updated by:   scott...@php.net
 Reported by:  larry dot diffey at gmail dot com
 Summary:  SQL Like Requests For Arrays
-Status:   Open
+Status:   Bogus
 Type: Feature/Change Request
 Package:  *Database Functions
 Operating System: Irrelevant
 PHP Version:  Irrelevant

 New Comment:

This works well with databases because they're indexed and have a
completely 

different data model to variables. In PHP internally they're hash
tables.


Previous Comments:

[2010-07-15 20:39:51] larry dot diffey at gmail dot com

Description:

It seems to me that it would make sense to at least apply the basic
features of the SQL ANSI standard to php arrays that are NOT derived
from another database.



To start with, it could support most of the features found within
SELECT, INSERT, UPDATE and DELETE at least from a single table.



Support could be added later for joins and other complex SQL commands.



Mimic the mysql commands in php. Suppose an array exists called $array.

$qry = php_query("SELECT * FROM $array where name = "Bill");

php_fetch_array($qry);



I believe such a feature would add to the overall ease of use of php,
especially for newer programmers and people coming from other languages
that are already familiar with SQL commands.











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


Bug #52262 [Asn->Csd]: json_decode reports no error while returning NULL

2010-07-06 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=52262&edit=1

 ID:   52262
 Updated by:   scott...@php.net
 Reported by:  r...@php.net
 Summary:  json_decode reports no error while returning NULL
-Status:   Assigned
+Status:   Closed
 Type: Bug
 Package:  JSON related
 Operating System: Linux/Ubuntu
 PHP Version:  5.3.2
 Assigned To:  scottmac

 New Comment:

It now correctly returns an error code to indicate an invalid UTF-8
error. The 

issue is an incorrectly encoded character around number 21,190.



I suggest you speak to Steam and get them to produce a correctly valid
feed.


Previous Comments:

[2010-07-06 19:01:35] scott...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=301028
Log: Fix bug #52262 - Invalid UTF-8 documents don't set an error code
when they fail to decode.


[2010-07-06 13:34:48] johan...@php.net

That codition in php_json_decode is hit as utf16_len == -2



utf16_len = utf8_to_utf16(utf16, str, str_len);

if (utf16_len <= 0) {

if (utf16) {

efree(utf16);

}

RETURN_NULL();

}


[2010-07-06 11:17:59] r...@php.net

Description:

I'm attempting to use json_decode on a relatively long piece of JSON.
The JSON 

is returned successfully by file_get_contents, and is valid according to


JSONLint.



What I expect to happen is for the JSON to be correctly decoded, or NULL
to be 

returned and json_last_error to be populated with the reason. For some
reason 

NULL is returned and json_last_error remains at 0.



I have a feeling that this could be to do with the length of the file 

(containing a large array of objects).



I'm currently using:



r...@ross-laptop:/$ php -v



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

Copyright (c) 1997-2009 The PHP Group

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

Test script:
---
http://api.steampowered.com/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v0001/?gameid=440";);



$decoded = json_decode($raw);



$errors = array(

JSON_ERROR_NONE => "No error has occurred",

JSON_ERROR_DEPTH => "The maximum stack depth has been exceeded",

JSON_ERROR_CTRL_CHAR => "Control character error, possibly
incorrectly encoded",

JSON_ERROR_SYNTAX => "Syntax error",

//JSON_ERROR_UTF8 => "Malformed UTF-8 characters, possibly
incorrectly encoded"

);



var_dump("Raw result:", $raw, "\n\n");

var_dump("Decoded result:", $decoded, "\n\n");

var_dump("JSON errors:", $errors[json_last_error()]);

Expected result:

Raw result: (long raw json)

Decoded result: object stdClass(1) { (data array) }

JSON errors: string "No error has occurred"

Actual result:
--
Raw result: (long raw json)

Decoded result: NULL

JSON errors: string "No error has occurred"






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


Bug #51706 [Asn]: Make fails dns.c:305: error: expected specifier-qualifier-list before ‘HEADER�

2010-05-01 Thread scottmac
Edit report at http://bugs.php.net/bug.php?id=51706&edit=1

 ID:   51706
 Updated by:   scott...@php.net
 Reported by:  keith at take88 dot com
-Summary:  Make fails dns.c:305: error: expected
   specifier-qualifier-list before ‘HEADERï
+Summary:  Make fails dns.c:305: error: expected
   specifier-qualifier-list before ‘HEADER�
 Status:   Assigned
 Type: Bug
 Package:  Compile Failure
 Operating System: Mac OS X 10.6.3
 PHP Version:  5.3.2
-Assigned To:  scottmac
+Assigned To:  jani

 New Comment:

Jani made the last changes to these :)


Previous Comments:

[2010-05-01 22:36:40] ka...@php.net

Scott, I remember you fixed some portability issues for the DNS
functions, namely on MAC could you look into this?


[2010-04-30 15:47:53] keith at take88 dot com

Description:

Here's the error when running 'make'

/Users/keith/php/php-5.3.2/ext/standard/dns.c:305: error: expected
specifier-qualifier-list before ‘HEADER’

/Users/keith/php/php-5.3.2/ext/standard/dns.c: In function
‘zif_dns_check_record’:

/Users/keith/php/php-5.3.2/ext/standard/dns.c:340: error: ‘T_MX’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:340: error: (Each
undeclared identifier is reported only once

/Users/keith/php/php-5.3.2/ext/standard/dns.c:340: error: for each
function it appears in.)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:360: error: ‘T_A’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:393: error: ‘C_IN’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c: In function
‘php_parserr’:

/Users/keith/php/php-5.3.2/ext/standard/dns.c:418: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:418: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:428: error: ‘T_ANY’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:468: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:468: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:513: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:513: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:519: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:519: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:636: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:636: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:652: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:652: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:674: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:674: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c: In function
‘zif_dns_get_record’:

/Users/keith/php/php-5.3.2/ext/standard/dns.c:710: error: ‘HEADER’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:710: error: ‘hp’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:810: error: ‘C_IN’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:810: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:817: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:818: error: ‘querybuf’
has no member named ‘qb2’

/Users/keith/php/php-5.3.2/ext/standard/dns.c:819: error: expected
expression before ‘)’ token

/Users/keith/php/php-5.3.2/ext/standard/dns.c: In function
‘zif_dns_get_mx’:

/Users/keith/php/php-5.3.2/ext/standard/dns.c:889: error: ‘HEADER’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:889: error: ‘hp’
undeclared (first use in this function)

/Users/keith/php/php-5.3.2/ext/standard/dns.c:927: error: ‘C_IN’
un

#50720 [Csd->Bgs]: Named subpatterns are not working with the syntax ? or ?'name', only wor

2010-01-11 Thread scottmac
 ID:   50720
 Updated by:   scott...@php.net
 Reported By:  andrew at coolboxcreative dot com
-Status:   Closed
+Status:   Bogus
 Bug Type: Regexps related
 Operating System: Linux
 PHP Version:  5.2.12


Previous Comments:


[2010-01-11 17:58:48] andrew at coolboxcreative dot com

The PCRE library is indeed an older version, so presume bug is down to

that



[2010-01-11 16:39:14] scott...@php.net

Check your phpinfo for the version of the PCRE library, I'm guessing
that the Redhat version is using an old copy from the system and not the
bundled PHP version.



[2010-01-11 16:33:37] andrew at coolboxcreative dot com

Description:

Named subpatterns are not working with the syntax ? or ?'name', 
only working with ?P

The newer syntax's work with version 5.2.9-2 (on windows) and 5.2.11 
(linux), but not version 5.2.12 (red hat)

Reproduce code:
---
http://www.coolboxcreative.com/demo/php_bug/source.txt

Expected result:

id =
classes = test_class

id = div_two
classes = another_class


Actual result:
--
nothing outputted


nb. in the application I am using this in I get the following error:

Compilation failed: unrecognized character after (?< at offset 7' in 






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



#50720 [Opn->Fbk]: Named subpatterns are not working with the syntax ? or ?'name', only wor

2010-01-11 Thread scottmac
 ID:   50720
 Updated by:   scott...@php.net
 Reported By:  andrew at coolboxcreative dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Regexps related
 Operating System: Linux
 PHP Version:  5.2.12
 New Comment:

Check your phpinfo for the version of the PCRE library, I'm guessing
that the Redhat version is using an old copy from the system and not the
bundled PHP version.


Previous Comments:


[2010-01-11 16:33:37] andrew at coolboxcreative dot com

Description:

Named subpatterns are not working with the syntax ? or ?'name', 
only working with ?P

The newer syntax's work with version 5.2.9-2 (on windows) and 5.2.11 
(linux), but not version 5.2.12 (red hat)

Reproduce code:
---
http://www.coolboxcreative.com/demo/php_bug/source.txt

Expected result:

id =
classes = test_class

id = div_two
classes = another_class


Actual result:
--
nothing outputted


nb. in the application I am using this in I get the following error:

Compilation failed: unrecognized character after (?< at offset 7' in 






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



#50707 [Bgs]: Sqlite3Result->columnType() always returns SQLITE3_NULL

2010-01-11 Thread scottmac
 ID:   50707
 Updated by:   scott...@php.net
 Reported By:  cagret at gmail dot com
 Status:   Bogus
 Bug Type: SQLite related
 Operating System: Win xp pro
 PHP Version:  5.3.1
 New Comment:

I believe you need to fetch a result for columnType to work since it
can be different for each row.

Perhaps querying sqlite_master would be easiest?


Previous Comments:


[2010-01-11 05:15:17] cagret at gmail dot com

What do you mean by "no type conversions have occured", "as described
below" > am I missing something? Where in my code am I making any type
conversions?

I don't quite understand, what is this function for, if it always
returns SQLITE3_NULL ?

I was creating a web based browser for sqlite3 database files, in
column headers I want to display column type:

Id (int) | Name (varchar)

That's all, what is the way of doing that?

I've found a solution, but it looks like a way around, using
columnType() would be easier. I am parsing the "CREATE TABLE..." sql
that i fetch by querying sqlite_master table, using a simple regexp.
Here is the function:

function sqlite3_columns($table)
{
global $db;
// $result->columnType(0) - bug, always returns SQLITE3_NULL
$query = sprintf("SELECT * FROM sqlite_master WHERE type='table' and
name='%s'", $table);
$result = $db->query($query);
$row = $result->fetchArray(SQLITE3_ASSOC);
$result->finalize();
$sql = $row['sql'];
preg_match_all('#[\(,]\s*(\w+)\s+(\w+)#', $sql, $pmatch);
$columns = array();
foreach ($pmatch[1] as $k => $colname) {
$columns[] = array('name'=>$colname, 'type'=>$pmatch[2][$k]);
}
return $columns;
}



[2010-01-11 02:47:53] il...@php.net

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

 The value returned by sqlite3_column_type() is only meaningful if no 
type conversions have occurred as described below. After a type 
conversion, the value returned by sqlite3_column_type() is undefined.



[2010-01-09 12:48:35] cagret at gmail dot com

Description:

Sqlite3Result->columnType() always returns SQLITE3_NULL.

Table structure:
CREATE TABLE IF NOT EXISTS Test (Id int primary key, Name varchar(50));

Reproduce code:
---
$query = sprintf('SELECT * FROM %s', $table);
$result = $db->query($query);
$columns = array();
$numcols = $result->numColumns();
for ($i = 0; $i < $numcols; $i++) {
$colname = $result->columnName($i);
$coltype = $result->columnType($i);
}

$coltype == 5 (SQLITE3_NULL) for each column.

Expected result:

SQLITE3_INTEGER or SQLITE3_TEXT

Actual result:
--
SQLITE3_NULL





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



#50674 [Opn->Bgs]: Zend_Db SQL-Server query leaves results pending

2010-01-05 Thread scottmac
 ID:   50674
 Updated by:   scott...@php.net
 Reported By:  wayne dot dean at opticsplanet dot com
-Status:   Open
+Status:   Bogus
 Bug Type: PDO related
 Operating System: 2.6.24-24-server
 PHP Version:  5.3.1
 New Comment:

This should be reported to the Zend Framework bug tracker, this is the
PHP bug tracker.


Previous Comments:


[2010-01-05 21:46:44] wayne dot dean at opticsplanet dot com

Description:

Zend_Db: When executing stored procedure on SQL Server from loop,
subsequent queries in loop return Zend_Db_Statement_Exception:
SQLSTATE[HY000]: General error: 20019 Attempt to initiate a new SQL
Server operation with results pending. [20019]

Current workaround is to reconnect after each loop iteration, which is
expensive.

Reproduce code:
---
$db = $this->getAdapter();
foreach($data as $k => $v){
$sql = "EXECUTE sp_DoSomething {$db->quote($k)},
{$db->quote($v)}";
$result = $db->query($sql)->fetchAll();
}

Expected result:

Successful execution of stored procedure during each loop iteration.

Actual result:
--
First execution in loop succeeds, but subsequent executions return
Zend_Db_Statement_Exception: SQLSTATE[HY000]: General error: 20019
Attempt to initiate a new SQL Server operation with results pending.
[20019]





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



#50571 [Fbk]: Performance Mysqli in php 5.3.1 signific slower than 5.2.6

2009-12-24 Thread scottmac
 ID:   50571
 Updated by:   scott...@php.net
 Reported By:  millennium at qme dot nl
 Status:   Feedback
 Bug Type: MySQLi related
 Operating System: Windows Server 2003
 PHP Version:  5.3.1
 New Comment:

Can you adjust your test to see if its the connection, the query or the
closing that's causing the problems?


Previous Comments:


[2009-12-24 23:26:32] millennium at qme dot nl

C:\php2>php sync.php
time: 28.37 secs, memory usage 0.40 MiB.

C:\php2>php -v
PHP 5.3.2-dev (cli) (built: Dec 22 2009 09:57:39)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies



[2009-12-24 23:19:05] j...@php.net

Please try using this snapshot:

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

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





[2009-12-24 23:01:39] millennium at qme dot nl

Description:

The performance of Mysqli in php5.3.1(mysqlnd) is signific slower than

the performance in php 5.2.6. (I know it's not the best code, but it's

in production, and I would expect 5.3.1 is as fast as 5.2.6 or faster.

Reproduce code:
---


Expected result:

time: 1.83 secs, memory usage 0.15 MiB. (php 5.2.6)

Actual result:
--
time: 29.82 secs, memory usage 0.40 MiB





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



#50564 [Opn->Bgs]: Warning: Unexpected character in input: '\' (ASCII=92) state=1 in ...

2009-12-23 Thread scottmac
 ID:   50564
 Updated by:   scott...@php.net
 Reported By:  wyattstorch42 at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Strings related
 Operating System: Linux
 PHP Version:  5.2.12
 New Comment:

Works here in PHP 5.3.2-rc1. The usual reason for this happening is an
incorrect number of concurrent backslashes.


Previous Comments:


[2009-12-23 18:32:22] wyattstorch42 at gmail dot com

Description:

Hello,

I have slaved over this one line of code and confirmed that there is
absolutely nothing wrong with it. I have even modified it and received
the same error. The error even persists when the line is commented out.

I receive a parse error as well as a warning for the backslash.

Reproduce code:
---


Expected result:

I expected the value of $contents to be:
http://bugs.php.net/?id=50564&edit=1



#50535 [Bgs]: Undocumented and unintended? behaviour

2009-12-20 Thread scottmac
 ID:   50535
 Updated by:   scott...@php.net
 Reported By:  bobkellock at gofast dot co dot uk
 Status:   Bogus
 Bug Type: GD related
 Operating System: Win XP SP2
 PHP Version:  5.2.12
 New Comment:

Some browsers display the word Image when they can't correct display an
image, such as when there is an error :)


Previous Comments:


[2009-12-20 13:14:41] ras...@php.net

Try the same thing without the Content-type header and I bet you will 
see an error instead of a broken image.  That error is why it isn't 
working.  There is no bug here.  Those GD functions have worked in PHP

for 10+ years assuming you have GD support available with JPEG support

compiled in.



[2009-12-20 10:23:16] bobkellock at gofast dot co dot uk

I object strongly to your comment "This bug report makes no sense".

Just try:


which generates the spurious display where xxx.jpg is known to be a
valid jpeg.

Please note that this is using v5.2.10. I had to give an incorrect
version number because the bug reporter would not allow me to submit the
report with that number in the Version box and I have no control over
the version available from my web host.



[2009-12-20 07:03:10] ras...@php.net

Are you sure your image isn't actually broken?  Where would the string,

"Image" come from?

And why do you think you can emit a header after you have sent the 
image?  

This bug report makes no sense, sorry.



[2009-12-20 01:03:11] bobkellock at gofast dot co dot uk

Description:

PHP version is actually 5.2.10 which is what is run on the server at
One.com but is due to be upgraded to 5.3 on 2010-01-04.

imagecreatefromjpeg and other imagecreatefromxxx functions put up
"Image" in a small rectangle on the centre of the screen.

This is unsightly in my application which simply creates the image and
overlays it with some text using imagestring followed by writing the
overlaid image to a file. i.e. the original or overlaid image is never
written to the screen.

Bob Kellock

Reproduce code:
---
   header('Content-Type: image/jpg');
   $serial = "CL1949F";  // normally passed as a session variable
   $img = imagecreatefromjpeg('blankorder.jpg');
   $textcolour = imagecolorallocate($img, 0, 0, 0);
   $font = imageloadfont('Arial24.gdf');
   imagestring($img, $font, 535, 312, $serial, $textcolour);
   imagejpeg($img,'orderform.jpg');
   imagedestroy($img);
   header('refresh: 0; url=stamped.html');  // redirect to new page


Expected result:

Creation of overlaid file - which works OK.
Screen should be blank. 

Actual result:
--
"Image" in a small rectangle is displayed





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



#50406 [Opn->Bgs]: Curl causing high cpu usage

2009-12-07 Thread scottmac
 ID:   50406
 Updated by:   scott...@php.net
 Reported By:  matthew at crasxit dot net
-Status:   Open
+Status:   Bogus
 Bug Type: cURL related
 Operating System: Windows 2008
 PHP Version:  5.3.1
 New Comment:

There is a lot of initialisation code within the curl module that needs
to be run when PHP is started. It's a one time cost when using fastcgi /
apache but with CLI you get it on every script executed.



Previous Comments:


[2009-12-08 04:07:51] matthew at crasxit dot net

Description:

I'm having an issue with curl on windows with php. If i have curl
enabled in php and i run php through command line i get an instant cpu
spike... php.exe cpu jumps to about 20% then back down. when i disable
curl it only jumps to about 2%
it does this on non curl scripts. even if i run a blank php file or php
-i it jumps to 20... however httpd.exe using apache2_2.dll seems to be
fine (~2%)

extensions loaded:
curl (problem with curl, fine without)
gd2
mbstring
mysql
mysqli
openssl


Reproduce code:
---
any code






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



#50399 [Asn]: segfault when using SAPI

2009-12-07 Thread scottmac
 ID:   50399
 Updated by:   scott...@php.net
 Reported By:  ikickdogsforfun at hotmail dot com
 Status:   Assigned
 Bug Type: Scripting Engine problem
 Operating System: Debian 5
 PHP Version:  5.3.1
 Assigned To:  dmitry
 New Comment:

Can you try using the following within php_set_superglobal_server as
the way to modify the _SERVER value.

php_register_variable_ex("name", type,
PG(http_globals)[TRACK_VARS_SERVER]);


Also you don't need to destroy the servers zval, it will be handled by
php_embed_shutdown()


Previous Comments:


[2009-12-07 15:33:32] paj...@php.net

Dmitry, can you take a look at it pls?



[2009-12-07 15:28:19] ikickdogsforfun at hotmail dot com

I added that line to my php.ini and checked phpinfo(); which showed
zend.gc=off
Still having the same problem I'm afraid and valgrind output shows
segfault at the same location.



[2009-12-07 14:20:40] paj...@php.net

Can you try with:

zend.enable_gc=Off

In your php.ini please?



[2009-12-07 13:56:16] ikickdogsforfun at hotmail dot com

Description:

When using PHP SAPI and values have been added to the global $_SERVER
variable, shutdown segfaults in zend_gc. If I remove the setting of the
global variables it doesn't seg fault.
This is possibly not a fault the SAPI, but I've been unable to resolve,
removing the destroy and free commands in shutdown function doesn't stop
it from segfaulting.

Reproduce code:
---
The entire source code file is available at
https://crispycrisp.org/php.txt this is the function that causes a
segfault in shutdown if it has been called:
void php_set_superglobal_server(char *name, char *val)
{
zend_first_try {
HashTable* locals = &EG(symbol_table);

zval *type;

/* Fetch $_SERVER from the global scope */
zend_hash_find(locals, "_SERVER", sizeof("_SERVER"),
 (void**)&SERVER);

ALLOC_INIT_ZVAL(type);
ZVAL_STRING(type, val, 1);
ZEND_SET_SYMBOL(Z_ARRVAL_PP(SERVER), name, type);
} zend_end_try();
}

Expected result:

No segfault

Actual result:
--
==17605== Thread 2:
==17605== Invalid read of size 4
==17605==at 0x43B4BB9: gc_remove_zval_from_buffer (zend_gc.h:189)
==17605==by 0x438E18F: _zval_ptr_dtor (zend_execute_API.c:434)
==17605==by 0x43A4C7D: zend_hash_destroy (zend_hash.c:526)
==17605==by 0x804A88A: php_shutdown (php.c:143)
==17605==by 0x804A955: php (php.c:168)
==17605==by 0x8049D94: parsing_request (handler.c:180)
==17605==by 0x80496FE: handle (handler.c:25)
==17605==by 0x4032F3A: start_thread (in /lib/libpthread-2.7.so)
==17605==by 0x4793BED: clone (in /lib/libc-2.7.so)
==17605==  Address 0x1c is not stack'd, malloc'd or (recently) free'd
==17605==
==17605== Process terminating with default action of signal 11
(SIGSEGV)
==17605==  Access not within mapped region at address 0x1C
==17605==at 0x43B4BB9: gc_remove_zval_from_buffer (zend_gc.h:189)
==17605==by 0x438E18F: _zval_ptr_dtor (zend_execute_API.c:434)
==17605==by 0x43A4C7D: zend_hash_destroy (zend_hash.c:526)
==17605==by 0x804A88A: php_shutdown (php.c:143)
==17605==by 0x804A955: php (php.c:168)
==17605==by 0x8049D94: parsing_request (handler.c:180)
==17605==by 0x80496FE: handle (handler.c:25)
==17605==by 0x4032F3A: start_thread (in /lib/libpthread-2.7.so)
==17605==by 0x4793BED: clone (in /lib/libc-2.7.so)





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



#50352 [Asn]: error: structure has no member named `res_h_errno'

2009-12-01 Thread scottmac
 ID:   50352
 Updated by:   scott...@php.net
 Reported By:  admin at phpcode dot us
 Status:   Assigned
 Bug Type: Compile Failure
 Operating System: OpenBSD current
 PHP Version:  5.3.1
 Assigned To:  scottmac
 New Comment:

Well the structure isn't in the 5.3 snapshot any more so no error is 
possible.

Unless he did something different or didn't grab the correct snapshot?


Previous Comments:


[2009-12-01 19:54:20] j...@php.net

Scott, are you really sure it's fixed? He tried latest snapshot..or are
those not from 5.3 branch anymore?



[2009-12-01 19:37:29] scott...@php.net

http://svn.php.net/viewvc?view=revision&revision=289691

Duplicate of bug #49224



[2009-12-01 19:10:53] admin at phpcode dot us

scottmac
Can i see diff between 5.3.1 and 5.3.2 what fixes this bug?



[2009-12-01 19:07:32] scott...@php.net

It's fixed in 5.3.2 but was never backported to the 5.3.1 stable
branch.



[2009-12-01 19:02:32] j...@php.net

On second though, assigning to Scott who broke this with his OSX
"fixes".



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

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



#50352 [Asn->Bgs]: error: structure has no member named `res_h_errno'

2009-12-01 Thread scottmac
 ID:   50352
 Updated by:   scott...@php.net
 Reported By:  admin at phpcode dot us
-Status:   Assigned
+Status:   Bogus
 Bug Type: Compile Failure
 Operating System: OpenBSD current
 PHP Version:  5.3.1
 Assigned To:  scottmac
 New Comment:

http://svn.php.net/viewvc?view=revision&revision=289691

Duplicate of bug #49224


Previous Comments:


[2009-12-01 19:10:53] admin at phpcode dot us

scottmac
Can i see diff between 5.3.1 and 5.3.2 what fixes this bug?



[2009-12-01 19:07:32] scott...@php.net

It's fixed in 5.3.2 but was never backported to the 5.3.1 stable
branch.



[2009-12-01 19:02:32] j...@php.net

On second though, assigning to Scott who broke this with his OSX
"fixes".



[2009-12-01 15:00:56] admin at phpcode dot us

HAVE_DNS_SEARCH, HAVE_RES_SEARCH and HAVE_RES_NSEARCH is not defined in
main/php_config.h.

HAVE_RESOLV_H is defined as 1 in main/php_config.h.



[2009-12-01 14:40:42] j...@php.net

And also what is HAVE_RESOLV_H defined to?



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

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



#50352 [Asn]: error: structure has no member named `res_h_errno'

2009-12-01 Thread scottmac
 ID:   50352
 Updated by:   scott...@php.net
 Reported By:  admin at phpcode dot us
 Status:   Assigned
 Bug Type: Compile Failure
 Operating System: OpenBSD current
 PHP Version:  5.3.1
 Assigned To:  scottmac
 New Comment:

It's fixed in 5.3.2 but was never backported to the 5.3.1 stable
branch.


Previous Comments:


[2009-12-01 19:02:32] j...@php.net

On second though, assigning to Scott who broke this with his OSX
"fixes".



[2009-12-01 15:00:56] admin at phpcode dot us

HAVE_DNS_SEARCH, HAVE_RES_SEARCH and HAVE_RES_NSEARCH is not defined in
main/php_config.h.

HAVE_RESOLV_H is defined as 1 in main/php_config.h.



[2009-12-01 14:40:42] j...@php.net

And also what is HAVE_RESOLV_H defined to?



[2009-12-01 14:39:09] j...@php.net

Was the error on exactly same line as well? And what do you have for
these in your main/php_config.h: HAVE_DNS_SEARCH, HAVE_RES_SEARCH and
HAVE_RES_NSEARCH ? 



[2009-12-01 13:39:03] admin at phpcode dot us

I'm try it, error repeat!



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

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



#39635 [Opn->Asn]: Better control for serialization (keyword for permit property serialization)

2009-11-09 Thread scottmac
 ID:   39635
 Updated by:   scott...@php.net
 Reported By:  t dot prochazka at centrum dot cz
-Status:   Open
+Status:   Assigned
 Bug Type: Feature/Change Request
 Operating System: all
 PHP Version:  5CVS-2006-11-26 (CVS)
-Assigned To:  
+Assigned To:  scottmac
 New Comment:

Patch already exists, just need to discuss when is the correct time to
add it.

http://whisky.macvicar.net/patches/php-transient.diff.txt


Previous Comments:


[2009-11-09 15:53:54] tjerkw at gmail dot com

Using a transient keyword is better because if we have the following 
case:

class A { $a; $b; }
class B extends A { $c  function __sleep() { return array("c"); } }

now if you serialize b you will not serialize the $a and $b members
from 
class A. So the sleep functions actually changes the encapsulated 
behaviour of A. Or we should call the superclass A::__sleep() method
and 
join that with the new arrow.
However this is much cleaner code. And wether a member is transient or

not should be declered nearby the member to keep else other developers

may not now wether the member will be serialized or not.



[2007-01-25 15:54:50] spam at thishell dot com

While it is possible to exclude members from serialization using
__sleep(), it has downsides:
- Using get_object_vars($this) to return the members is extremely slow
- Manually maintaining an array with the members is error prone and can
be quite some work

A transient keyword to exclude members from serialization would make it
easier ...



[2006-11-26 11:40:40] t dot prochazka at centrum dot cz

Description:

PHP has no advanced support for serialization.

I think, that is problem, that PHP serialize all properties. What about
add single keyword (as transient) for property which can't be
serializable?

Example:

class Foo {
 
 public $a;
 public transient $b;

}

Description of Java transient keyword:

http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78119






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



#50118 [Opn->Bgs]: htmlspecialchars parsing HTML5+XML

2009-11-09 Thread scottmac
 ID:   50118
 Updated by:   scott...@php.net
 Reported By:  floder at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: DOM XML related
 Operating System: all
 PHP Version:  5.3.1RC3
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of bug #50106


Previous Comments:


[2009-11-09 08:32:34] floder at gmail dot com

Description:

Problem with htmlspecialchars PHP function.
In HTML5 are allowed only numeric entities. 
In XML parsing mode browser interrupts errors. 

Reproduce code:
---
<=htmlspecialchars('&')>

Expected result:

¡'&' (ampersand) becomes '&' 
¡'"' (double quote) becomes '"' 
¡''' (single quote) becomes ''' 
¡'<' (less than) becomes '<' 
¡'>' (greater than) becomes '>' 

Actual result:
--
¡'&' (ampersand) becomes '&' 
¡'"' (double quote) becomes '"'
¡''' (single quote) becomes '''
¡'<' (less than) becomes '<' 
¡'>' (greater than) becomes '>' 





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



#50068 [Bgs]: const problem

2009-11-03 Thread scottmac
 ID:   50068
 Updated by:   scott...@php.net
 Reported By:  jachym dot tousek at gmail dot com
 Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: Windows 7
 PHP Version:  5.3.1RC3
 New Comment:

const is a compile time constant and only allows simple scalar values.

define is a constant resolved at runtime and it allows full expressions
when being defined.


Previous Comments:


[2009-11-03 22:26:15] jachym dot tousek at gmail dot com

Well i've checked
[http://www.php.net/manual/en/language.constants.syntax.php] and also
updated from 5.3.0 to 5.3.1RC3 before sending this report, but there is
nothing about const name = 'value'; being different from
define('name','value'); and i can not understand it even now.



[2009-11-03 21:46:58] fel...@php.net

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





[2009-11-03 21:11:32] ksin...@php.net

I think this behavior is by design. const expressions are evaluated at
compile time. So only few operations are supported in a const expression
and string concatenation is not one of those. I could repro this in PHP
5.2 (after putting it under a class).



[2009-11-03 20:16:44] jachym dot tousek at gmail dot com

Description:

const is not working

Reproduce code:
---
http://bugs.php.net/?id=50068&edit=1



#50057 [Fbk]: crash in _php_pgsql_notice_ptr_dtor -> efree with Horde

2009-11-03 Thread scottmac
 ID:   50057
 Updated by:   scott...@php.net
 Reported By:  proforg at maloletka dot ru
 Status:   Feedback
 Bug Type: PostgreSQL related
 Operating System: Debian Lenny 2.6.26-2-amd64
 PHP Version:  5.2SVN-2009-11-02 (snap)
 New Comment:

Can you provide a reproduce script and also would it be possible to run
what you have through valgrind to get a better memory trace.


Previous Comments:


[2009-11-04 00:55:39] proforg at maloletka dot ru

php5.2-200911032130
configure options: --enable-fastcgi --enable-force-cgi-redirect
--with-pgsql --with-pear=/usr/share/php/ --enable-debug  --with-imap
--with-
kerberos --with-imap-ssl --with-gettext

run options: /usr/local/bin/php-cgi -b 127.0.0.1:9919 -c
/etc/php5/fpm/

backtrace:

[New process 4752]
#0  0x006fc288 in zend_mm_check_ptr (heap=0xcd8390, ptr=0x1,
silent=1, __zend_filename=0x830c38 "/usr/local/src/php5.2-
200911032130/ext/pgsql/pgsql.c", 
__zend_lineno=379, __zend_orig_filename=0x0, __zend_orig_lineno=0)
at /usr/local/src/php5.2-200911032130/Zend/zend_alloc.c:1304
1304if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev)
{

(gdb) bt
#0  0x006fc288 in zend_mm_check_ptr (heap=0xcd8390, ptr=0x1,
silent=1, __zend_filename=0x830c38 "/usr/local/src/php5.2-
200911032130/ext/pgsql/pgsql.c", 
__zend_lineno=379, __zend_orig_filename=0x0, __zend_orig_lineno=0)
at /usr/local/src/php5.2-200911032130/Zend/zend_alloc.c:1304
#1  0x006fdd2e in _zend_mm_free_int (heap=0xcd8390, p=0x1,
__zend_filename=0x830c38 "/usr/local/src/php5.2-
200911032130/ext/pgsql/pgsql.c", __zend_lineno=379, 
__zend_orig_filename=0x0, __zend_orig_lineno=0) at
/usr/local/src/php5.2-200911032130/Zend/zend_alloc.c:1943
#2  0x006ff2ca in _efree (ptr=0x1, __zend_filename=0x830c38
"/usr/local/src/php5.2-200911032130/ext/pgsql/pgsql.c",
__zend_lineno=379, 
__zend_orig_filename=0x0, 
__zend_orig_lineno=0) at
/usr/local/src/php5.2-200911032130/Zend/zend_alloc.c:2311
#3  0x0056e2f0 in _php_pgsql_notice_ptr_dtor (ptr=0x134b848) at
/usr/local/src/php5.2-200911032130/ext/pgsql/pgsql.c:379
#4  0x0072c591 in zend_hash_clean (ht=0xb12388) at
/usr/local/src/php5.2-200911032130/Zend/zend_hash.c:552
#5  0x0056eb8e in zm_deactivate_pgsql (type=1,
module_number=14) at
/usr/local/src/php5.2-200911032130/ext/pgsql/pgsql.c:578
#6  0x00726f19 in module_registry_cleanup (module=0xd041d0) at
/usr/local/src/php5.2-200911032130/Zend/zend_API.c:1976
#7  0x0072cdf9 in zend_hash_reverse_apply (ht=0xb16760,
apply_func=0x726ede ) at
/usr/local/src/php5.2-
200911032130/Zend/zend_hash.c:755
#8  0x0071e481 in zend_deactivate_modules () at
/usr/local/src/php5.2-200911032130/Zend/zend.c:838
#9  0x006c6258 in php_request_shutdown (dummy=0x0) at
/usr/local/src/php5.2-200911032130/main/main.c:1474
#10 0x007a6ce5 in main (argc=5, argv=0x7fff3f4b5eb8) at
/usr/local/src/php5.2-200911032130/sapi/cgi/cgi_main.c:2057



[2009-11-03 12:33:45] proforg at maloletka dot ru

Yes, definitely, same result at least with apache2 sapi.
I'll try to have some more tests and backtraces with clear cgi-fcgi
sapi 
later today,



[2009-11-03 10:45:38] j...@php.net

Can you reproduce this without the 3rd party patches? (no, we do not
support this FPM thing!)



[2009-11-03 02:22:59] proforg at maloletka dot ru

the same for 5.2.10 and 5.2.11
but 5.2.9 works fine



[2009-11-02 23:10:30] proforg at maloletka dot ru

Description:

php5.2-200911021930 + apache2 / fpm sapi frequently crashes on debian 
horde3 + imp4 installation.

Reproduce code:
---
Current debian horde and imp packages.

Actual result:
--
fpm log output:

Nov 03 01:51:13.738647 [WARNING] fpm_children_bury(), line 217: child 
19892 (pool www-data) exited on signal 11 SIGSEGV (core 
dumped) after 2377.432524 seconds from start
Nov 03 01:51:13.738687 [WARNING] fpm_stdio_child_said(), line 167: 
child 19892 (pool www-data) said into stderr: "[Tue Nov  3 
01:36:48 2009]  Script:  '/usr/share/horde3//index.php'"
Nov 03 01:51:13.738716 [WARNING] fpm_stdio_child_said(), line 167: 
child 19892 (pool www-data) said into stderr: 
"/usr/local/src/php5.2-200911021930/ext/pgsql/pgsql.c(289) :  Freeing 
0x029A97C0 (46 bytes), 
script=/usr/share/horde3//index.php", pipe is closed
Nov 03 01:51:13.738738 [WARNING] fpm_stdio_child_said(), line 167: 
child 19892 (pool www-data) said into stderr: "[Tue Nov  3 
01:36:48 2009]  Script:  '/usr/share/horde3//index.php'", pipe is 
closed
Nov 03 01:51:13.738758 [WARNING] fpm_stdio_child_said(), line 167: 
child 19892 

#50060 [Bgs]: "failed creating formpost data" if post array value starts with '@'

2009-11-03 Thread scottmac
 ID:   50060
 Updated by:   scott...@php.net
 Reported By:  bugs dot php dot net at sgerrand dot com
 Status:   Bogus
 Bug Type: cURL related
 Operating System: Linux (Ubuntu x86_64 2.6.31-14)
 PHP Version:  5.2.11
 New Comment:

-d is for the whole data, what we really have here is -F for formdata.

curl -F 'k...@value' http://www.php.net/


Previous Comments:


[2009-11-03 10:44:13] bugs dot php dot net at sgerrand dot com

Please refer to the documentation for curl_setopt() - 
http://php.net/curl_setopt

CURLOPT_POSTFIELDS   The full data to post in a HTTP "POST" 
operation. To post a file, prepend a filename with @ and use the full 
path. This can either be passed as a urlencoded string like 
'para1=val1¶2=val2&...' or as an array with the field name as key 
and field data as value. If value is an array, the Content-Type header

will be set to multipart/form-data.

The case I have logged is when data to be posted using this option is 
an array which happens to have a value that starts with '@', as per 
the example. This edge case is being caused by the function used to 
create the form data to pass to cURL.

I would note that the cURL command line client on any POSIX system can

perform this without issue - i.e.: 

curl -d 'k...@value' http://www.php.net/



[2009-11-03 10:18:06] scott...@php.net

@ has a special meaning with cURL and takes the contents of the file.



[2009-11-03 07:29:36] bugs dot php dot net at sgerrand dot com

Description:

PHP's cURL library dies returning the error message "failed creating 
formpost data" when trying to use an array that contains a value 
starting with '@'. 

If the array is changed to a string in URL encoded like format, the 
problem does not occur.

Reproduce code:
---
http://www.php.net';
$postData = array('key' => '@value');
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

if (! curl_exec($ch) ) print 'cURL error: ' . curl_error($ch);
else print "cURL success";

curl_close($ch);

?>

Expected result:

cURL success

Actual result:
--
cURL error: failed creating formpost data





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



#49997 [Opn->Fbk]: Implementing a namespaced interface crashes

2009-11-03 Thread scottmac
 ID:   49997
 Updated by:   scott...@php.net
 Reported By:  flavius dot as at gmail dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Reproducible crash
 Operating System: Linux x86_64
 PHP Version:  5.3.0
 New Comment:

Please try using this snapshot:

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

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

There was a fix for autoload crashing on an interface in bug #49908


Previous Comments:


[2009-11-03 05:59:15] flavius dot as at gmail dot com

Could someone do something with this report?



[2009-11-03 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".



[2009-10-28 19:30:23] flavius dot as at gmail dot com

Sorry for the incomplete post.

This happens in my scripts because it's trying to autoload an
interface.
My code was indeed buggy, but I woudn't expect PHP to crash.



[2009-10-28 19:27:29] flavius dot as at gmail dot com

After some debugging, I came to the conclusion that it crashes because
of an exception being thrown inside a spl_register_autoload()'ed
userland method.

Here's the bt:

#0  zend_lookup_class_ex (name=0x15b9d40 "Exception", name_length=9,
use_autoload=1, ce=0x7fffb2e0) at
/home/flav/php-5.3.0/Zend/zend_execute_API.c:1016
#1  0x007954d1 in zend_fetch_class (class_name=0x15b9d40
"Exception", class_name_len=9, fetch_type=4)
at /home/flav/php-5.3.0/Zend/zend_execute_API.c:1524
#2  0x007d8d22 in ZEND_FETCH_CLASS_SPEC_CONST_HANDLER
(execute_data=0x76552cc0) at
/home/flav/php-5.3.0/Zend/zend_vm_execute.h:724
#3  0x007d6b50 in execute (op_array=0x15bc828) at
/home/flav/php-5.3.0/Zend/zend_vm_execute.h:104
#4  0x007940e5 in zend_call_function (fci=0x7fffb640,
fci_cache=0x7fffb5d0) at
/home/flav/php-5.3.0/Zend/zend_execute_API.c:936
#5  0x007bfae4 in zend_call_method (object_pp=0x0,
obj_ce=0x15b8eb0, fn_proxy=0x15b09f8, function_name=0x15ba410
"\\yap\\base::autoload",
function_name_len=20, retval_ptr_ptr=0x7fffb748, param_count=1,
arg1=0x15f8930, arg2=0x0) at
/home/flav/php-5.3.0/Zend/zend_interfaces.c:97
#6  0x00600de0 in zif_spl_autoload_call (ht=1,
return_value=0x161c620, return_value_ptr=0x7fffba70, this_ptr=0x0,
return_value_used=1)
at /home/flav/php-5.3.0/ext/spl/php_spl.c:395
#7  0x007942c2 in zend_call_function (fci=0x7fffba20,
fci_cache=0x7fffb9f0) at
/home/flav/php-5.3.0/Zend/zend_execute_API.c:958
#8  0x00794999 in zend_lookup_class_ex (name=0x15f8a30
"YAP\\patterns\\IInheritable", name_length=25, use_autoload=1,
ce=0x7fffbb20)
at /home/flav/php-5.3.0/Zend/zend_execute_API.c:1089
#9  0x007954d1 in zend_fetch_class (class_name=0x15f8a30
"YAP\\patterns\\IInheritable", class_name_len=25, fetch_type=6)
at /home/flav/php-5.3.0/Zend/zend_execute_API.c:1524
#10 0x007d93d3 in ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER
(execute_data=0x76552bb8) at
/home/flav/php-5.3.0/Zend/zend_vm_execute.h:890
#11 0x007d6b50 in execute (op_array=0x15f68c8) at
/home/flav/php-5.3.0/Zend/zend_vm_execute.h:104
#12 0x007a38de in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/flav/php-5.3.0/Zend/zend.c:1188
#13 0x0072ed19 in php_execute_script
(primary_file=0x7fffe1b0) at /home/flav/php-5.3.0/main/main.c:2196
#14 0x0088c885 in main (argc=7, argv=0x7fffe408) at
/home/flav/php-5.3.0/sapi/cli/php_cli.c:1188



[2009-10-26 16:54:38] flavius dot as at gmail dot com

Done. The output:

Reading symbols from /home/flav/php-5.3.0/sapi/cli/php...done.
(gdb) run /usr/bin/phpunit --bootstrap bootstrap.php --configuration
phpunit.xml testunit/
Starting program: /home/flav/php-5.3.0/sapi/cli/php /usr/bin/phpunit
--bootstrap bootstrap.php --configuration phpunit.xml testunit/
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x007d93db in ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER
(execute_data=0x765529a8) at
/home/flav/php-5.3.0/Zend/zend_vm_execute.h:892
892 if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
(gdb) bt
#0  0x007d93db in ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER
(execute_data=0x765529a8) at
/home/flav/php-5.3.0/Zend/zend_vm_execute.h:892
#1  0x007d6b50 in execute (op_array=0x161f078) at
/home/flav/php-5.3.0/Zend/zend_vm_execute.h:104
#2  0x007a38de in zend_exe

#50060 [Opn->Bgs]: "failed creating formpost data" if post array value starts with '@'

2009-11-03 Thread scottmac
 ID:   50060
 Updated by:   scott...@php.net
 Reported By:  bugs dot php dot net at sgerrand dot com
-Status:   Open
+Status:   Bogus
 Bug Type: cURL related
 Operating System: Linux (Ubuntu x86_64 2.6.31-14)
 PHP Version:  5.2.11
 New Comment:

@ has a special meaning with cURL and takes the contents of the file.


Previous Comments:


[2009-11-03 07:29:36] bugs dot php dot net at sgerrand dot com

Description:

PHP's cURL library dies returning the error message "failed creating 
formpost data" when trying to use an array that contains a value 
starting with '@'. 

If the array is changed to a string in URL encoded like format, the 
problem does not occur.

Reproduce code:
---
http://www.php.net';
$postData = array('key' => '@value');
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

if (! curl_exec($ch) ) print 'cURL error: ' . curl_error($ch);
else print "cURL success";

curl_close($ch);

?>

Expected result:

cURL success

Actual result:
--
cURL error: failed creating formpost data





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



#49332 [Asn->Csd]: Make fails with "Undefined symbols: _res_9_dn_expand, _res_9_search and _res_9"

2009-10-16 Thread scottmac
 ID:   49332
 Updated by:   scott...@php.net
 Reported By:  vizh at me dot com
-Status:   Assigned
+Status:   Closed
 Bug Type: Compile Failure
 Operating System: Mac OS X 10.6 (10A432)
 PHP Version:  5.2.10
 Assigned To:  scottmac
 New Comment:

This bug has been fixed in SVN.

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




Previous Comments:


[2009-10-16 16:09:50] s...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=289700
Log: Fix bug #49332 - Unable to compile with Snow Leopard due to some
DNS funsies



[2009-09-26 22:56:07] phi...@php.net

Another temp fix: Add -lresolv to EXTRA_LIBS in the generated MakeFile.

See also: http://bit.ly/SJ3YQ



[2009-09-07 05:18:55] tmallen at 703designs dot com

Here's a temporary fix: http://trac.macports.org/ticket/19997



[2009-08-26 00:51:27] djem dot v3 at gmail dot com

Since php 5.3 has been preinstalled in Snow Leopard, it is very 
important to have php 5.2 in system.



[2009-08-24 14:43:24] j...@php.net

I would guess Scott meant "PHP_5_2" branch.. :)



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

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



#49687 [Opn]: utf8_decode xml_utf8_decode vuln

2009-10-15 Thread scottmac
 ID:   49687
 Updated by:   scott...@php.net
 Reported By:  sird at rckc dot at
 Status:   Open
 Bug Type: *Unicode Issues
 Operating System: *
 PHP Version:  5.2.11
-Assigned To:  
+Assigned To:  scottmac
 New Comment:

PHP 5 has binary strings, not utf-8 strings. It does not attempt to do
any validation on input, so expecting addslashes to magically validate
things as utf-8 is wrong, simple as.

I agree that utf8_decode should do proper validation here though the
overhead of doing that validation is going to be slow. So I've coded up
a utf8_validate function. Still need to sort out some of the behaviour
first.


Previous Comments:


[2009-10-16 03:41:30] sird at rckc dot at

oops!

you are right, :) the code before was unsigned short.

still, the other vulnerabilities remain.

I've made a blogpost that explains the other issues ;)

http://sirdarckcat.blogspot.com/2009/10/couple-of-unicode-issues-on-php-and.html

I updated the post to note the last bug was fixed on 5.2.11

Greetings!!



[2009-10-16 03:32:19] scott...@php.net

On a 16-bit processor an int might be 16-bit, if you can get PHP to
compile then well done :-)

Did you even try running the test code?



[2009-10-16 01:36:27] sird at rckc dot at

: ras...@php.net

It has come to my attention that this hasn't been fixed..

unsigned int has a size of 16 bits, don't take my word for it

http://www.acm.uiuc.edu/webmonkeys/book/c_guide/1.2.html

Section: 1.2.2 Variables

unsigned int16 bits

I just downloaded PHP 5.2.11, and I quote the code:


//  php-5.2.11.tar.bz2/php-5.2.11/ext/xml/xml.c#558
PHPAPI char *xml_utf8_decode(//  ...
{
int pos = len;
char *newbuf = emallo//  ...
unsigned int c;  // sizeof(unsigned int)==16 bits
char (*decoder)(unsig//  ...
xml_encoding *enc = x//  ...
//  ...
//  #580
c = (unsigned char)(*s);
if (c >= 0xf0) { /* four bytes encoded, 21 bits */
if(pos-4 >= 0) {
c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | 
(s[3]&63);
} else {
c = '?';
}
s += 4;
pos -= 4;
//  ...

Also no checking at ALL is made on the leading bytes (they should be in
the form: 10xx , a check is very easy, to check if s[0] has the
correct form: you do an AND with 1100  and then compare it with 1000
.

s[0]&0xC0==0x80

Also, Overlong UTF is not being taken care of, that's yeah, yet another
vulnerability.

Greetings!!



[2009-09-29 05:29:22] sird at rckc dot at

the rest is still dangerous.. eating chars without the 10xx  is
against the spec, and overlong UTF.



[2009-09-29 04:56:08] ras...@php.net

> there are several bugs in the code, one of them is that a variable
holding the value of the char is overflowed (trying to put 21 bits in
a
16 bits int)

That was fixed in 5.2.11



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

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



#49687 [Opn->Fbk]: utf8_decode xml_utf8_decode vuln

2009-10-15 Thread scottmac
 ID:   49687
 Updated by:   scott...@php.net
 Reported By:  sird at rckc dot at
-Status:   Open
+Status:   Feedback
 Bug Type: *Unicode Issues
 Operating System: *
 PHP Version:  5.2.11
 New Comment:

On a 16-bit processor an int might be 16-bit, if you can get PHP to
compile then well done :-)

Did you even try running the test code?


Previous Comments:


[2009-10-16 01:36:27] sird at rckc dot at

: ras...@php.net

It has come to my attention that this hasn't been fixed..

unsigned int has a size of 16 bits, don't take my word for it

http://www.acm.uiuc.edu/webmonkeys/book/c_guide/1.2.html

Section: 1.2.2 Variables

unsigned int16 bits

I just downloaded PHP 5.2.11, and I quote the code:


//  php-5.2.11.tar.bz2/php-5.2.11/ext/xml/xml.c#558
PHPAPI char *xml_utf8_decode(//  ...
{
int pos = len;
char *newbuf = emallo//  ...
unsigned int c;  // sizeof(unsigned int)==16 bits
char (*decoder)(unsig//  ...
xml_encoding *enc = x//  ...
//  ...
//  #580
c = (unsigned char)(*s);
if (c >= 0xf0) { /* four bytes encoded, 21 bits */
if(pos-4 >= 0) {
c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | 
(s[3]&63);
} else {
c = '?';
}
s += 4;
pos -= 4;
//  ...

Also no checking at ALL is made on the leading bytes (they should be in
the form: 10xx , a check is very easy, to check if s[0] has the
correct form: you do an AND with 1100  and then compare it with 1000
.

s[0]&0xC0==0x80

Also, Overlong UTF is not being taken care of, that's yeah, yet another
vulnerability.

Greetings!!



[2009-09-29 05:29:22] sird at rckc dot at

the rest is still dangerous.. eating chars without the 10xx  is
against the spec, and overlong UTF.



[2009-09-29 04:56:08] ras...@php.net

> there are several bugs in the code, one of them is that a variable
holding the value of the char is overflowed (trying to put 21 bits in
a
16 bits int)

That was fixed in 5.2.11



[2009-09-29 01:58:37] sird at rckc dot at

it is a PHP bug, the function is not decoding correctly, check the ppt
and the acunetix blog for details.

there are several bugs in the code, one of them is that a variable
holding the value of the char is overflowed (trying to put 21 bits in a
16 bits int), also the code is not checking if it is a valid unicode
char (reading unicode specification should explain it).

the example r...@80sec gave you was an overlong utf representation of a
single quote. that is forbidden by unicode, and should transform the
char to ?.

also, the code is not checking if the chars are valid UTF, so stuff
like:  are going to
be transformed to 


this is a very serious vulnerability and there are several bugs in the
same function (there's even unreachable code).

you can check the implementation of utf by Mozilla or Webkit, they do
it right. dont use java as a reference since they are also flawed.

due to the fact that PHP is for web applications and utf is widely
used, and it allows an attacker to do all type of attacks (from sql
injection to xss) its imperative to fix that function.

Greetings!!



[2009-09-28 19:38:24] sjo...@php.net

Is this a bug in PHP or in scripts which do utf8_decode(addslashes())
instead of addslashes(utf8_decode())? What do you propose to solve this
bug?



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/49687

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



#49224 [Asn->Fbk]: Segmentation fault

2009-10-15 Thread scottmac
 ID:   49224
 Updated by:   scott...@php.net
 Reported By:  alahaye at fm2i dot com
-Status:   Assigned
+Status:   Feedback
 Bug Type: Apache2 related
 Operating System: HPUX 11.31
 PHP Version:  5.3.0
 Assigned To:  scottmac
 New Comment:

Please try using this snapshot:

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

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

Just fixed the DNS issue in a snapshot, can you try this again to 
reproduce the original issue.


Previous Comments:


[2009-10-16 02:10:52] s...@php.net

Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=289691
Log: Part fix for bug #49224



[2009-09-28 13:13:20] neko at nekochan dot net

The compilation issue in dns.c also occurs under IRIX 6.5.30:

cc-1565 c99: ERROR File = /opt/build/php-5.3.1RC1/ext/standard/dns.c, 
Line = 813
  The struct "__res_state" has no field "res_h_errno".

if (php_dns_errno(handle) == NO_DATA)
{
^

1 error detected in the compilation of "/opt/build/php-
5.3.1RC1/ext/standard/dns.c".



[2009-09-12 14:28:54] j...@php.net

Scott, what's the status with this?



[2009-08-14 12:11:35] alahaye at fm2i dot com

Hi, did you receive my files ?



[2009-08-12 10:36:34] scott...@php.net

Can you mail me your config.log and your resolv.h file.





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

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



#49883 [Opn->Bgs]: The parser doesn't distinguish periods after integers as concatenations

2009-10-14 Thread scottmac
 ID:   49883
 Updated by:   scott...@php.net
 Reported By:  svavar at kjarrval dot is
-Status:   Open
+Status:   Bogus
 Bug Type: Compile Failure
 Operating System: FreeBSD 7.2
 PHP Version:  5.2.11
 New Comment:

Surround your expression with parentheses to get your expected
behavior.

The lexer treats this as a float, not the parser.


Previous Comments:


[2009-10-15 01:27:04] svavar at kjarrval dot is

Description:

The parser thinks that a period after an integer must mean the number
is a float, even though the period represents a concatenation of a
string.

Reproduce code:
---


Expected result:

To see the following output:

2 seconds

Actual result:
--
The parser outputs a syntax error:

unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';'





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



#49686 [Opn]: SPL as a shared ext: run-time check for SPL instead of compile-time

2009-09-27 Thread scottmac
 ID:   49686
 Updated by:   scott...@php.net
 Reported By:  galaxy4public+php at gmail dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Linux
 PHP Version:  5.2.11
 New Comment:

SPL is force enabled with PHP 5.3+ as static, so this patch really only
applies to 5.2 and I'm not sure if we're still open for new features.


Previous Comments:


[2009-09-27 11:23:04] galaxy4public+php at gmail dot com

Well, I made the directory world-readable:

ftp://ftp.ru.openwall.com/pvt/galaxy/php-spl-shared/

I'll place any updates to the patch there (if there are any).



[2009-09-27 10:37:23] galaxy4public+php at gmail dot com

Ouch, this line-wrapping feature really hurts! :(  In the comment above
the link should be manually concatenated to get a correct URL.



[2009-09-27 10:34:46] galaxy4public+php at gmail dot com

Since the patch was broken by line-wrapping I've uploaded it here:
ftp://ftp.ru.openwall.com/pvt/galaxy/php-spl-shared/php-5.2.11-gm-spl-shared.diff



[2009-09-27 10:26:04] galaxy4public+php at gmail dot com

Description:

The attached patch introduces a run-time check for the SPL extension
instead of the compile-time one.  This allows to build SPL as a shared
extension (the corresponding changes to config.m4 are included in the
patch as well).

This work was sponsored by the WebEnabled (http://webenabled.com)
project.

Since there is no way to attach patches to bug reports I'm including it
below:
===
--- php-5.2.5.orig/ext/spl/config.m42006-12-04 18:01:53 +
+++ php-5.2.5/ext/spl/config.m4 2008-04-07 05:53:55 +
@@ -26,7 +26,7 @@
   CPPFLAGS=$old_CPPFLAGS
   AC_DEFINE_UNQUOTED(HAVE_PACKED_OBJECT_VALUE, $ac_result, [Whether
struct _zend_object_value is packed])
   AC_DEFINE(HAVE_SPL, 1, [Whether you want SPL (Standard PHP Library)
support])
-  PHP_NEW_EXTENSION(spl, php_spl.c spl_functions.c spl_engine.c
spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c
spl_observer.c, no)
+  PHP_NEW_EXTENSION(spl, [php_spl.c spl_functions.c spl_engine.c
spl_iterators.c spl_array.c spl_directory.c spl_sxe.c spl_exceptions.c
spl_observer.c], $ext_shared)
   PHP_INSTALL_HEADERS([ext/spl], [php_spl.h spl_array.h
spl_directory.h spl_engine.h spl_exceptions.h spl_functions.h
spl_iterators.h spl_observer.h spl_sxe.h])
   PHP_ADD_EXTENSION_DEP(spl, pcre, true)
 fi
--- php-5.2.11.orig/ext/standard/array.c2009-08-14 06:18:47
+
+++ php-5.2.11/ext/standard/array.c 2009-09-27 08:46:42 +
@@ -324,20 +324,22 @@ PHP_FUNCTION(count)
RETURN_LONG (php_count_recursive (array, mode
TSRMLS_CC));
break;
case IS_OBJECT: {
-#ifdef HAVE_SPL
-   /* it the object implements Countable we call
its count() method */
-   zval *retval;
-
-   if (Z_OBJ_HT_P(array)->get_class_entry &&
instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
-   zend_call_method_with_0_params(&array,
NULL, NULL, "count", &retval);
-   if (retval) {
-   convert_to_long_ex(&retval);
-   RETVAL_LONG(Z_LVAL_P(retval));
-   zval_ptr_dtor(&retval);
+   zend_class_entry **pce;
+   /* check whether the SPL extension available or
not */
+   if (zend_hash_find(EG(class_table),
"countable", sizeof("Countable"), (void **) &pce) == SUCCESS) {
+   /* if the object implements Countable
we call its count() method */
+   zval *retval;
+   if (Z_OBJ_HT_P(array)->get_class_entry
&& instanceof_function(Z_OBJCE_P(array), *pce TSRMLS_CC)) {
+  
zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval);
+   if (retval) {
+  
convert_to_long_ex(&retval);
+  
RETVAL_LONG(Z_LVAL_P(retval));
+  
zval_ptr_dtor(&retval);
+   }
+   return;
}
-   return;
}
-#endif
+
/* if not we return the number of properties
(not taking visibility into account) */
if (Z_OBJ_HT_P(array)->count_elements) {
RETVAL_LONG(1);
===




#49588 [Bgs]: json_encode returns null for certain strings

2009-09-18 Thread scottmac
 ID:   49588
 Updated by:   scott...@php.net
 Reported By:  fernando at consultorpc dot com
 Status:   Bogus
 Bug Type: JSON related
 Operating System: Linux/Mac OSX Leopard
 PHP Version:  5.3.0
 New Comment:

It only appears of display_errors is on though with 5.3.1+ you can also
detect it by looking at json_last_error()


Previous Comments:


[2009-09-18 12:54:42] j...@php.net

PHP Warning:  json_encode(): Invalid UTF-8 sequence in argument in
Command line code on line 1



[2009-09-18 12:36:22] fernando at consultorpc dot com

Description:

At my specific case, if a string contains an Euro symbol ( € ),
json_encode will return null for that string.

It might also happens with other special characters.

Reproduce code:
---
 htmlentities( 'My euro symbol €.' )
);

var_dump( $array );
var_dump( json_encode( $array ) );

Expected result:

array(1) {
  ["name"]=>
  string(29) "My euro symbol €."
}
string(13) "{"name":"My euro symbol €."}"

Actual result:
--
array(1) {
  ["name"]=>
  string(29) "My euro symbol â?¬."
}
string(13) "{"name":null}"





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



#49581 [Opn->Bgs]: on Mac OS 10.5.8 'Y' returns 0000

2009-09-17 Thread scottmac
 ID:   49581
 Updated by:   scott...@php.net
 Reported By:  dg dot oppenheimer at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Date/time related
 Operating System: Mac OS 10.5.8  on PPC G5
 PHP Version:  5.2.10
 New Comment:

Duplicate of bug #48276 its fixed in the SVN snapshot and 5.2.11 which
will go out tonight / tomorrow.


Previous Comments:


[2009-09-17 22:15:45] dg dot oppenheimer at gmail dot com

Description:

Essentially the same as bug report #48276. I had this problem with OS
10.5.7 but it was fixed when I used the most recent CVS snapshot of php
5.2.10 for PPC (build date: Aug 24 2009 12:44:03). It re-appeared when I
upgraded to Mac OS 10.5.8. 


Reproduce code:
---



Expected result:

2009/09/17

Actual result:
--
/09/17





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



#49518 [Fbk->Bgs]: can't open encrypted sqlite3 database

2009-09-10 Thread scottmac
 ID:   49518
 Updated by:   scott...@php.net
 Reported By:  wjzhhr at gmail dot com
-Status:   Feedback
+Status:   Bogus
 Bug Type: SQLite related
 Operating System: windwos xp
 PHP Version:  5.3.0
 New Comment:

wxsqlite3 contains a custom encryption layer that isn't part of the
standard SQLite3 library which PHP includes.


Previous Comments:


[2009-09-11 00:45:23] wjzhhr at gmail dot com

I use wxsqlite3-1.9.5 to create sqlite3 database, and the key is 1.

if I use sqlite3shell.exe open "x.db",the result will right.

I never use sqlite2,always use sqlite3.



[2009-09-10 13:12:05] scott...@php.net

Pretty sure wxSQLite is SQLite2 and you need wxSQLite3.



[2009-09-10 09:58:52] sjo...@php.net

Does it work when you supply the right encryption key as the third
parameter?

SQLite3::__construct  ( string $filename  [, int $flags  [, string
$encryption_key  ]] )



[2009-09-10 08:15:49] wjzhhr at gmail dot com

Description:

can't open encrypted database which created by  wxSQLite.

exec("PRAGMA KEY='1'");
   $result = $db->query('SELECT * FROM xxx');
   var_dump($result->fetchArray());
?>

Warning: SQLite3::query(): Unable to prepare statement: 26, file is
encrypted or is not a database 


Reproduce code:
---
---
>From manual page: sqlite3.open
---


Expected result:

my table: CREATE TABLE xxx(iswho text,itimes int);
liming|1
xiaojie|2
two records.
Expected result:
array(4) {
  [0]=>
  string(6) "liming"
  ["iswho"]=>
  string(6) "liming"
  [1]=>
  int(1)
  ["itimes"]=>
  int(1)
}



Actual result:
--
Warning: SQLite3::query(): Unable to prepare statement: 26, file is
encrypted or is not a database 





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



#49518 [Fbk]: can't open encrypted sqlite3 database

2009-09-10 Thread scottmac
 ID:   49518
 Updated by:   scott...@php.net
 Reported By:  wjzhhr at gmail dot com
 Status:   Feedback
 Bug Type: SQLite related
 Operating System: windwos xp
 PHP Version:  5.3.0
 New Comment:

Pretty sure wxSQLite is SQLite2 and you need wxSQLite3.


Previous Comments:


[2009-09-10 09:58:52] sjo...@php.net

Does it work when you supply the right encryption key as the third
parameter?

SQLite3::__construct  ( string $filename  [, int $flags  [, string
$encryption_key  ]] )



[2009-09-10 08:15:49] wjzhhr at gmail dot com

Description:

can't open encrypted database which created by  wxSQLite.

exec("PRAGMA KEY='1'");
   $result = $db->query('SELECT * FROM xxx');
   var_dump($result->fetchArray());
?>

Warning: SQLite3::query(): Unable to prepare statement: 26, file is
encrypted or is not a database 


Reproduce code:
---
---
>From manual page: sqlite3.open
---


Expected result:

my table: CREATE TABLE xxx(iswho text,itimes int);
liming|1
xiaojie|2
two records.
Expected result:
array(4) {
  [0]=>
  string(6) "liming"
  ["iswho"]=>
  string(6) "liming"
  [1]=>
  int(1)
  ["itimes"]=>
  int(1)
}



Actual result:
--
Warning: SQLite3::query(): Unable to prepare statement: 26, file is
encrypted or is not a database 





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



#49487 [Opn->Bgs]: addslashes � Quote string with slashes

2009-09-07 Thread scottmac
 ID:   49487
 Updated by:   scott...@php.net
 Reported By:  shefik at allknightaccess dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Feature/Change Request
 Operating System: Mac 10.5.8
 PHP Version:  5.3.0
 New Comment:

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

Thank you for your interest in PHP.

We have this with addcslashes where you can provide a character list to
escape.


Previous Comments:


[2009-09-06 19:44:49] shefik at allknightaccess dot com

Description:

Please add a new parameter for the function addslashes, where it flags

what type of character to quote string with slashes.

Such as:

SINGLE
DOUBLE
BACKSLASH
NULL
ALL

All would remain the default, as it is right now. Example use with the

new parameter:














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



#49446 [Opn->Fbk]: escapeshellarg dosn`t work on windows

2009-09-02 Thread scottmac
 ID:   49446
 Updated by:   scott...@php.net
 Reported By:  heromantor at users dot sourceforge dot net
-Status:   Open
+Status:   Feedback
 Bug Type: CGI related
 Operating System: windows xp sp2
 PHP Version:  5.2.10


Previous Comments:


[2009-09-03 04:16:48] scott...@php.net

This was fixed in 5.3 with bug #43261

Though \\ within double quotes is considered a single \



[2009-09-02 23:51:40] heromantor at users dot sourceforge dot net

oh sorry, i post invalid patch.

this ok:
--- exec.c  Wed Sep  2 23:44:19 2009
+++ exec_fixed.cWed Sep  2 23:44:41 2009
@@ -343,7 +343,7 @@
  */
 PHPAPI char *php_escape_shell_arg(char *str)
 {
-int x, y = 0, l = strlen(str);
+int x, y = 0, j, l = strlen(str);
 char *cmd;
 size_t estimate = (4 * l) + 3;
 
@@ -352,6 +352,11 @@
 cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j > 0 && cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
 cmd[y++] = '"';
 #else
 cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
 switch (str[x]) {
 #ifdef PHP_WIN32
-case '"':
-case '%':
-cmd[y++] = ' ';
-break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+cmd[y++] = '%';
+cmd[y++] = '"';
+break;
+case '"':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+/* fall-through */
 #else
 case '\'':
 cmd[y++] = '\'';
@@ -388,6 +399,9 @@
 }
 }
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
 cmd[y++] = '"';
 #else
 cmd[y++] = '\'';



[2009-09-02 23:10:52] heromantor at users dot sourceforge dot net

Description:

escapeshellarg function dosn`t work properly on windows platform.
Problem in " \ and % chars handling.

this patch fix this problem
--- exec.c  Wed Sep  2 22:41:27 2009
+++ exec_fixed.cWed Sep  2 22:40:50 2009
@@ -352,6 +352,11 @@
cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j > 0 && cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
cmd[y++] = '"';
 #else
cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
switch (str[x]) {
 #ifdef PHP_WIN32
-   case '"':
-   case '%':
-   cmd[y++] = ' ';
-   break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+cmd[y++] = '%';
+cmd[y++] = '"';
+break;
+case '"':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+/* fall-through */
 #else
case '\'':
cmd[y++] = '\'';
@@ -388,6 +399,9 @@
}
}
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
cmd[y++] = '"';
 #else
cmd[y++] = '\'';

and some test cases
P A T H => "P A T H"
%PATH% => ""%"PATH"%""
a%PATH%b => "a"%"PATH"%"b"
%%PATH%% => ""%""%"PATH"%""%""
"PATH" => """PATH"""
"%PATH%" => %"PATH"%
\P\A\T\H => "\P\A\T\H"
\P\A\T\H\ => "\P\A\T\H\\"
\%\%\ => "\\"%"\\"%"\\"
a\\%b\\c%\\ => "a"%"b\\c"%""
"a\" => """a\\"""
a\" => "a\\"""
a\"^|^&^(^) => "a\\""^|^&^(^)"
PATH\%\ => "PATH\\"%"\\"


Reproduce code:
---
http://bugs.php.net/?id=49446&edit=1



#49446 [Opn]: escapeshellarg dosn`t work on windows

2009-09-02 Thread scottmac
 ID:   49446
 Updated by:   scott...@php.net
 Reported By:  heromantor at users dot sourceforge dot net
 Status:   Open
 Bug Type: CGI related
 Operating System: windows xp sp2
 PHP Version:  5.2.10
 New Comment:

This was fixed in 5.3 with bug #43261

Though \\ within double quotes is considered a single \


Previous Comments:


[2009-09-02 23:51:40] heromantor at users dot sourceforge dot net

oh sorry, i post invalid patch.

this ok:
--- exec.c  Wed Sep  2 23:44:19 2009
+++ exec_fixed.cWed Sep  2 23:44:41 2009
@@ -343,7 +343,7 @@
  */
 PHPAPI char *php_escape_shell_arg(char *str)
 {
-int x, y = 0, l = strlen(str);
+int x, y = 0, j, l = strlen(str);
 char *cmd;
 size_t estimate = (4 * l) + 3;
 
@@ -352,6 +352,11 @@
 cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j > 0 && cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
 cmd[y++] = '"';
 #else
 cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
 switch (str[x]) {
 #ifdef PHP_WIN32
-case '"':
-case '%':
-cmd[y++] = ' ';
-break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+cmd[y++] = '%';
+cmd[y++] = '"';
+break;
+case '"':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+/* fall-through */
 #else
 case '\'':
 cmd[y++] = '\'';
@@ -388,6 +399,9 @@
 }
 }
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
 cmd[y++] = '"';
 #else
 cmd[y++] = '\'';



[2009-09-02 23:10:52] heromantor at users dot sourceforge dot net

Description:

escapeshellarg function dosn`t work properly on windows platform.
Problem in " \ and % chars handling.

this patch fix this problem
--- exec.c  Wed Sep  2 22:41:27 2009
+++ exec_fixed.cWed Sep  2 22:40:50 2009
@@ -352,6 +352,11 @@
cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j > 0 && cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
cmd[y++] = '"';
 #else
cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
switch (str[x]) {
 #ifdef PHP_WIN32
-   case '"':
-   case '%':
-   cmd[y++] = ' ';
-   break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+cmd[y++] = '%';
+cmd[y++] = '"';
+break;
+case '"':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '"';
+/* fall-through */
 #else
case '\'':
cmd[y++] = '\'';
@@ -388,6 +399,9 @@
}
}
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
cmd[y++] = '"';
 #else
cmd[y++] = '\'';

and some test cases
P A T H => "P A T H"
%PATH% => ""%"PATH"%""
a%PATH%b => "a"%"PATH"%"b"
%%PATH%% => ""%""%"PATH"%""%""
"PATH" => """PATH"""
"%PATH%" => %"PATH"%
\P\A\T\H => "\P\A\T\H"
\P\A\T\H\ => "\P\A\T\H\\"
\%\%\ => "\\"%"\\"%"\\"
a\\%b\\c%\\ => "a"%"b\\c"%""
"a\" => """a\\"""
a\" => "a\\"""
a\"^|^&^(^) => "a\\""^|^&^(^)"
PATH\%\ => "PATH\\"%"\\"


Reproduce code:
---
http://bugs.php.net/?id=49446&edit=1



#49445 [Opn->Fbk]: Segfault on connection close

2009-09-02 Thread scottmac
 ID:   49445
 Updated by:   scott...@php.net
 Reported By:  jake dot levitt at mailtrust dot com
-Status:   Open
+Status:   Feedback
 Bug Type: IMAP related
 Operating System: CentOS 5
 PHP Version:  5.3.0
 New Comment:

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.

Also what version of c-client are you using?


Previous Comments:


[2009-09-02 22:16:09] jake dot levitt at mailtrust dot com

Description:

If an IMAP server closes a connection without sending a BYE command,
PHP segfaults on the next IMAP command run on the mailbox resource.  I
noticed this while testing against an exchange server, where I was
selecting a folder that doesn't exist.  After 10 times it disconnected
me without sending a BYE command.  When this happens PHP segfaulted,
which doesn't allow for the script to do any error handling.

Reproduce code:
---
http://bugs.php.net/?id=49445&edit=1



#49433 [Opn->Bgs]: Using directory split on session path causes startup warnings

2009-09-01 Thread scottmac
 ID:   49433
 Updated by:   scott...@php.net
 Reported By:  phpbugs at delinked dot net
-Status:   Open
+Status:   Bogus
 Bug Type: Session related
 Operating System: Gentoo 2.0.1 Linux 2.6.30
 PHP Version:  5.2.10
 New Comment:

Bug #49427 was correct.

mm_create implies it's using libmm and not files.

Check your phpinfo() page.


Previous Comments:


[2009-09-02 00:25:53] phpbugs at delinked dot net

Description:

(resubmitting because someone had an itchy trigger finger on bug
#49427)

When session.save_path is set to something like "3;/tmp/sessions", PHP
spits out the following:

PHP Startup: mm_create(0, 3;/tmp/sessions/session_mm_cli0) failed, err
mm:core: failed to open semaphore file (No such file or directory) in
Unknown on line 0

This is a PHP installed compiled manually from source, downloaded from
PHP.net, and not from Gentoo Portage. The necessary paths under
/tmp/sessions have been created with the script from ext/sessions. The
warning is not presented when directory splitting is not used. During
testing, no 3rd party extensions or patches were applied.

session.save_handler is set to files


Reproduce code:
---
In the ini:
session.save_path="3;/tmp/sessions"
session.save_handler=files

php -r 'echo "a line";'


Expected result:

a line

Actual result:
--
PHP Warning:  PHP Startup: mm_create(0,
3;/tmp/sessions/session_mm_cli0)
failed, err mm:core: failed to open semaphore file (No such file or
directory) in Unknown on line 0
a line






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



#49434 [Opn->Bgs]: define('CONSTANT',0) unexpected results

2009-09-01 Thread scottmac
 ID:   49434
 Updated by:   scott...@php.net
 Reported By:  jon at ijk dot com dot au
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: WinXP SP3
 PHP Version:  5.2.10
 New Comment:

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

Thank you for your interest in PHP.

Read up on the operator comparisons.

"me" is cast to an integer which results in 0.


Previous Comments:


[2009-09-02 01:19:42] jon at ijk dot com dot au

Description:

Unexpected output from using define('CONSTANT',0) specifically

Reproduce code:
---
define('TESTER',0);

if(TESTER=='me'){echo 'yes1';}
else{echo 'no1';}
if(TESTER==0){echo 'yes2';}
else{echo 'no2';}
if(TESTER==1){echo 'yes3';}
else{echo 'no3';}

Expected result:

no1yes2no3

Actual result:
--
yes1yes2no3





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



#49422 [Opn->Bgs]: mktime working strange

2009-08-31 Thread scottmac
 ID:   49422
 Updated by:   scott...@php.net
 Reported By:  dolby at xpteam dot eu
-Status:   Open
+Status:   Bogus
 Bug Type: Date/time related
 Operating System: gentoo
 PHP Version:  5.2.11RC1
 New Comment:

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

Thank you for your interest in PHP.

Since there is no September 31st it becomes October 1st, this is
expected behavior.


Previous Comments:


[2009-08-31 08:10:05] dolby at xpteam dot eu

Description:

I am just wondering is this a bug or expected behaviour:

echo date("r", mktime(0,0,0,9,31,2009));

It returns:
Thu, 01 Oct 2009 00:00:00 +0200

but I "expect" i to be: 
Wed, 30 Sep 2009 00:00:00 +0200

Maybe I am missing the point, but I always supposed the mktime
considers real dates.

Reproduce code:
---
echo date("r", mktime(0,0,0,9,31,2009));

Expected result:

Wed, 30 Sep 2009 00:00:00 +0200

Actual result:
--
Thu, 01 Oct 2009 00:00:00 +0200





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



#49338 [Opn->Fbk]: when fopen is used without the second parameter, php segfaults in apache 2.2

2009-08-23 Thread scottmac
 ID:   49338
 Updated by:   scott...@php.net
 Reported By:  ttessier at swhistlesoft dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Filesystem function related
 Operating System: solaris 10
 PHP Version:  5.2.10
 New Comment:

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.




Previous Comments:


[2009-08-23 16:17:17] ttessier at swhistlesoft dot com

Description:

When fopen is used without the second parameter, php segfaults in
apache 2.2. I had this happen two times, once when I was using bcompiler
and once when I was using xml_parser. I thought that the issue was the
other modules until I realized that I was missing the second parameter
to fopen. 

I was doing a test on the returned value to check for validity such as
if ( $fh ) or if ( is_resource ( $fh ) ) and was unable to see any
warnings.

Once I removed the test and any interior blocks to the filehandle test
from the code, I was able to see a warning. I fixed the issue and have
been working solid since. 

Reproduce code:
---
$regionf = 'regions.xml' ;
$fregions = fopen ( $regionf ) ;
if ( $fregions ){
echo "File Opened" ;
$xmldoc = fread ( $fregions, filesize ( $regionf ) ) ;
$parser = xml_parser_create  ( ) ;
if ( $parser ){
xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING, "UTF-8");
   xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1); 
   xml_parse ( $parser, $doc ) ;
   xml_parse_into_struct($parser, trim($xmldoc), $xml_values);
   print_r ( $xml_values ) ;
   xml_parser_free ( $parser ) ;
}
fclose ( $fregions ) ;
}

Expected result:

apache segfault -  browser displays previous content ( cache )






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



  1   2   3   4   5   6   7   >