Bug #51739 [Com]: tricky string to float conversion
Edit report at http://bugs.php.net/bug.php?id=51739edit=1 ID: 51739 Comment by: daniel dot buschke at nextiraone dot de Reported by: daniel dot buschke at nextiraone dot de Summary: tricky string to float conversion Status: Bogus Type:Bug Package: *General Issues PHP Version: 5.2.13 New Comment: look at this: 8315e839da08e2a7afe6dd12ec58245d - 8315 is a valid integer - e is the sign for an exponent - BUT: 839da08e2a7afe6dd12ec58245d is not an integer! So it is not a valid exponent! Previous Comments: [2010-05-04 15:15:24] ahar...@php.net This is expected and documented behaviour: string to float conversions will use any valid numeric data at the start of the string and ignore anything thereafter. The e is being processed because it's being treated as an exponent. More information: http://php.net/language.types.string#language.types.string.conversion [2010-05-04 15:07:40] daniel dot buschke at nextiraone dot de Description: If you convert a string like 8315e839da08e2a7afe6dd12ec58245d into a float the conversion results in float(INF). The conversion seems to use only 8315e839 and throws anything else away. $ php -r 'var_dump(time()+rand()+8315e839da08e2a7afe6dd12ec58245d);' float(INF) Converting this string into a float is - of course - a bug of my PHP script. But at least I would like to discuss about the conversion behavior. It is fully correct to convert this string into a float if it is just 8315e839 but throwing some data away is - from my point of view - not a valid behavior. Test script: --- var_dump((float)8315e839da08e2a7afe6dd12ec58245d); Expected result: false or null or some other invalid floats or a warning Actual result: -- float(INF) -- Edit this bug report at http://bugs.php.net/bug.php?id=51739edit=1
Req #50698 [Asn-Csd]: SoapClient should handle wsdls with some incompatiable endpoints
Edit report at http://bugs.php.net/bug.php?id=50698edit=1 ID: 50698 Updated by: dmi...@php.net Reported by: zippy1981 at gmail dot com Summary: SoapClient should handle wsdls with some incompatiable endpoints -Status: Assigned +Status: Closed Type: Feature/Change Request Package: *General Issues Operating System: Windows XP/7 and probably all. PHP Version: 5.2.12, 5.3.1 Assigned To: dmitry 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: [2010-05-05 09:43:48] dmi...@php.net Automatic comment from SVN on behalf of dmitry Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=299013 Log: Fixed bug #50698 (SoapClient should handle wsdls with some incompatiable endpoints). (Justin Dearing) [2010-04-02 20:48:18] zippy1981 at gmail dot com Submitted a new patch with error handling. [2010-04-02 17:29:49] zippy1981 at gmail dot com Below is a patch that helps to fix the behavior. The following problems remain: 1) If the wsdl contains only non http endpoints, and the location parameter is not specified, a proper error message is not generated. 2) If the wsdl contains only non http endpoints, and the location parameter is specified, the error Uncaught SoapFault exception: [Client] Function (echo) is not a valid method for this service in File.php:21 is displayed. Index: ext/soap/php_sdl.c === --- ext/soap/php_sdl.c (revision 297339) +++ ext/soap/php_sdl.c (working copy) @@ -832,7 +832,12 @@ if (strncmp((char*)tmp- children-content, WSDL_HTTP_TRANSPORT, sizeof(WSDL_HTTP_TRANSPORT)) == 0) { soapBinding- transport = SOAP_TRANSPORT_HTTP; } else { - soap_error1(E_ERROR, Parsing WSDL: PHP-SOAP doesn't support transport '%s', tmp-children-content); + // Since this is an E_NOTICE severity message, it will disappear into the ether. + soap_error1(E_NOTICE, Parsing WSDL: PHP-SOAP doesn't support transport '%s', tmp-children-content); + efree(soapBinding); + efree(tmpbinding); + trav = trav- next; + continue; } } } [2010-01-13 20:59:45] zippy1981 at gmail dot com Thanks for your reply. On my initial report I posted an example client. In a comment in the example client is a link to a github repo with a .NET web service that causes this issue (e.g. config file was bound to nettcp): http://github.com/zippy1981/EchoService Inside the .net service is also a copy of the PHP client. The .NET code can be compiled on any windows machine with the free IDE SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/Download/) I can provide a manually generated wsdl with false endpoints if needed. I'll gladly help test a fix or provide a mock if needed. [2010-01-13 20:29:39] srina...@php.net thanks for the clarification. if you can provide a test case /script , it would help us to work on this. thanks again for taking time for following up on this. your help will definitely help PHP make better ! 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=50698 -- Edit this bug report at http://bugs.php.net/bug.php?id=50698edit=1
Bug #49349 [Com]: gettext behaves differently in php 5.3.0 (5.2.x ignored setlocale errors)
Edit report at http://bugs.php.net/bug.php?id=49349edit=1 ID: 49349 Comment by: sjake_it at hotmail dot com Reported by: raulsalitrero at gmail dot com Summary: gettext behaves differently in php 5.3.0 (5.2.x ignored setlocale errors) Status: Assigned Type: Bug Package: Gettext related Operating System: win32 only - windows xp sp3 PHP Version: 5.3.0 Assigned To: pajoye New Comment: Same problem here with Windows Server 2003 SP2. This bug prevents me from upgrading to php 5.3.x It's been 8 months now so I hope this bug will be fixed quickly now. Previous Comments: [2010-04-19 02:00:08] egorinsk at gmail dot com Hi, the same problem here with Windows XP SP2 and PHP 5.3.1 . In PHP 5.2, setlocale() call failed, but gettext() used information from LANG, LC_ALL and LANGUAGE variables. That was good, because I could use putenv() to change gettext() language on Windows and setlocale() on Linux. But now setlocale() on Windows fails, and gettext() always uses system locale, and messages are not translated. Actually, I don't need locales, they only bring problems, I'd prefer to always set it to POSIX locale to get consistent behaviour independent from server setup, but gettext() requires to use it :( [2010-04-14 01:17:18] jorgecanta47 at hotmail dot com Same problem here with Windows Vista Home Premium, PHP 5.3.1 in XAMPP. Is there any workaround yet? Thanks [2010-04-05 17:19:37] euridica at narod dot ru Still same in 5.3.2. Translation is done only to default system locale. [2009-12-18 15:44:06] bengibollen at hotmail dot com I have got this problem as well. I'd like to add that the system default language/locale gets translated. But no other languages. Example: I have windows vista, English version, and the system default locale is set to Swedish. The strings that are supposed to be translated are all written in English; _(Hello World!). I have made three translations: ./se/LC_MESSAGES/default.mo ./de/LC_MESSAGES/default.mo ./en/LC_MESSAGES/default.mo /*nonsense words/phrases only for testing*/ I always get the Swedish translation no matter what configurations* I try. If I rename the Swedish translation file I get no translation at all, only the default string. * I've tried all kind of parameters for the following: setlocale(LC_ALL, ...); putenv(LANGUAGE=...); putenv(LANG=...);putenv(LC_ALL=...); [2009-12-08 13:57:06] paulw at torchtrust dot org I am also getting this big. Is it fixed in 5.3.1? Is there a work around? Thanks Paul 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=49349 -- Edit this bug report at http://bugs.php.net/bug.php?id=49349edit=1
[PHP-BUG] Bug #51745 [NEW]: session_regenerate_id(TRUE); doesn't delete $_SESSION
From: Operating system: Window 7 Ultimate 32 bit PHP version: 5.3SVN-2010-05-05 (SVN) Package: Session related Bug Type: Bug Bug description:session_regenerate_id(TRUE); doesn't delete $_SESSION Description: $_SESSION should become an empty array after session_regenerate_id with true, but it doens't! Test script: --- ?php if(!isset($_SESSION)) session_start(); $_SESSION['a']='asd'; session_regenerate_id(TRUE); echo var_dump($_SESSION).'br/'; ? Expected result: array(0) { } Actual result: -- array(1) { [a]= string(3) asd } -- Edit bug report at http://bugs.php.net/bug.php?id=51745edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51745r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51745r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51745r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51745r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51745r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51745r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51745r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51745r=needscript Try newer version: http://bugs.php.net/fix.php?id=51745r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51745r=support Expected behavior: http://bugs.php.net/fix.php?id=51745r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51745r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51745r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51745r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51745r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=51745r=dst IIS Stability: http://bugs.php.net/fix.php?id=51745r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51745r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51745r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51745r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51745r=mysqlcfg
[PHP-BUG] Bug #51746 [NEW]: Failed to load php5apache2_2.dll
From: Operating system: Windows XP pro PHP version: 5.2.13 Package: Apache2 related Bug Type: Bug Bug description:Failed to load php5apache2_2.dll Description: php-5.2.13-nts-Win32-VC6-x86 php version httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi --- apache version Test script: --- I Installed the 5.2.13 php and its failing to load the php5apache2_2.dll. These lines I added in httpd.conf LoadModule php5_module c:/php/php5apache2_2.dll AddType application/x-httpd-php .php .php5 PHPIniDir c:/php I am not sure abount 5.3 version of php. any workaround for this? Can I get the old version of php i.e 5.2.8 or 10 so that I can test it with their modules Please let me know Expected result: It should ne able to load the dll and apache service should start Actual result: -- apache service is crashing and generating event in system event log The Apache2.2 service terminated with service-specific error 1 (0x1). For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. -- Edit bug report at http://bugs.php.net/bug.php?id=51746edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51746r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51746r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51746r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51746r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51746r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51746r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51746r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51746r=needscript Try newer version: http://bugs.php.net/fix.php?id=51746r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51746r=support Expected behavior: http://bugs.php.net/fix.php?id=51746r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51746r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51746r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51746r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51746r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=51746r=dst IIS Stability: http://bugs.php.net/fix.php?id=51746r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51746r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51746r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51746r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51746r=mysqlcfg
Bug #51746 [Opn-Fbk]: Failed to load php5apache2_2.dll
Edit report at http://bugs.php.net/bug.php?id=51746edit=1 ID: 51746 Updated by: paj...@php.net Reported by: mallu dot it at gmail dot com Summary: Failed to load php5apache2_2.dll -Status: Open +Status: Feedback Type: Bug Package: Apache2 related Operating System: Windows XP pro PHP Version: 5.2.13 New Comment: Disable all extensions and try again. Then find which extension is causing issue, you are certainly missing some DLLs Previous Comments: [2010-05-05 12:51:25] mallu dot it at gmail dot com Description: php-5.2.13-nts-Win32-VC6-x86 php version httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi --- apache version Test script: --- I Installed the 5.2.13 php and its failing to load the php5apache2_2.dll. These lines I added in httpd.conf LoadModule php5_module c:/php/php5apache2_2.dll AddType application/x-httpd-php .php .php5 PHPIniDir c:/php I am not sure abount 5.3 version of php. any workaround for this? Can I get the old version of php i.e 5.2.8 or 10 so that I can test it with their modules Please let me know Expected result: It should ne able to load the dll and apache service should start Actual result: -- apache service is crashing and generating event in system event log The Apache2.2 service terminated with service-specific error 1 (0x1). For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. -- Edit this bug report at http://bugs.php.net/bug.php?id=51746edit=1
Bug #48601 [Opn-Csd]: xpath() returns FALSE for legitimate query
Edit report at http://bugs.php.net/bug.php?id=48601edit=1 ID: 48601 Updated by: rricha...@php.net Reported by: theultramage at gmail dot com Summary: xpath() returns FALSE for legitimate query -Status: Open +Status: Closed Type: Bug Package: SimpleXML related Operating System: Windows Vista PHP Version: 6CVS-2009-06-19 (snap) -Assigned To: +Assigned To: rrichards 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: [2010-05-05 13:40:13] rricha...@php.net Automatic comment from SVN on behalf of rrichards Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=299016 Log: fix bug #48601 (xpath() returns FALSE for legitimate query) add test [2009-06-24 16:13:21] theultramage at gmail dot com From the mail of the main libxml developer (http://mail.gnome.org/archives/xml/2009-June/msg00040.html): A NULL object or an empty node set should be treated in the same way. Also There is no iterator API. So for one part, the current SimpleXML code has a bug because it does not handle the NULL value correctly (should return empty array, not FALSE). And second, there's currently no other solution. [2009-06-19 10:57:16] theultramage at gmail dot com Description: SimpleXML's xpath() implementation contains code that returns FALSE for some queries where it should be returning an empty container object. In revision 1.79 of simplexml.c (http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.78r2=1.79) the call to xmlXPathEval() was hotfixed to avoid crashing if the query errored. However, the author also added a check against retval-nodesetval, treating NULL as an error situation. I believe this was an incorrect decision. There is a scenario where 'nodesetval' will be NULL - when querying for the attribute of a non-matching element ('/foo/@attr' when there are no 'foo' nodes); in all other 'bad' queries that I tried, 'nodesetval' came initialized and containing zero nodes. So, we can see that for certain queries, simplexml will give an incorrect result. This was already pointed out on 18-dec-2005 by an user comment on the php simplexml::xpath documentation page. I have sent an inquiry to the xml mailing list (http://mail.gnome.org/archives/xml/2009-June/msg00019.html) asking for clarification, however I believe that the current logic is incorrect. I checked php's DOM module src and libxml's xpath1.c code example, and they do not consider it a problem (DOM initializes empty DOMNodeList, example sets count to 0). Alternatively, the code should not be messing with what is apparently internal structures, and instead use the API for processing, if one is available. Reproduce code: --- ?php $xml = '?xml version=1.0 encoding=utf-8?dummy/'; $db = new SimpleXMLElement($xml); if( FALSE !== $db-xpath(/foo/@attr) ) echo OK; else echo Error!; ? Expected result: xpath() should return an empty array. Actual result: -- xpath() returns FALSE. -- Edit this bug report at http://bugs.php.net/bug.php?id=48601edit=1
Bug #51746 [Fbk-Opn]: Failed to load php5apache2_2.dll
Edit report at http://bugs.php.net/bug.php?id=51746edit=1 ID: 51746 User updated by: mallu dot it at gmail dot com Reported by: mallu dot it at gmail dot com Summary: Failed to load php5apache2_2.dll -Status: Feedback +Status: Open Type: Bug Package: Apache2 related Operating System: Windows XP pro PHP Version: 5.2.13 New Comment: Can you please detail yr previous comment? Thanks Previous Comments: [2010-05-05 13:09:38] paj...@php.net Disable all extensions and try again. Then find which extension is causing issue, you are certainly missing some DLLs [2010-05-05 12:51:25] mallu dot it at gmail dot com Description: php-5.2.13-nts-Win32-VC6-x86 php version httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi --- apache version Test script: --- I Installed the 5.2.13 php and its failing to load the php5apache2_2.dll. These lines I added in httpd.conf LoadModule php5_module c:/php/php5apache2_2.dll AddType application/x-httpd-php .php .php5 PHPIniDir c:/php I am not sure abount 5.3 version of php. any workaround for this? Can I get the old version of php i.e 5.2.8 or 10 so that I can test it with their modules Please let me know Expected result: It should ne able to load the dll and apache service should start Actual result: -- apache service is crashing and generating event in system event log The Apache2.2 service terminated with service-specific error 1 (0x1). For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. -- Edit this bug report at http://bugs.php.net/bug.php?id=51746edit=1
Bug #45847 [Com]: strftime() returns an empty string when using the %e conversion specifier
Edit report at http://bugs.php.net/bug.php?id=45847edit=1 ID: 45847 Comment by: cyrille37 at gmail dot fr Reported by: vincent at vent dot be Summary: strftime() returns an empty string when using the %e conversion specifier Status: Assigned Type: Bug Package: Date/time related Operating System: win32 only PHP Version: 5.2.6 Assigned To: derick New Comment: strftime() is not portable, so for Win32 have a look at http://msdn.microsoft.com/en-us/library/fe06s4ak%28VS.71%29.aspx You could not find %e but ... there is the formater char # that can Remove leading zeros (if any). Replace %e by %#d, it's work ! Cyrille. Previous Comments: [2008-08-17 22:56:50] paj...@php.net %e is not supported on Windows. strftime PHP's implementation is not portable. Assigned to the maintainer, if he likes to comment more or make it portable. See: http://msdn.microsoft.com/en-us/library/fe06s4ak(VS.71).aspx for the list of supported identifiers. [2008-08-17 22:09:42] vincent at vent dot be Description: When I use the strftime() function to format a date, it returns an empty string when I use the %e conversion specifier in the formatting string. I'm using the newest version of the WAMPSERVER package (with Apache 2.2.8). I hope this helps you any further, do not hesitate to contact me if you have further questions. Thanks! -Vincent Reproduce code: --- ?PHP $time = mktime(); echo This does not work: . strftime(%e, $time); echo , while dis does work: . strftime(%d, $time); echo . Adding parameters doesn't fix the problem: . strftime(%A %e %B %Y, $time); ? Expected result: This does not work: 18, while dis does work: 18. Adding parameters doesn't fix the problem: Monday 18 August 2008 Actual result: -- This does not work: , while dis does work: 18. Adding parameters doesn't fix the problem: -- Edit this bug report at http://bugs.php.net/bug.php?id=45847edit=1
Bug #51746 [Opn-Fbk]: Failed to load php5apache2_2.dll
Edit report at http://bugs.php.net/bug.php?id=51746edit=1 ID: 51746 Updated by: paj...@php.net Reported by: mallu dot it at gmail dot com Summary: Failed to load php5apache2_2.dll -Status: Open +Status: Feedback Type: Bug Package: Apache2 related Operating System: Windows XP pro PHP Version: 5.2.13 New Comment: Disable the extension in php.ini, all. Then try again to start apache. If it works, then enable again the extensions, one by one, to see which extension is causing you this problem. Previous Comments: [2010-05-05 13:44:15] mallu dot it at gmail dot com Can you please detail yr previous comment? Thanks [2010-05-05 13:09:38] paj...@php.net Disable all extensions and try again. Then find which extension is causing issue, you are certainly missing some DLLs [2010-05-05 12:51:25] mallu dot it at gmail dot com Description: php-5.2.13-nts-Win32-VC6-x86 php version httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi --- apache version Test script: --- I Installed the 5.2.13 php and its failing to load the php5apache2_2.dll. These lines I added in httpd.conf LoadModule php5_module c:/php/php5apache2_2.dll AddType application/x-httpd-php .php .php5 PHPIniDir c:/php I am not sure abount 5.3 version of php. any workaround for this? Can I get the old version of php i.e 5.2.8 or 10 so that I can test it with their modules Please let me know Expected result: It should ne able to load the dll and apache service should start Actual result: -- apache service is crashing and generating event in system event log The Apache2.2 service terminated with service-specific error 1 (0x1). For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. -- Edit this bug report at http://bugs.php.net/bug.php?id=51746edit=1
[PHP-BUG] Bug #51747 [NEW]: nothing
From: Operating system: windows PHP version: 5.3.2 Package: Output Control Bug Type: Bug Bug description:nothing Description: ?php include 'mysql-connect.php'; $username = $_POST['username']; $password = $_POST['password']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $age = $_POST['age']; $ip = $_SERVER['REMOTE_ADDR']; $result = mysql_num_rows(mysql_query(SELECT * FROM te2 WHERE username='$username')); if($result == 1) { echo username already exist; } else { mysql_query(INSERT INTO te2 (username, password, firstname, lastname, age, ip) VALUES ('$username', '$password', '$firstname', '$lastname', '$age', '$ip')); echo u are successfully registered; pClick a href=login.phphere/a to login./p;} ? Expected result: ?php include 'mysql-connect.php'; $username = $_POST['username']; $password = $_POST['password']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $age = $_POST['age']; $ip = $_SERVER['REMOTE_ADDR']; $result = mysql_num_rows(mysql_query(SELECT * FROM te2 WHERE username='$username')); if($result == 1) { echo username already exist; } else { mysql_query(INSERT INTO te2 (username, password, firstname, lastname, age, ip) VALUES ('$username', '$password', '$firstname', '$lastname', '$age', '$ip')); echo u are successfully registered; pClick a href=login.phphere/a to login./p;} ? Actual result: -- in my code insert into values code dont work .pls help me -- Edit bug report at http://bugs.php.net/bug.php?id=51747edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51747r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51747r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51747r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51747r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51747r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51747r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51747r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51747r=needscript Try newer version: http://bugs.php.net/fix.php?id=51747r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51747r=support Expected behavior: http://bugs.php.net/fix.php?id=51747r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51747r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51747r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51747r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51747r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=51747r=dst IIS Stability: http://bugs.php.net/fix.php?id=51747r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51747r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51747r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51747r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51747r=mysqlcfg
Bug #48511 [Asn-Bgs]: libxml_get_errors() returns an empty array but libxml_get_last_error() doesn't
Edit report at http://bugs.php.net/bug.php?id=48511edit=1 ID: 48511 Updated by: rricha...@php.net Reported by: geoffers+phpbugs at gmail dot com Summary: libxml_get_errors() returns an empty array but libxml_get_last_error() doesn't -Status: Assigned +Status: Bogus Type: Bug Package: XML Writer Operating System: Mac OS 10.5.7 PHP Version: 5.3CVS-2009-06-09 (CVS) Assigned To: rrichards New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You must set libxml_use_internal_errors(true); in order to to use the structured error handler and get a populated libxml_get_errors() return value. libxml_get_last_error() always will return last error regardless of the xml error handler used. Previous Comments: [2009-08-21 09:38:58] michael202 at gmx dot de Oh I forgot to mention that the error is present in the release version of php 5.3: PHP 5.3.0 (cli) (built: Jul 29 2009 15:03:42) [2009-08-21 09:37:18] michael202 at gmx dot de I have a similar problem: libxml_get_errors() is empty after loading a faulty XML with simplexml_load_file() BUT libxml_get_last_error() contains the last error: var_dump(libxml_get_errors()) array(0) { } var_dump(libxml_get_last_error()) object(LibXMLError)#11 solution is to use libxml_use_internal_errors: libxml_clear_errors(); // otherwise you also get all of the old errors libxml_use_internal_errors(true); other advantage is the you do not get any PHP Warning outputs and you can call simplexml_load_file without the @-operator strange though: simplexml_load_file() displays the correct error position in the PHP Warning BUT libxml_get_errors() does not contain it. [2009-06-09 17:49:07] geoffers+phpbugs at gmail dot com Description: I would expect the last member of the array returned by libxml_get_errors() to be equal to libxml_get_last_error(), but the former returns an empty array while the latter returns the expected error object. Reproduce code: --- ?php $foo = new XMLWriter(); $foo-openMemory(); $foo-startElement(\xEF\xBF\xBF); var_dump(libxml_get_last_error()); var_dump(libxml_get_errors()); var_dump(libxml_get_last_error() == end(libxml_get_errors())); Expected result: Warning: XMLWriter::startElement(): Char 0x out of allowed range in /Users/gsnedders/Desktop/test.php on line 5 Warning: XMLWriter::startElement(): Invalid Element Name in /Users/gsnedders/Desktop/test.php on line 5 object(LibXMLError)#2 (6) { [level]= int(3) [code]= int(9) [column]= int(0) [message]= string(33) Char 0x out of allowed range [file]= string(0) [line]= int(0) } array(1) { [0]= object(LibXMLError)#2 (6) { [level]= int(3) [code]= int(9) [column]= int(0) [message]= string(33) Char 0x out of allowed range [file]= string(0) [line]= int(0) } } bool(true) Actual result: -- Warning: XMLWriter::startElement(): Char 0x out of allowed range in /Users/gsnedders/Desktop/test.php on line 5 Warning: XMLWriter::startElement(): Invalid Element Name in /Users/gsnedders/Desktop/test.php on line 5 object(LibXMLError)#2 (6) { [level]= int(3) [code]= int(9) [column]= int(0) [message]= string(33) Char 0x out of allowed range [file]= string(0) [line]= int(0) } array(0) { } bool(false) -- Edit this bug report at http://bugs.php.net/bug.php?id=48511edit=1
Req #51063 [Asn-Csd]: Add getimagesizefromstring
Edit report at http://bugs.php.net/bug.php?id=51063edit=1 ID: 51063 Updated by: paj...@php.net Reported by: bfra...@php.net Summary: Add getimagesizefromstring -Status: Assigned +Status: Closed Type:Feature/Change Request Package: GetImageSize related PHP Version: 5.3.1 Assigned To: pajoye 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. Applied a slightly cleaner patch. Thanks for your work! Previous Comments: [2010-05-05 15:39:36] paj...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=299022 Log: - #51063, news and test [2010-05-05 15:37:42] paj...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=299021 Log: - #51063, implement getimagesizefromstring [2010-03-06 12:01:26] ka...@php.net Patch looks good except for one thing, that is the parameter parsing. You should use something along the lines of: char *file; int file_len; HashTable *ht; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMS_CC, s|H, file, file_len, ht) == FAILURE) The old (and deprecated) way of first doing a switch and use zend_get_parameters*() should be avoided. Else good work on the patch ;) [2010-02-17 14:25:04] paj...@php.net Will apply it shortly after review (probably this WE). However it looks good already, thanks :) [2010-02-17 03:59:22] bfra...@php.net Here is a test for the new function: http://www.brianfrance.com/software/php/getimagesizefromstring/001.phpt and the required test.gif (php logo image): http://static.php.net/www.php.net/images/php.gif 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=51063 -- Edit this bug report at http://bugs.php.net/bug.php?id=51063edit=1
[PHP-BUG] Bug #51749 [NEW]: header(Location:) changing HTTP status
From: Operating system: Debian Lenny PHP version: 5.3.2 Package: HTTP related Bug Type: Bug Bug description:header(Location:) changing HTTP status Description: Please see bug #25044 (http://bugs.php.net/bug.php?id=25044), where this issue has previously been addressed to some extent. When this previous bug was fixed, the fix simply involved adding the exact mentioned codes to an exception list for status response codes that are not overwritten upon sending a Location header. Now, 201, 301, 303, 305, and 307 do not overwrite the Response code. Nevertheless, all others still do. A more permanent fix would be not setting the status for ANY response code (very similar to the actual fix originally suggested for #25044). For backwards compatibility, you could set the response code if it has not already been set at the time that the Location header is set; but it should never be overwritten if it already has been set. HTTP Responses 503 and 426 come immediately to mind as additional reasonable cases for adding a Location header; but in fact, neither RFC 1945 (HTTP/1.0), RFC 2616 (HTTP/1.1), RFC 2817 (Upgrading to TLS Within HTTP/1.1), nor any other IETF or other relevant standard limits the Location header to any particular response, other than to recommend (SHOULD) it for 301, 302, 303, 305 (could be read as MUST), 307, and suggest it for 201 (and intentionally undefined by RFC 4918 (HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)) for 207). So preventing any status code from having a Location header is undesirable (however silly it may be for some certain responses). This would future-proof the code in question against any future changes that do not involve a mandatory or forbidden Location: field (for which the current code would most likely require patching anyway). (To be fair, this is documented behavior, even if it is non-standards-compliant. Mind you, the documentation is contradictory; http_response_code apparently Forces the HTTP response code to the specified value., but at the same time, The second special case is the Location: header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless the 201 or a 3xx status code has already been set. It is also true that most current clients will ignore a Location header for most non-3xx responses, but that is unimportant.) I would not consider this issue to have particular security concerns. Test script: --- header(HTTP/1.1 503 Service Unavailable); header(Location: http://www.php.net/;); Expected result: HTTP Response: HTTP/1.1 503 Service Unavailable Location: http://www.php.net/ Actual result: -- HTTP Response: HTTP/1.1 302 Found Location: http://www.php.net/ -- Edit bug report at http://bugs.php.net/bug.php?id=51749edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51749r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51749r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51749r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51749r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51749r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51749r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51749r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51749r=needscript Try newer version: http://bugs.php.net/fix.php?id=51749r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51749r=support Expected behavior: http://bugs.php.net/fix.php?id=51749r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51749r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51749r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51749r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51749r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=51749r=dst IIS Stability: http://bugs.php.net/fix.php?id=51749r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51749r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51749r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51749r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51749r=mysqlcfg
Bug #51745 [Opn-Bgs]: session_regenerate_id(TRUE); doesn't delete $_SESSION
Edit report at http://bugs.php.net/bug.php?id=51745edit=1 ID: 51745 Updated by: der...@php.net Reported by: maxtjh at hotmail dot com Summary: session_regenerate_id(TRUE); doesn't delete $_SESSION -Status: Open +Status: Bogus Type: Bug Package: Session related Operating System: Window 7 Ultimate 32 bit PHP Version: 5.3SVN-2010-05-05 (SVN) New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php It says nowhere that it empties the session. Actually, the documentation says explicitly that it does not. Previous Comments: [2010-05-05 12:19:19] maxtjh at hotmail dot com Description: $_SESSION should become an empty array after session_regenerate_id with true, but it doens't! Test script: --- ?php if(!isset($_SESSION)) session_start(); $_SESSION['a']='asd'; session_regenerate_id(TRUE); echo var_dump($_SESSION).'br/'; ? Expected result: array(0) { } Actual result: -- array(1) { [a]= string(3) asd } -- Edit this bug report at http://bugs.php.net/bug.php?id=51745edit=1
Bug #51747 [Opn-Bgs]: nothing
Edit report at http://bugs.php.net/bug.php?id=51747edit=1 ID: 51747 Updated by: degeb...@php.net Reported by: debasishbasak132 at gmail dot com Summary: nothing -Status: Open +Status: Bogus Type: Bug Package: Output Control Operating System: windows PHP Version: 5.3.2 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. Previous Comments: [2010-05-05 15:18:48] debasishbasak132 at gmail dot com Description: ?php include 'mysql-connect.php'; $username = $_POST['username']; $password = $_POST['password']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $age = $_POST['age']; $ip = $_SERVER['REMOTE_ADDR']; $result = mysql_num_rows(mysql_query(SELECT * FROM te2 WHERE username='$username')); if($result == 1) { echo username already exist; } else { mysql_query(INSERT INTO te2 (username, password, firstname, lastname, age, ip) VALUES ('$username', '$password', '$firstname', '$lastname', '$age', '$ip')); echo u are successfully registered; pClick a href=login.phphere/a to login./p;} ? Expected result: ?php include 'mysql-connect.php'; $username = $_POST['username']; $password = $_POST['password']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $age = $_POST['age']; $ip = $_SERVER['REMOTE_ADDR']; $result = mysql_num_rows(mysql_query(SELECT * FROM te2 WHERE username='$username')); if($result == 1) { echo username already exist; } else { mysql_query(INSERT INTO te2 (username, password, firstname, lastname, age, ip) VALUES ('$username', '$password', '$firstname', '$lastname', '$age', '$ip')); echo u are successfully registered; pClick a href=login.phphere/a to login./p;} ? Actual result: -- in my code insert into values code dont work .pls help me -- Edit this bug report at http://bugs.php.net/bug.php?id=51747edit=1
Req #49274 [Asn-Csd]: filter_var() should accept objects without fatal error
Edit report at http://bugs.php.net/bug.php?id=49274edit=1 ID: 49274 Updated by: paj...@php.net Reported by: cel...@php.net Summary: filter_var() should accept objects without fatal error -Status: Assigned +Status: Closed Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: * PHP Version: 5.3SVN-2009-08-16 (SVN) Assigned To: pajoye Previous Comments: [2009-10-09 17:32:53] s...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revisionrevision=289434 Log: - Merge: fix #49274, filter_var does not accept object without a toString implementation [2009-09-05 17:37:03] paj...@php.net I will close it as soon as it gets merged in 5.3.1, if the RM agrees. [2009-09-05 17:35:27] s...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revisionrevision=288083 Log: - fix #49274, filter_var does not accept object without a toString implementation [2009-08-17 21:59:13] paj...@php.net http://pastie.org/586442 should do it. I did not not test more than the test case here. [2009-08-17 13:55:58] paj...@php.net it is indeed valid for all objects but it is still an edge case. A check for IS_OBJECT + tostring() existence could be easy enough and with almost no impact(perf impact is null on the existing application). If you have some time to write one, go ahead. 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=49274 -- Edit this bug report at http://bugs.php.net/bug.php?id=49274edit=1
Bug #51463 [Com]: ErrorException thrown from error_handler not catchable in exception handler
Edit report at http://bugs.php.net/bug.php?id=51463edit=1 ID: 51463 Comment by: whatrevolution at yahoo dot com Reported by: tyra3l at gmail dot com Summary: ErrorException thrown from error_handler not catchable in exception handler Status: Re-Opened Type: Bug Package: Scripting Engine problem Operating System: Windows Xp Sp3, Debian Lenny PHP Version: 5.3.2 New Comment: OP's test code, result: ( ! ) Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /var/www/php_bugs/exception_in_error_handler.php on line 13 PHP Version 5.2.10-2ubuntu6.4 System Linux 2.6.31-20-generic x86_64 Build Date Jan 6 2010 22:36:47 Server API Apache 2.0 Handler PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety disabled Zend Memory Manager enabled Apache/2.2.12 (Ubuntu) Previous Comments: [2010-04-02 15:19:15] tyra3l at gmail dot com Another weird thing that I observed: If I try to handle the fatal error from register shutdown function then the error_get_last() will return NULL if I throw the ErrorException from the error handler. If I don't try to convert exceptions from errors, then the error_get_last() will return the fatal error in the shutdown function. Or if I generate fatal error for example with new NonExistentClassName; then the error_handler doesn't get called (because this is a fatal error), but the shutdown function gets the fatal error with error_get_last() So it seems that there is some strange magic with this situation. Tyrael [2010-04-02 13:41:02] tyra3l at gmail dot com But the exception handler should be called after the error handler and before accessing the empty property which gives the fatal error, isn't it? I mean at first the interpreter tries to access the variable named $foo, then generates a E_NOTICE which is trapped by the error handler, which trows an Exception which never catched at all. [2010-04-02 13:35:54] tyra3l at gmail dot com shit, my mistake, $foo will be empty, so $this-$foo will be generating a fatal error, but before that, generate a warning about $foo is empty. :/ [2010-04-02 13:33:40] tyra3l at gmail dot com On Lenny I was testing with the dotdeb.org 5.3.2 deb, on windows this is the TS VC9 build [2010-04-02 13:29:49] tyra3l at gmail dot com Description: It seems that there are some cases, when you can't catch Exceptions with exception_handler which was thrown from error_handler for some errors. For example if you do this: $class = new StdClass; echo $class-$foo; error_handler gets called, ErrorException was thrown, but the Exception wasn't catched with the exception_handler. if you try echo $foo; instead of echo $class-$foo; then the same error gets called with the error handler (by same error, I mean same parameters), but the Exception thrown in this case is successfuly catched by the exception handler. Test script: --- ?php error_reporting(E_ALL); ini_set('display_errors', 0); function debug($s){ echo pre; var_dump($s); echo /pre; } set_error_handler( function ($errno, $errstr, $errfile, $errline ) { debug('error_handler'); debug(array( 'errno' = $errno, 'errstr'= $errstr, 'errfile' = $errfile, 'errline' = $errline, )); throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } ); set_exception_handler( function(Exception $e){ debug('exception_handler'); debug($e); } ); $class = new StdClass; echo $class-$foo; echo 'done'; Expected result: string(13) error_handler array(4) { [errno]= int(8) [errstr]= string(23) Undefined variable: foo [errfile]= string(55) C:\work\xampp_vc9\htdocs\default\bug\error_handling.php [errline]= int(46) } string(17) exception_handler object(ErrorException)#4 (8) { [message:protected]= string(23) Undefined variable: foo ... Actual result: -- string(13) error_handler array(4) { [errno]= int(8) [errstr]= string(23) Undefined variable: foo [errfile]= string(55) C:\work\xampp_vc9\htdocs\default\bug\error_handling.php [errline]= int(46) }
Bug #47424 [Com]: not operator does a C cast to long which is different to other ops
Edit report at http://bugs.php.net/bug.php?id=47424edit=1 ID: 47424 Comment by: whatrevolution at yahoo dot com Reported by: d_kelsey at uk dot ibm dot com Summary: not operator does a C cast to long which is different to other ops Status: Open Type: Bug Package: Scripting Engine problem Operating System: Linux 64Bit PHP Version: 5.2CVS-2009-02-17 (CVS) New Comment: Bug OP's test, result: int 9223372036854775807 int 9223372036854775807 PHP Version 5.2.10-2ubuntu6.4 System Linux 2.6.31-20-generic x86_64 Build Date Jan 6 2010 22:36:47 Server API Apache 2.0 Handler PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety disabled Zend Memory Manager enabled Apache/2.2.12 (Ubuntu) Previous Comments: [2009-02-17 14:05:01] d_kelsey at uk dot ibm dot com Description: In zend_operators.c the function ZEND_API int bitwise_not_function(..) handles a double by doing a c cast to a long if (op1-type == IS_DOUBLE) { op1-value.lval = (long) op1-value.dval; op1-type = IS_LONG; } but all other operators use the zendi_convert_to_long() macro so not isn't consistent with the other operators. this can result in an unexpected value as shown in the test case Reproduce code: --- ?php define(MAX_64Bit, 9223372036854775807); $e = (MAX_64Bit + 1); $f = (int)$e; var_dump(~(MAX_64Bit + 1)); var_dump(~$f); ? Expected result: int(-9223372036854775808) int(-9223372036854775808) Actual result: -- int(9223372036854775807) int(-9223372036854775808) -- Edit this bug report at http://bugs.php.net/bug.php?id=47424edit=1
Bug #47623 [Com]: array_shift() fails with @ operator
Edit report at http://bugs.php.net/bug.php?id=47623edit=1 ID: 47623 Comment by: whatrevolution at yahoo dot com Reported by: Henry at huis-stijl dot nl Summary: array_shift() fails with @ operator Status: Verified Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: 5.*, 6CVS (2009-04-30) New Comment: ?php $_SESSION['villas'] = array ( 1 = array(1,2,3), 2 = array(2,3,4), 3 = array(3,4,5), 4 = array(4,5,6), ); /* * ONE: */ /* While(@$_SESSION['villas'] != array()) { $row = array_shift(@$_SESSION['villas']); print_r($row); }// einde while */ /* * TWO: */ /* while($foo['villas'] != array()) { $row = array_shift(@$foo['villas']); // Removing @ makes it work.. var_dump($foo); } */ /* * THREE: */ //I cann bypass this failure by using: $arr_temp = @$_SESSION['villas']; $row = array_shift($arr_temp); $_SESSION['villas'] = $arr_temp; unset($arr_temp); var_dump($_SESSION['villas']); ? Result: One and Two, same as described before. Three: array 0 = array 0 = int 2 1 = int 3 2 = int 4 1 = array 0 = int 3 1 = int 4 2 = int 5 2 = array 0 = int 4 1 = int 5 2 = int 6 PHP Version 5.2.10-2ubuntu6.4 System Linux 2.6.31-20-generic x86_64 Build Date Jan 6 2010 22:36:47 Server API Apache 2.0 Handler PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety disabled Zend Memory Manager enabled Apache/2.2.12 (Ubuntu) Previous Comments: [2009-04-13 18:23:01] j...@php.net This has nothing to do with sessions. Simplified script: ?php $foo['villas'] = array('a','b','c'); while($foo['villas'] != array()) { $row = array_shift(@$foo['villas']); // Removing @ makes it work.. var_dump($foo); } ? [2009-03-16 22:11:28] Henry at huis-stijl dot nl Tried with and without the @ same output. [2009-03-16 16:26:07] j...@php.net If you remove those @'s, what does it output..? [2009-03-11 14:07:22] Henry at huis-stijl dot nl ?php session_start(); ini_set('session.cache_limiter', 'private'); // © 2009 Huis-stijl, Henry Hekman $_SESSION['villas'] = array ( 1 = array(1,2,3), 2 = array(2,3,4), 3 = array(3,4,5), 4 = array(4,5,6), ); While(@$_SESSION['villas'] != array()) { $row = array_shift(@$_SESSION['villas']); print_r($row); }// einde while ? on php 4 i get Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 2 [1] = 3 [2] = 4 ) Array ( [0] = 3 [1] = 4 [2] = 5 ) Array ( [0] = 4 [1] = 5 [2] = 6 ) on phph 5.2.9 i get a loop that doesnt end Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) Array ( [0] = 1 [1] = 2 [2] = 3 ) [2009-03-11 12:56:34] Henry at huis-stijl dot nl Description: Script was working perfectly on PHP 4 when updated to PHP5.2.9 I found an error. I was filling a array in the session and looped it with array_shift until the arry was empty. This loop kept giving me the first value but did not erased it from te original arry. Reproduce code: --- $row = array_shift(@$_SESSION['villas']); Expected result: 1. $row getting the first element from $_SESSION['villas'] 2. $_SESSION['villas'] to get lost the first element. Actual result: -- 1. $row getting the first element from $_SESSION['villas'] 2. $_SESSION['villas'] did not lost the first element and was unchanged I cann bypass this failure by using: $arr_temp = @$_SESSION['villas']; $row = array_shift($arr_temp); $_SESSION['villas'] = $arr_temp; unset($arr_temp); -- Edit this bug report at http://bugs.php.net/bug.php?id=47623edit=1
Bug #48255 [Com]: Mixing control structure syntaxes causes parse error
Edit report at http://bugs.php.net/bug.php?id=48255edit=1 ID: 48255 Comment by: whatrevolution at yahoo dot com Reported by: faisun at sina dot com Summary: Mixing control structure syntaxes causes parse error Status: Verified Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: 5.*, 6CVS (2009-05-12) New Comment: Bug OP test, result: ( ! ) Parse error: syntax error, unexpected ':' in /var/www/php_bugs/mixed_control_structure.php on line 5 PHP Version 5.2.10-2ubuntu6.4 System Linux 2.6.31-20-generic x86_64 Build Date Jan 6 2010 22:36:47 Server API Apache 2.0 Handler PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety disabled Zend Memory Manager enabled Apache/2.2.12 (Ubuntu) Previous Comments: [2009-05-13 04:05:30] faisun at sina dot com Description: PHP Version: 5.2.9.2 ? if(21): echo ABCD; if(43){ echo EFGH; } else: echo 123456; endif; ? Result: Parse error: parse error in E:\wwwroot\1.php on line 5 ? if(21): echo ABCD; if(43){ echo EFGH; } else{} else: echo 123456; endif; ? Result:ABCDEFGH Reproduce code: --- ? if(21): echo ABCD; if(43){ echo EFGH; } else: echo 123456; endif; ? Expected result: ABCDEFGH Actual result: -- Parse error: parse error in E:\wwwroot\1.php on line 5 -- Edit this bug report at http://bugs.php.net/bug.php?id=48255edit=1
Bug #51463 [Com]: ErrorException thrown from error_handler not catchable in exception handler
Edit report at http://bugs.php.net/bug.php?id=51463edit=1 ID: 51463 Comment by: tyra3l at gmail dot com Reported by: tyra3l at gmail dot com Summary: ErrorException thrown from error_handler not catchable in exception handler Status: Re-Opened Type: Bug Package: Scripting Engine problem Operating System: Windows Xp Sp3, Debian Lenny PHP Version: 5.3.2 New Comment: obviously. closures was added with php 5.3 http://php.net/manual/en/functions.anonymous.php Tyrael Previous Comments: [2010-05-05 20:15:14] whatrevolution at yahoo dot com OP's test code, result: ( ! ) Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /var/www/php_bugs/exception_in_error_handler.php on line 13 PHP Version 5.2.10-2ubuntu6.4 System Linux 2.6.31-20-generic x86_64 Build Date Jan 6 2010 22:36:47 Server API Apache 2.0 Handler PHP API 20041225 PHP Extension 20060613 Zend Extension 220060519 Debug Build no Thread Safety disabled Zend Memory Manager enabled Apache/2.2.12 (Ubuntu) [2010-04-02 15:19:15] tyra3l at gmail dot com Another weird thing that I observed: If I try to handle the fatal error from register shutdown function then the error_get_last() will return NULL if I throw the ErrorException from the error handler. If I don't try to convert exceptions from errors, then the error_get_last() will return the fatal error in the shutdown function. Or if I generate fatal error for example with new NonExistentClassName; then the error_handler doesn't get called (because this is a fatal error), but the shutdown function gets the fatal error with error_get_last() So it seems that there is some strange magic with this situation. Tyrael [2010-04-02 13:41:02] tyra3l at gmail dot com But the exception handler should be called after the error handler and before accessing the empty property which gives the fatal error, isn't it? I mean at first the interpreter tries to access the variable named $foo, then generates a E_NOTICE which is trapped by the error handler, which trows an Exception which never catched at all. [2010-04-02 13:35:54] tyra3l at gmail dot com shit, my mistake, $foo will be empty, so $this-$foo will be generating a fatal error, but before that, generate a warning about $foo is empty. :/ [2010-04-02 13:33:40] tyra3l at gmail dot com On Lenny I was testing with the dotdeb.org 5.3.2 deb, on windows this is the TS VC9 build 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=51463 -- Edit this bug report at http://bugs.php.net/bug.php?id=51463edit=1
Req #50581 [Opn-Asn]: php.ini inconsitency
Edit report at http://bugs.php.net/bug.php?id=50581edit=1 ID: 50581 Updated by: paj...@php.net Reported by: stevenmartin99 at gmail dot com Summary: php.ini inconsitency -Status: Open +Status: Assigned Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: windows -PHP Version: 5.3SVN-2009-12-26 (snap) +PHP Version: * -Assigned To: +Assigned To: pajoye New Comment: We can take care of that in the next version (trunk). Previous Comments: [2009-12-26 20:14:24] stevenmartin99 at gmail dot com Description: in the php.ini with php5.3.0 there is 6lines that are not consistant with the layout of the ini file these two line below have comments written on the same line.the stand is before them [967] = ;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client [968] = ;extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client these line below have now whitespace after the ; as all comment lines have [1040] = ;PCRE library recursion limit. 1041] = ;Please note that if you set this value to a high number you may consume all [1042] = ;the available process stack and eventually crash PHP (due to reaching the [1043] = ;stack size limit imposed by the Operating System). Expected result: I am trying to make a php.ini gui interface and these lines are messing it up ..i presume its just a mistake in the php.ini thanks -- Edit this bug report at http://bugs.php.net/bug.php?id=50581edit=1
Bug #51740 [Opn-Csd]: acinclude.m4 macro PHP_CHECK_SIZEOF is not properly quoted
Edit report at http://bugs.php.net/bug.php?id=51740edit=1 ID: 51740 Updated by: fel...@php.net Reported by: dave dot mulford at gmail dot com Summary: acinclude.m4 macro PHP_CHECK_SIZEOF is not properly quoted -Status: Open +Status: Closed Type: Bug Package: Compile Warning Operating System: gentoo linux 2.6.30 PHP Version: 5.3SVN-2010-05-04 (snap) -Assigned To: +Assigned To: felipe 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. Thanks for the patch! ;) Previous Comments: [2010-05-05 23:55:46] fel...@php.net Automatic comment from SVN on behalf of felipe Revision: http://svn.php.net/viewvc/?view=revisionamp;revision=299035 Log: - Fixed bug #51740 (acinclude.m4 macro PHP_CHECK_SIZEOF is not properly quoted) Patch by: dave dot mulford at gmail dot com [2010-05-04 16:14:20] dave dot mulford at gmail dot com I could not get the system to allow me to upload my patch file, so here it is, in plain text. --- acinclude.m4.original 2010-05-04 13:48:26.0 + +++ acinclude.m42010-05-04 13:48:37.0 + @@ -1095,7 +1095,7 @@ dnl dnl PHP_CHECK_SIZEOF(type, cross-value, extra-headers) dnl -AC_DEFUN(PHP_CHECK_SIZEOF, [ +AC_DEFUN([PHP_CHECK_SIZEOF], [ AC_MSG_CHECKING([size of $1]) _PHP_CHECK_SIZEOF($1, $2, $3, [ AC_DEFINE_UNQUOTED([SIZEOF_]translit($1,a-z,A-Z_), [$]php_cv_sizeof_[]$1, [Size of $1]) [2010-05-04 16:10:23] dave dot mulford at gmail dot com Description: When building an extension I've written, aclocal displays a warning that the macro PHP_CHECK_SIZEOF is underquoted. I have confirmed this by checking line 1098 of the acinclude.m4 file that gets copied after phpize is run. According to the autoconf documentation, all macros should be surrounded by quotes. http://www.gnu.org/software/autoconf/manual/autoconf.html#Macro- Definitions Expected result: No warnings should be displayed when the aclocal command is executed. Actual result: -- acinclude.m4:1098: warning: underquoted definition of PHP_CHECK_SIZEOF acinclude.m4:1098: run info '(automake)Extending aclocal' acinclude.m4:1098: or see http://sources.redhat.com/automake/automake.html#Extending-aclocal -- Edit this bug report at http://bugs.php.net/bug.php?id=51740edit=1
Bug #51563 [Opn-Asn]: Incorrect result
Edit report at http://bugs.php.net/bug.php?id=51563edit=1 ID: 51563 Updated by: fel...@php.net Reported by: zdenis at free dot fr Summary: Incorrect result -Status: Open +Status: Assigned Type: Bug Package: mbstring related Operating System: Windows PHP Version: 5.3.2 -Assigned To: +Assigned To: moriyoshi Previous Comments: [2010-04-15 16:06:23] zdenis at free dot fr Description: When using mb_detect_encoding, depending on how many é characters - or any character above 127 - are present in the string, the detected charset is not consistent and then sometimes wrong. Test script: --- // little example php -r echo mb_detect_encoding(\é\, 'UTF-8,ISO-8859-1'); php -r echo mb_detect_encoding(\éé\, 'UTF-8,ISO-8859-1'); // real life example php -r echo mb_detect_encoding(\Produit commandé\, 'UTF-8,ISO-8859-1'); php -r echo mb_detect_encoding(\Société\, 'UTF-8,ISO-8859-1'); Expected result: ISO-8859-1 ISO-8859-1 ISO-8859-1 ISO-8859-1 Actual result: -- UTF-8 ISO-8859-1 UTF-8 ISO-8859-1 -- Edit this bug report at http://bugs.php.net/bug.php?id=51563edit=1
[PHP-BUG] Bug #51752 [NEW]: structure-ifdisposition: Pop3:OK IMAP:fail
From: Operating system: Linux OS PHP version: 5.2.13 Package: IMAP related Bug Type: Bug Bug description:structure-ifdisposition: Pop3:OK IMAP:fail Description: When testing against the SmarterMail server, the imap_fetchstructure function returns 0 for ifdisposition although when connecting to the same server using pop3 returns true. The result should be true for the IMAP connection. C-client compiled against was 2007e. Also, the filename attribute should be present within the dparameters array, not in the parameter array. This bug is identical to one previously fixed (17135). Please let me know if you need any additional information. Test script: --- Test Script: $conn=imap_open({localhost:143/imap}INBOX,name, pass); imap_fetchstructure($conn,$msgNumb); $conn=imap_open({localhost:110/pop3}INBOX,name, pass); imap_fetchstructure($conn,$msgNumb); Results [IMAP] [1] = stdClass Object ( [type] = 3 [encoding] = 3 [ifsubtype] = 1 [subtype] = OCTET-STREAM [ifdescription] = 0 [ifid] = 0 [bytes] = 298 [ifdisposition] = 0 [ifdparameters] = 0 [ifparameters] = 1 [parameters] = Array ( [0] = stdClass Object ( [attribute] = name [value] = sqlprov.log ) [1] = stdClass Object ( [attribute] = filename [value] = sqlprov.log ) ) ) [POP3] [1] = stdClass Object ( [type] = 3 [encoding] = 3 [ifsubtype] = 1 [subtype] = OCTET-STREAM [ifdescription] = 0 [ifid] = 0 [bytes] = 298 [ifdisposition] = 1 [disposition] = ATTACHMENT [ifdparameters] = 1 [dparameters] = Array ( [0] = stdClass Object ( [attribute] = FILENAME [value] = sqlprov.log ) ) [ifparameters] = 1 [parameters] = Array ( [0] = stdClass Object ( [attribute] = NAME [value] = sqlprov.log ) ) ) -- Edit bug report at http://bugs.php.net/bug.php?id=51752edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51752r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51752r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51752r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51752r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51752r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51752r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51752r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51752r=needscript Try newer version: http://bugs.php.net/fix.php?id=51752r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51752r=support Expected behavior: http://bugs.php.net/fix.php?id=51752r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51752r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51752r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51752r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51752r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=51752r=dst IIS Stability: http://bugs.php.net/fix.php?id=51752r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51752r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51752r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51752r=nozend MySQL Configuration Error:
Bug #47817 [Com]: PHP hangs when running proc_open()
Edit report at http://bugs.php.net/bug.php?id=47817edit=1 ID: 47817 Comment by: php dot net at phor dot net Reported by: steven dot abarnett at gmail dot com Summary: PHP hangs when running proc_open() Status: Bogus Type: Bug Package: Reproducible crash Operating System: Windows XP PHP Version: 5.2.9 New Comment: I have the same problem. I am having occasional hangups on the proc_open command like this, but only when run in a class's constructor function. the same code works fine in the root context. Previous Comments: [2009-03-31 07:13:42] j...@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-03-29 11:49:35] steven dot abarnett at gmail dot com I have found a fix for now, although I would like to know if better options exist. The fault seems to lie in Windows. Both XP and Vista refuse to allow file descriptors over 2. When I changed the code like so it worked just fine: $descriptors = array( 0 = array(pipe, r), // STDIN. Used to feed input 1 = array(pipe, r), // STDOUT. We are writing to it, though 2 = array(pipe, w), // STDERR. Used to read errors ); // Build the command line and start the process $cmd = 'C:/program files/gnu/gnupg/gpg.exe --batch --no-verbose --passphrase-fd 1 --output decrypted.zip --decrypt encrypted.zip.gpg'; $gpg = proc_open( $cmd, $descriptors, $pipes); if(is_resource($gpg)) { // Push passphrase to custom pipe fwrite($pipes[1], $passphrase); fclose($pipes[1]); proc_close($gpg); } Is there a solution to be able to create more pipes in Windows? It's very inconvenient having to write to STDOUT just to make my program work properly, as it prevents me from reading any output thrown out by the code (other than errors) [2009-03-28 02:48:21] steven dot abarnett at gmail dot com Description: Unfortunately as far as I can tell, I am the only person having this problem- which leads me to wonder if it's an issue with my PHP configuration. Although I keep using default configuration, so I am at a loss. I have tried installing PHP and Apache, I have tried in xampp, and I have tried in WAMP. Every time after running the proc_open() command the PHP script will wait for the process to close before reading the next line- making reading or writing to any pipes impossible. $fileDesc = array( 0 = array(pipe, r), // STDIN 1 = array(pipe, w), // STDOUT 2 = array(pipe, w) // STDERR ); die(Got this far); $handle = proc_open(C:/wherever/program.exe, $fileDesc, $pipes); fwrite($pipes[0], input); fclose($pipes[0]); proc_close($handle); Displays Got this far and dies, as expected. However: $fileDesc = array( 0 = array(pipe, r), // STDIN 1 = array(pipe, w), // STDOUT 2 = array(pipe, w) // STDERR ); $handle = proc_open(C:/wherever/program.exe, $fileDesc, $pipes); die(Got this far); fwrite($pipes[0], input); fclose($pipes[0]); proc_close($handle); Will simply hang and seem to cease all function. The moment that I close program.exe through task manager the script continues as if nothing were wrong, dying with the output Got this far. The input is never passed to the program, although no errors are raised when I hit the proc_close() line. Reproduce code: --- $descriptors = array( 0 = array(pipe, r), // STDIN. Used to feed input 1 = array(pipe, w), // STDOUT. Used to read output 2 = array(pipe, w), // STDERR. Used to read errors 3 = array(pipe, r) // We can feed the passphrase here ); // Build the command line and start the process $cmd = 'C:/program files/gnu/gnupg/gpg.exe --batch --no-verbose --passphrase-fd 3 --output decrypted.zip --decrypt encrypted.zip.gpg'; $gpg = proc_open( $cmd, $descriptors, $pipes); if(is_resource($gpg)) { // Push passphrase to custom pipe fwrite($pipes[3], $passphrase); fclose($pipes[3]); proc_close($gpg); } Expected result: Expected to find decrypted.zip in the same directory as the PHP script (a decrypted version of encrypted.zip.gpg, which is located in the same directory as the PHP script) Actual result: -- When localhost/test.php was run the webpage continued to load indefinitely. I waited as long as 20 minutes. The PHP.ini file should stop
Bug #40443 [Com]: session_start problem
Edit report at http://bugs.php.net/bug.php?id=40443edit=1 ID: 40443 Comment by: dagoemanu at msn dot com Reported by: lawatia_mhm at yahoo dot com Summary: session_start problem Status: Bogus Type: Bug Package: Safe Mode/open_basedir Operating System: CentOS PHP Version: 5.2.1 New Comment: Put the line php_value session.save_path /home/username/tmp in the .htaccess file. Previous Comments: [2007-02-13 09:12:16] bj...@php.net I am sorry, but this is not a support forum. We simply don't have the time nor the man power to answer all questions that can come up. Please have a look at http://php.net/support for more appropriate places to ask. [2007-02-13 07:43:48] lawatia_mhm at yahoo dot com Hello dear .. any body here ?? .. 3 sites on the server can't do anything because of this problem :( .. [2007-02-12 19:06:54] lawatia_mhm at yahoo dot com Anybody here dear ? [2007-02-12 10:25:21] lawatia_mhm at yahoo dot com Dear you said : Set appropriate session.save_path. Can you tell me to what do I have to write dear : ; As of PHP 4.0.1, you can define the path as: ; ; session.save_path = N;/path ; ; where N is an integer. Instead of storing all the session files in ; /path, what this will do is use subdirectories N-levels deep, and ; store the session data in those directories. This is useful if you ; or your OS have problems with lots of files in one directory, and is ; a more efficient layout for servers that handle lots of sessions. ; ; NOTE 1: PHP will not create this directory structure automatically. ; You can use the script in the ext/session dir for that purpose. ; NOTE 2: See the section on garbage collection below if you choose to ; use subdirectories for session storage ; ; The file storage module creates files using mode 600 by default. ; You can change that by using ; ; session.save_path = N;MODE;/path ; ; where MODE is the octal representation of the mode. Note that this ; does not overwrite the process's umask. ;session.save_path = /tmp [2007-02-12 10:03:15] tony2...@php.net The script whose uid is 32025 is not allowed to access owned by uid 0 in Set appropriate session.save_path. 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=40443 -- Edit this bug report at http://bugs.php.net/bug.php?id=40443edit=1
Bug #49349 [Com]: gettext behaves differently in php 5.3.0 (5.2.x ignored setlocale errors)
Edit report at http://bugs.php.net/bug.php?id=49349edit=1 ID: 49349 Comment by: scott at etw dot ca Reported by: raulsalitrero at gmail dot com Summary: gettext behaves differently in php 5.3.0 (5.2.x ignored setlocale errors) Status: Assigned Type: Bug Package: Gettext related Operating System: win32 only - windows xp sp3 PHP Version: 5.3.0 Assigned To: pajoye New Comment: Is there a release date for 5.3.3? Spent the last few months building a project in 5.3 and my final steps was to add language support which i cant do with gettext due to this bug, and to revert to 5.2x would require other major code changes Previous Comments: [2010-05-05 12:12:39] sjake_it at hotmail dot com Same problem here with Windows Server 2003 SP2. This bug prevents me from upgrading to php 5.3.x It's been 8 months now so I hope this bug will be fixed quickly now. [2010-04-19 02:00:08] egorinsk at gmail dot com Hi, the same problem here with Windows XP SP2 and PHP 5.3.1 . In PHP 5.2, setlocale() call failed, but gettext() used information from LANG, LC_ALL and LANGUAGE variables. That was good, because I could use putenv() to change gettext() language on Windows and setlocale() on Linux. But now setlocale() on Windows fails, and gettext() always uses system locale, and messages are not translated. Actually, I don't need locales, they only bring problems, I'd prefer to always set it to POSIX locale to get consistent behaviour independent from server setup, but gettext() requires to use it :( [2010-04-14 01:17:18] jorgecanta47 at hotmail dot com Same problem here with Windows Vista Home Premium, PHP 5.3.1 in XAMPP. Is there any workaround yet? Thanks [2010-04-05 17:19:37] euridica at narod dot ru Still same in 5.3.2. Translation is done only to default system locale. [2009-12-18 15:44:06] bengibollen at hotmail dot com I have got this problem as well. I'd like to add that the system default language/locale gets translated. But no other languages. Example: I have windows vista, English version, and the system default locale is set to Swedish. The strings that are supposed to be translated are all written in English; _(Hello World!). I have made three translations: ./se/LC_MESSAGES/default.mo ./de/LC_MESSAGES/default.mo ./en/LC_MESSAGES/default.mo /*nonsense words/phrases only for testing*/ I always get the Swedish translation no matter what configurations* I try. If I rename the Swedish translation file I get no translation at all, only the default string. * I've tried all kind of parameters for the following: setlocale(LC_ALL, ...); putenv(LANGUAGE=...); putenv(LANG=...);putenv(LC_ALL=...); 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=49349 -- Edit this bug report at http://bugs.php.net/bug.php?id=49349edit=1
Req #23815 [Com]: imagecopymerge doesn't respect alpha-channel in PNG-24 file
Edit report at http://bugs.php.net/bug.php?id=23815edit=1 ID: 23815 Comment by: setvik at gmail dot com Reported by: bjorn at smokingmedia dot com Summary: imagecopymerge doesn't respect alpha-channel in PNG-24 file Status: Assigned Type: Feature/Change Request Package: Feature/Change Request Operating System: Linux pluto 2.4.18lvm-r1 PHP Version: 5.2.9 Assigned To: pajoye New Comment: I have the same need to merge alpha images with the opacity of the top one reduced, and like the others in this thread, I assumed imagecopymerge would respect the alpha settings in the image. Based on comments here and in the docs ( http://php.net/manual/en/function.imagecopymerge.php), others are making the same assumption. @pajoye - The inclusion of alpha support whether in imagecopymerge or an additional function would be very valuable for working with images, especially watermarks with complex transparency. Any chance imagecopymerge can be patched to support this? Or should an additional function be written and the documentation for imagecopymerge updated? What's your take? Previous Comments: [2009-12-10 18:35:56] andre at webkr dot de Ah, I see. It's imagecopy() which implements alpha transparency while imagecopymerge() does not. [2009-12-10 18:23:20] andre at webkr dot de So what does the it implements alpha transparency for true colour images in When pct = 0, no action is taken, when 100 this function behaves identically to imagecopy() for pallete images, while it implements alpha transparency for true colour images. mean anyway? [2009-07-20 12:10:43] steve at redmonkey dot org Thanks, understood. Although, I do think it would be a useful feature, perhaps there's scope for an 'imagecopymergealpha' type function in the future? [2009-07-20 08:43:04] paj...@php.net imagecopymerge was not meant to support the alpha channel but to emulate it via pct. It was also not meant to use both the alpha or the pct value to blend an image over another. [2009-07-20 05:44:49] steve at redmonkey dot org To make life a little easier I've put the notes and examples together on a simple web page at http://www.redmonkey.org/php-bug-23815/ After investigating the code base a little further I've realised my patch solution can be made more efficient as there is no need to make a copy of the source or pass the image over to gdImageCopy once the new alpha level has been set as we've already done the all the work and can simply set the pixels RGBA index within the second image scan. The revised patch (which is also available from a link on the web page) is as follows --- php-5.3.0/ext/gd/libgd/gd.c 2009-05-27 08:17:54.0 +0100 +++ php-5.3.0-build/ext/gd/libgd/gd.c 2009-07-20 05:54:21.709936176 +0100 @@ -2255,6 +2255,67 @@ int ncR, ncG, ncB; toy = dstY; + if (pct == 100) { + /* no opacity adjustment required pass through to gdImageCopy() */ + gdImageCopy(dst, src, dstX, dstY, srcX, srcY, w, h); + return; + } + + if (pct == 0) { + /* 0% opacity? nothing needs to be done */ + return; + } + + if (src-trueColor dst-trueColor) { + /* support for maintaining the alpha (transparency) of both source and +* destination images (assuming they are true colour) while opacity blending. +*/ + int ca, cr, cg, cb; + float na; + float ac; + + /* we need to loop through the src image to get the max transparency level */ + int mt = 0; + + for (y = 0; y h; y++) { + for (x = 0; x w; x++) { + c = gdImageGetTrueColorPixel (src, srcX + x, srcY + y); + ca = gdImageAlpha(src, c); + + mt = ca mt ? ca : mt; + } + } + + /* src has no transparency? set to use full alpha range */ + mt = mt == gdAlphaOpaque ? gdAlphaMax : mt; + + /* alpha correction factor */ + ac = (float)mt / gdAlphaMax; + + /* loop through the image again and set/adjust alpha channel level */ + for (y = 0; y h; y++) { + for (x = 0; x w; x++) { + c = gdImageGetTrueColorPixel (src,