Bug #53551 [Asn]: PDOStatement execute segfaults for pdo_mysql driver

2010-12-16 Thread kalle
Edit report at http://bugs.php.net/bug.php?id=53551&edit=1

 ID: 53551
 Updated by: ka...@php.net
 Reported by:eddawley at gmail dot com
 Summary:PDOStatement execute segfaults for pdo_mysql driver
 Status: Assigned
 Type:   Bug
 Package:PDO related
 Operating System:   Centos 5
 PHP Version:5.3.4
 Assigned To:mysql
 Block user comment: N
 Private report: N

 New Comment:

I cannot reproduce with php-trunk using pdo_mysql linked to mysqlnd on
Windows:



C:\php>php test.php

1

array(3) {

  [0]=>

  string(5) "0"

  [1]=>

  NULL

  [2]=>

  NULL

}

2

array(3) {

  [0]=>

  string(5) "0"

  [1]=>

  NULL

  [2]=>

  NULL

}



done



C:\php>php -v

PHP 5.3.99-dev (cli) (built: Dec 11 2010 12:14:13)

Copyright (c) 1997-2010 The PHP Group

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


Previous Comments:

[2010-12-15 22:31:18] eddawley at gmail dot com

Description:

A segfault will occur when a PDOStatement is reused after failing due to
a NOT 

NULL integrity constraint.  This occurred when using the pdo_mysql
driver as 

opposed to the mysqlnd driver.



Also to avoid confusion, I was only able to test this on PHP 5.3.2.  I
could find 

nothing in the changelogs that would imply this bug has been fixed.  I 

unfortunately did not have the time to free up hardware or vms for an
upgrade.

Test script:
---
$dbh = new PDO('mysql:host=127.0.0.1;dbname=foo', 'user', 'pass');

$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);



$createSql = "CREATE TABLE `foo` (

  `count` bigint(20) unsigned NOT NULL DEFAULT '0'

)";



$dbh->exec('drop table if exists foo');

$dbh->exec($createSql);

$dbh->exec("insert into foo set `count` = 1 ");



$sql = 'UPDATE foo SET `count` = :count';

$stmt = $dbh->prepare($sql);



$values = array (

  'count' => NULL,

);



echo "1\n";

$stmt->execute($values);

var_dump($stmt->errorInfo());



echo "2\n";

$stmt->execute($values);

var_dump($stmt->errorInfo());



echo "\ndone\n";



Expected result:

[...@foo ~]$ php ed.php

1

array(3) {

  [0]=>

  string(5) "23000"

  [1]=>

  int(1048)

  [2]=>

  string(29) "Column 'count' cannot be null"

}

2

array(3) {

  [0]=>

  string(5) "23000"

  [1]=>

  int(1048)

  [2]=>

  string(29) "Column 'count' cannot be null"

}

done



Actual result:
--
[...@foo ~]$ php ed.php

1

array(3) {

  [0]=>

  string(5) "23000"

  [1]=>

  int(1048)

  [2]=>

  string(29) "Column 'count' cannot be null"

}

2

Segmentation fault (core dumped)







Core was generated by `php ed.php'.

Program terminated with signal 11, Segmentation fault.

[New process 16072]

#0  0x005aa8be in pdo_mysql_stmt_param_hook (stmt=0xe5c12e8, 

param=0xe5c1a78, event_type=) at /tmp/php-

5.3.2/ext/pdo_mysql/mysql_statement.c:490

490 b->is_null = &S->in_null[param-

>paramno];

(gdb) bt

#0  0x005aa8be in pdo_mysql_stmt_param_hook (stmt=0xe5c12e8, 

param=0xe5c1a78, event_type=) at /tmp/php-

5.3.2/ext/pdo_mysql/mysql_statement.c:490

#1  0x005a34d9 in really_register_bound_param
(param=0x77cb9990, 

stmt=0xe5c12e8, is_param=1) at /tmp/php-5.3.2/ext/pdo/pdo_stmt.c:408

#2  0x005a4940 in zim_PDOStatement_execute (ht=, 

return_value=0xe5c18d0, return_value_ptr=,
this_ptr=, 

return_value_used=) at /tmp/php-

5.3.2/ext/pdo/pdo_stmt.c:474

#3  0x00789059 in zend_do_fcall_common_helper_SPEC 

(execute_data=0x2ae09210b050) at
/tmp/php-5.3.2/Zend/zend_vm_execute.h:313

#4  0x0075f98e in execute (op_array=0xe5be920) at /tmp/php-

5.3.2/Zend/zend_vm_execute.h:104

#5  0x0073c439 in zend_execute_scripts (type=8, retval=0x0, 

file_count=3) at /tmp/php-5.3.2/Zend/zend.c:1194

#6  0x006ea968 in php_execute_script
(primary_file=0x77cbc190) at 

/tmp/php-5.3.2/main/main.c:2260

#7  0x007c617e in main (argc=2, argv=0x77cbc408) at
/tmp/php-

5.3.2/sapi/cli/php_cli.c:1192

(gdb) print *param

$1 = {paramno = 0, name = 0xe5c0750 ":count", namelen = 6, max_value_len
= 0, 

parameter = 0xe5c1900, param_type = PDO_PARAM_STR, driver_params = 0x0,


driver_data = 0x0, 

  stmt = 0xe5c12e8, is_param = 1}

(gdb) print param

$2 = (struct pdo_bound_param_data *) 0xe5c1a78








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


Req #53559 [Opn->Bgs]: Big intger support

2010-12-16 Thread pajoye
Edit report at http://bugs.php.net/bug.php?id=53559&edit=1

 ID: 53559
 Updated by: paj...@php.net
 Reported by:xiaomao5 at live dot com
 Summary:Big intger support
-Status: Open
+Status: Bogus
 Type:   Feature/Change Request
 Package:Unknown/Other Function
 Operating System:   Any
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

You can use bcmath in the mean time. But this is a duplicate feature
request (already in).


Previous Comments:

[2010-12-16 19:56:08] xiaomao5 at live dot com

Description:

In C and C++, there are things like unsigned long long int, unsigned
int. Since PHP is based on C, these functions should be available in
PHP. I am doing an experiment to figure out probability. For small
number, I can use integer. For large number, I probably need unsigned
long long int.







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


[PHP-BUG] Req #53559 [NEW]: Big intger support

2010-12-16 Thread xiaomao5 at live dot com
From: 
Operating system: Any
PHP version:  Irrelevant
Package:  Unknown/Other Function
Bug Type: Feature/Change Request
Bug description:Big intger support

Description:

In C and C++, there are things like unsigned long long int, unsigned int.
Since PHP is based on C, these functions should be available in PHP. I am
doing an experiment to figure out probability. For small number, I can use
integer. For large number, I probably need unsigned long long int.


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



Bug #53556 [Opn]: cURL returns wrong Content-Length after a redirect to a page without CL-header

2010-12-16 Thread cataphract
Edit report at http://bugs.php.net/bug.php?id=53556&edit=1

 ID: 53556
 Updated by: cataphr...@php.net
 Reported by:michael dot moench at marktjagd dot de
 Summary:cURL returns wrong Content-Length after a redirect
 to a page without CL-header
 Status: Open
 Type:   Bug
 Package:HTTP related
 Operating System:   Ubuntu 10.04
 PHP Version:5.3SVN-2010-12-16 (SVN)
 Block user comment: N
 Private report: N

 New Comment:

This looks like a problem upstream.


Previous Comments:

[2010-12-16 13:27:22] michael dot moench at marktjagd dot de

Description:

I have an URL which will redirect me to a second, final URL. The first
response contains a Content-Length-Header, the second does not. If I set
the CURLOPT_FOLLOWLOCATION option, I would expect that the
"download_content_length"-field from curl_getinfo contains the
Content-Length of the final URL, in this case 0, but it contains the
Content-Length of the first Response.



The first Response:



HTTP/1.1 302 Found

Date: Thu, 16 Dec 2010 11:39:31 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Location: http://productdata.download.affili.net/xxx

Set-Cookie: ASP.NET_SessionId=xxx; path=/; HttpOnly

Cache-Control: private

Content-Type: text/html; charset=Windows-1252

Content-Length: 214



The Second Response:



HTTP/1.1 200 OK

Date: Thu, 16 Dec 2010 11:39:32 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Content-Disposition: attachment; filename=xxx.gz

Transfer-Encoding: chunked

Cache-Control: private

Content-Type: application/gzip









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


Req #9777 [Opn->Csd]: Function/Class prototypes?

2010-12-16 Thread jani
Edit report at http://bugs.php.net/bug.php?id=9777&edit=1

 ID: 9777
 Updated by: j...@php.net
 Reported by:yohgaki at dd dot iij4u dot or dot jp
 Summary:Function/Class prototypes?
-Status: Open
+Status: Closed
 Type:   Feature/Change Request
-Package:Feature/Change Request
+Package:*General Issues
 PHP Version:4.0.4pl1
 Assigned To:yohgaki
 Block user comment: N
 Private report: N

 New Comment:

Abstract stuff is there. Other than that there should not be more
complexity added like this.


Previous Comments:

[2004-01-10 12:03:34] php at thekid dot de

Parts of this have been realized with type hints in PHP5.


[2001-03-16 00:53:13] yohgaki at dd dot iij4u dot or dot jp

I think it would be nice to have function/class prototype only for while
developing PHP application. (I guess developers are already come up with
similar/better idea for it, though)



With prototype, compiler may issue error with invalid parameter or
invalid use of function/class and PHP may warn if use of function/class
does not match with prototypes at run time.



Such as:

   void function do_something(integer(min, max), resource('file'),
array(text,integer), &object('object_name') = null);

   // Such syntax that specifying expected parameters' range/contents
may not a good idea, though.

   // The same thing can be done with assert() anyway.

   // It might be good idea enabling assert() in prototype definition.

   // to specify parameters range/contents to get rid of many assert()

   // from function itself. like



   void function($int integer) {

   assert($int > 0);

   }



   // Checking parameter types can be done by assert(). But, it's nice

   // to have prototypes.



   class foo {

public var pub_var;

private var priv_var;



public object foo(integer); 

protected integer bar(array);

private void internal_use_only();

   }



and include prototypes with special include statement like



   include_prototype('filename'); // development only prototypes

   require_prototype('filename'); // required prototypes



and have a new php.ini entry for prototype



   prototype.enable = true; // to disable include_prototype



like assert().



Currently, PHP function may take any types for a parameter, even if
function accepts certain types. This may result in unwanted behaviors as
I submitted a foreach bug. (foreach seems to behave really wrong way, if
parameter is not an array.)



Additionally, if prototype may specify function will not return value,
parser can prevent programmers to use implicitly returned NULL value as
RVALUE.



PHP needs to do additional work for Parse/Compile/Execute with
prototypes, but it would be acceptable while developing PHP application.
It would be nice to have a ability that programmer can get rid of
prototypes for better performance, once she/he is confident with his/her
codes.

(Inexperience programmers may write code that is not secure w/o
prototypes. But they write insecure code w/ or w/o prototypes anyway)









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


[PHP-BUG] Bug #53557 [NEW]: pathinfo() does not return correct values for path with accents in it

2010-12-16 Thread joris at notenbomer dot nl
From: 
Operating system: Debian Squeeze
PHP version:  5.3.4
Package:  Filesystem function related
Bug Type: Bug
Bug description:pathinfo() does not return correct values for path with accents 
in it

Description:

NOTE: phpinfo() lists the PHP version as 5.3.3-6



when using pathinfo() on a path, say, '/tmp/ë.txt', it will not give the
correct 

filename and basename (but will give the correct path).

Test script:
---
// will function correctly

print_r(pathinfo('/var/tmp/aëä.txt'));

// will leave out the first ë

print_r(pathinfo('/var/tmp/ëaä.txt'));

//will leave out ëä

print_r(pathinfo('/var/tmp/ëäa.txt'));



Expected result:

Array

(

[dirname] => /var/tmp

[basename] => aëä.txt

[extension] => txt

[filename] => aëä

)

Array

(

[dirname] => /var/tmp

[basename] => ëaä.txt

[extension] => txt

[filename] => ëaä

)

Array

(

[dirname] => /var/tmp

[basename] => ëäa.txt

[extension] => txt

[filename] => ëäa

)

Actual result:
--
Array

(

[dirname] => /var/tmp

[basename] => aëä.txt

[extension] => txt

[filename] => aëä

)

Array

(

[dirname] => /var/tmp

[basename] => aä.txt

[extension] => txt

[filename] => aä

)

Array

(

[dirname] => /var/tmp

[basename] => a.txt

[extension] => txt

[filename] => a

)

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



Bug #53553 [Opn->Bgs]: Same value items reverted in asort() and arsort()

2010-12-16 Thread cataphract
Edit report at http://bugs.php.net/bug.php?id=53553&edit=1

 ID: 53553
 Updated by: cataphr...@php.net
 Reported by:clau dot cristea at gmail dot com
 Summary:Same value items reverted in asort() and arsort()
-Status: Open
+Status: Bogus
 Type:   Bug
 Package:Arrays related
 Operating System:   Debian
 PHP Version:5.3.4
 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.

Then I don't know where you got the idea the sorting of asort() and
arsort() was stable.



Closing as bogus. See also bug #53341.


Previous Comments:

[2010-12-16 13:26:50] clau dot cristea at gmail dot com

> Where is it stated in the docs the sort is stable?



Don't know... Where is stated that is not?


[2010-12-16 11:52:27] cataphr...@php.net

Where is it stated in the docs the sort is stable?


[2010-12-16 11:10:39] clau dot cristea at gmail dot com

Description:

After sorting an associative array with asort() or arsort() items having
same value are reverted.



Those sorting must preserve order on same value case.



---

>From manual page: http://www.php.net/function.arsort

---



Test script:
---
 2, 'second' => 2);

$b = $a; // Save original.



print "Original:\n";

print_r($a);



asort($a);



print "\n\nasort():\n";

print_r($a);



arsort($b);



print "\n\narsort():\n";

print_r($b);

print "\n";



?>



Expected result:

I'm expecting that asort() and arsort() to preserve the order of items
having the same value.

Actual result:
--
See below asort(); and arsort(); that keys were reverted.






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


[PHP-BUG] Bug #53556 [NEW]: cURL returns wrong Content-Length after a redirect to a page without CL-header

2010-12-16 Thread michael dot moench at marktjagd dot de
From: 
Operating system: Ubuntu 10.04
PHP version:  5.3SVN-2010-12-16 (SVN)
Package:  HTTP related
Bug Type: Bug
Bug description:cURL returns wrong Content-Length after a redirect to a page 
without CL-header

Description:

I have an URL which will redirect me to a second, final URL. The first
response contains a Content-Length-Header, the second does not. If I set
the CURLOPT_FOLLOWLOCATION option, I would expect that the
"download_content_length"-field from curl_getinfo contains the
Content-Length of the final URL, in this case 0, but it contains the
Content-Length of the first Response.



The first Response:



HTTP/1.1 302 Found

Date: Thu, 16 Dec 2010 11:39:31 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Location: http://productdata.download.affili.net/xxx

Set-Cookie: ASP.NET_SessionId=xxx; path=/; HttpOnly

Cache-Control: private

Content-Type: text/html; charset=Windows-1252

Content-Length: 214



The Second Response:



HTTP/1.1 200 OK

Date: Thu, 16 Dec 2010 11:39:32 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

X-AspNet-Version: 2.0.50727

Content-Disposition: attachment; filename=xxx.gz

Transfer-Encoding: chunked

Cache-Control: private

Content-Type: application/gzip




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



Bug #53553 [Fbk->Opn]: Same value items reverted in asort() and arsort()

2010-12-16 Thread clau dot cristea at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=53553&edit=1

 ID: 53553
 User updated by:clau dot cristea at gmail dot com
 Reported by:clau dot cristea at gmail dot com
 Summary:Same value items reverted in asort() and arsort()
-Status: Feedback
+Status: Open
 Type:   Bug
 Package:Arrays related
 Operating System:   Debian
 PHP Version:5.3.4
 Block user comment: N
 Private report: N

 New Comment:

> Where is it stated in the docs the sort is stable?



Don't know... Where is stated that is not?


Previous Comments:

[2010-12-16 11:52:27] cataphr...@php.net

Where is it stated in the docs the sort is stable?


[2010-12-16 11:10:39] clau dot cristea at gmail dot com

Description:

After sorting an associative array with asort() or arsort() items having
same value are reverted.



Those sorting must preserve order on same value case.



---

>From manual page: http://www.php.net/function.arsort

---



Test script:
---
 2, 'second' => 2);

$b = $a; // Save original.



print "Original:\n";

print_r($a);



asort($a);



print "\n\nasort():\n";

print_r($a);



arsort($b);



print "\n\narsort():\n";

print_r($b);

print "\n";



?>



Expected result:

I'm expecting that asort() and arsort() to preserve the order of items
having the same value.

Actual result:
--
See below asort(); and arsort(); that keys were reverted.






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


Bug #53553 [Opn->Fbk]: Same value items reverted in asort() and arsort()

2010-12-16 Thread cataphract
Edit report at http://bugs.php.net/bug.php?id=53553&edit=1

 ID: 53553
 Updated by: cataphr...@php.net
 Reported by:clau dot cristea at gmail dot com
 Summary:Same value items reverted in asort() and arsort()
-Status: Open
+Status: Feedback
 Type:   Bug
 Package:Arrays related
 Operating System:   Debian
 PHP Version:5.3.4
 Block user comment: N
 Private report: N

 New Comment:

Where is it stated in the docs the sort is stable?


Previous Comments:

[2010-12-16 11:10:39] clau dot cristea at gmail dot com

Description:

After sorting an associative array with asort() or arsort() items having
same value are reverted.



Those sorting must preserve order on same value case.



---

>From manual page: http://www.php.net/function.arsort

---



Test script:
---
 2, 'second' => 2);

$b = $a; // Save original.



print "Original:\n";

print_r($a);



asort($a);



print "\n\nasort():\n";

print_r($a);



arsort($b);



print "\n\narsort():\n";

print_r($b);

print "\n";



?>



Expected result:

I'm expecting that asort() and arsort() to preserve the order of items
having the same value.

Actual result:
--
See below asort(); and arsort(); that keys were reverted.






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


Bug #53554 [Opn->Dup]: about $this

2010-12-16 Thread cataphract
Edit report at http://bugs.php.net/bug.php?id=53554&edit=1

 ID: 53554
 Updated by: cataphr...@php.net
 Reported by:smallslime at gmail dot com
 Summary:about $this
-Status: Open
+Status: Duplicate
 Type:   Bug
 Package:Class/Object related
 Operating System:   linux
 PHP Version:5.3.4
 Block user comment: N
 Private report: N

 New Comment:

Already addressed.


Previous Comments:

[2010-12-16 11:33:44] smallslime at gmail dot com

Description:

why section 1 is error and section 2 is correct?

Test script:
---
section 1:

class p {

public function a() {

echo '123';

$p = 'this';

return $$p;

}

}

$c = new p();

$c->a();



section 2:

class p {

public function a() {

echo '123';

$this;

$p = 'this';

return $$p;

}

}

$c = new p();

$c->a();

Expected result:

i deem section 1 should be no error,while it give me a notice.







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


[PHP-BUG] Bug #53554 [NEW]: about $this

2010-12-16 Thread smallslime at gmail dot com
From: 
Operating system: linux
PHP version:  5.3.4
Package:  Class/Object related
Bug Type: Bug
Bug description:about $this

Description:

why section 1 is error and section 2 is correct?

Test script:
---
section 1:

class p {

public function a() {

echo '123';

$p = 'this';

return $$p;

}

}

$c = new p();

$c->a();



section 2:

class p {

public function a() {

echo '123';

$this;

$p = 'this';

return $$p;

}

}

$c = new p();

$c->a();

Expected result:

i deem section 1 should be no error,while it give me a notice.


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



[PHP-BUG] Bug #53553 [NEW]: Same value items reverted in asort() and arsort()

2010-12-16 Thread clau dot cristea at gmail dot com
From: 
Operating system: Debian
PHP version:  5.3.4
Package:  Arrays related
Bug Type: Bug
Bug description:Same value items reverted in asort() and arsort()

Description:

After sorting an associative array with asort() or arsort() items having
same value are reverted.



Those sorting must preserve order on same value case.



---

>From manual page: http://www.php.net/function.arsort

---



Test script:
---
 2, 'second' => 2);

$b = $a; // Save original.



print "Original:\n";

print_r($a);



asort($a);



print "\n\nasort():\n";

print_r($a);



arsort($b);



print "\n\narsort():\n";

print_r($b);

print "\n";



?>



Expected result:

I'm expecting that asort() and arsort() to preserve the order of items
having the same value.

Actual result:
--
See below asort(); and arsort(); that keys were reverted.

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



Req #49712 [Csd]: create_function designed for unwanted obfuscation

2010-12-16 Thread jani
Edit report at http://bugs.php.net/bug.php?id=49712&edit=1

 ID: 49712
 Updated by: j...@php.net
 Reported by:list2009 at lunch dot za dot net
 Summary:create_function designed for unwanted obfuscation
 Status: Closed
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   any
 PHP Version:5.2.11
 Assigned To:jani
 Block user comment: N
 Private report: N

 New Comment:

Then you need to look at Suhosin which provides such things like
disabling the 'e' modifier for preg_replace():
http://www.hardened-php.net/index.html


Previous Comments:

[2010-12-15 07:01:01] list2009 at lunch dot za dot net

disable_functions simply disables a function.  This is not what I need:
I needed to disable calling the function by reference, ie:
$moo="create_function"; $moo(); but not simple create_function(). 
preg_replace can be used instead of eval and create_function, but
preg_replace cannot be disabled in most production environments.  With
calling by reference, and it provides a ready path to obfuscated php
injection - with code that looks like a mathematical calculation.  If
I'm wasting my time here, maybe I should rather write the ultimate php
obfuscater with some watermark, and see how long it goes before I detect
that watermark in code hiding c99shell shell or V64.worm.php.2011 on my
own systems...


[2010-12-14 17:28:54] j...@php.net

With 5.3.4:



# php -d disable_functions=create_function t.php



Warning: create_function() has been disabled for security reasons in
/home/jani/t.php on line 6


[2009-09-29 15:20:28] list2009 at lunch dot za dot net

Description:

Unlike eval(), create_function can be called by reference.  It provides

an excellent hook for php obfuscation that is difficult to detect in an

automated way.  



I would like to define a list of functions that can NOT be called by

reference, and this function is first in my list, closely followed by

the other functions in this snippet, system(), ob_flush(), etc.  



Obfuscated code is one thing - obfuscated code that looks innocent is

another.

Reproduce code:
---
---

>From manual page: function.create-function#Description

---

Note that this code does not contain a single string for a scanner. 
Only a php interpreter can determine that this is obfuscated code, and
calls str_rot13, base64_decode and runs the base64 encoded code.

http://bugs.php.net/bug.php?id=49712&edit=1