Bug #52450 [Com]: $DomDocumentObj->encoding should not affect xml declaration

2010-09-05 Thread giorgio dot liscio at email dot it
Edit report at http://bugs.php.net/bug.php?id=52450&edit=1

 ID: 52450
 Comment by: giorgio dot liscio at email dot it
 Reported by:giorgio dot liscio at email dot it
 Summary:$DomDocumentObj->encoding should not affect xml
 declaration
 Status: Open
 Type:   Bug
 Package:DOM XML related
 Operating System:   all
 PHP Version:5.3.3
 Block user comment: N

 New Comment:

hi, can you examine my request?

thank you


Previous Comments:

[2010-07-26 23:58:02] giorgio dot liscio at email dot it

Description:

hi



consider this code:



i want to set utf-16 as internal encoding for domdocument

because source data is utf-16 encoded



$doc->encoding = "UTF-16";



but my output for web is handled by:



iconv_set_encoding("internal_encoding", "UTF-16");

iconv_set_encoding("output_encoding", "UTF-8//TRANSLIT//IGNORE");



or can be handled by



echo iconv("UTF-16", "UTF-8", $xmldata);



so the output is utf-8 encoded but the xml declaration says:







so $document->encoding property should work as how it works now, but it
should not affect the xml declaration



in plus you should provide an alternative to set $xmlEncoding (make it
non-readonly)



i'm sorry for my english... i hope you accept this request!

thank you







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


Bug #49373 [Com]: Unable to load dynamic library ".....php_pdo_pgsql.dll' -..."

2010-09-05 Thread andfinally at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=49373&edit=1

 ID: 49373
 Comment by: andfinally at gmail dot com
 Reported by:ejike dot chux at gmail dot com
 Summary:Unable to load dynamic library
 ".php_pdo_pgsql.dll' -..."
 Status: Bogus
 Type:   Bug
 Package:PDO related
 Operating System:   Windows
 PHP Version:5.2SVN-2009-08-26 (snap)
 Block user comment: N

 New Comment:

This worked for me, thanks very much!


Previous Comments:

[2009-08-26 15:14:44] paj...@php.net

And for other readers, pls do not follow the advice here, it works
perfectly well with the DLL we provide and you have to use it. Ex:



G:\test\php52> php -d extension_dir=ext -d extension=php_pdo.dll -d
extension=php_pdo_pgsql.dll -m

[PHP Modules]

bcmath

...

odbc

pcre

PDO

pdo_pgsql

...



[Zend Modules]


[2009-08-26 15:10:37] paj...@php.net

Be sure to have libpq.dll in your PATH. 


[2009-08-26 15:07:45] j...@php.net

Please try using this snapshot:

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

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

And use the provided dlls..


[2009-08-26 13:45:25] ejike dot chux at gmail dot com

Description:

Unable to load dynamic library '.php_pdo_pgsql.dll' - The specified
module could not be found.



In case you get the above error when using php5.2.6 - 5.3 go to this
link and click on the second link on the page. You get a rar file which
you unload its contents into you extensions folder(in windows, dont know
if the problem exists in other OS) The files inside are the proper
versions of the dll files php needs in windows



This is the link:

http://www.bmedon.net/download.html



I got this solution after I tracked it down to
http://www.wampserver.com/phorum/read.php?2,52679

Reproduce code:
---
*

Expected result:

*

Actual result:
--
Unable to load dynamic library '.php_pdo_pgsql.dll' - The specified
module could not be found.






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


Bug #52604 [Com]: Serialization of objects with __sleep() and fatal error

2010-09-05 Thread zerspam at mail dot ru
Edit report at http://bugs.php.net/bug.php?id=52604&edit=1

 ID: 52604
 Comment by: zerspam at mail dot ru
 Reported by:zerspam at mail dot ru
 Summary:Serialization of objects with __sleep() and fatal
 error
 Status: Open
 Type:   Bug
 Package:Session related
 Operating System:   irrelevant
 PHP Version:Irrelevant
 Block user comment: N

 New Comment:

Well, 3 weeks left and even no comments from dev team?


Previous Comments:

[2010-08-14 09:40:26] zerspam at mail dot ru

Description:

Seems like __sleep() does not being invoked when fatal error was risen.

Test script:
---
set_error_handler('my_error_handler');



session_start();



$obj = new myclass();



$_SESSION['obj'] = $obj;



$a->b();



class myclass

{

private $a = 1;

private $b = 2;



public function __sleep()

{

return array('a');

}

}



function my_error_handler($code, $error, $file = NULL, $line = NULL)

{

throw new ErrorException($error, $code, 0, $file, $line);

}

Expected result:

Object with only 'a' property in session file

Actual result:
--
Object with 'a' and 'b' properties in session file






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


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

2010-09-05 Thread f...@php.net
Edit report at http://bugs.php.net/bug.php?id=52569&edit=1

 ID: 52569
 Comment by: f...@php.net
 Reported by:mplomer at gmx dot de
 Summary:Implement "ondemand" process-manager (to allow zero
 children)
 Status: Analyzed
 Type:   Feature/Change Request
 Package:FPM related
 PHP Version:5.3.3
 Assigned To:fat
 Block user comment: N

 New Comment:

@dennisml at conversis dot de



It's complex to do and security risky. Don't want to mess with that.


Previous Comments:

[2010-09-04 16:26:06] dennisml at conversis dot de

Since this patch causes the master process to dynamically fork children
on demand I'm wondering if it would be feasible to introduce the
possibility to do setuid()/setgid() calls after the fork to run the
child process with different user id's?

What I'm thinking about is the mass-hosting case that was previously
talked about on the mailinglist. Back then this would have been quite a
bit of work to do but with this patch this should be much easier to
accomplish.


[2010-08-30 10:21:37] mplomer at gmx dot de

Some test results of the "ondemand"-pm:



General

- Pool has to start with 0 children - OK

- Handling and checking of new config options - OK



Concurrent requests

- Children has to be forked immediately on new requests without delay -
OK

- Idle children has to be killed after pm.process_idle_timeout + 0-1s -
OK

- When there are more than one idle children, kill only one per second
PER POOL - OK



Reaching pm.max_children limit

- No more processes has to be created - OK

- Requests have to wait until one child becomes idle and then get
handled immediately without further delay - OK

- When limit is reached, issue a warning and increase status counter
(and do this only once) - OK:

  Aug 28 13:39:41.537174 [WARNING] pid 27540,
fpm_pctl_on_socket_accept(), line 507: [pool www] server reached
max_children setting (10), consider raising it

- Warning is re-issued after children count decreases and hit the limit
again - OK



CPU burns

- When reaching max_children limit, pause libevent callback and reenable
it in the maintenance routine, to avoid CPU burns - OK



- When children takes too long to accept() the request, avoid CPU burn -
NOTOK

 -> happens sometimes (in praxis only sometimes after forking) - to
reproduce add an usleep(5) in children's code after fork(), or
apachebench with ~200 concurrent requests :-)

 -> You get a lot of: "fpm_pctl_on_socket_accept(), line 502: [pool www]
fpm_pctl_on_socket_accept() called"

 -> It's not a big problem, because this doesn't take much time (in one
rare case it took ~90ms on my machine), but it's not nice, especially
when the server is flooded with requests

 -> one idea:

   - do not re-enable event-callback in fpm_pctl_on_socket_accept

   - send an event from children just after accept() to parent process

   - re-enable event-callback in parent process, when it receives this
event from children

   - in case of an error it is re-enabled in the maintainance routine
after max 1s, which is IMHO not bad to throttle requests in case of
error



Stress tests

- Test-machine: Intel Core i7 930 (4 x 2.8 GHz) (VMware with 256 MB
RAM)



- Testing with 100 concurrent requests on the same pool to a sleep(10);
php script with 0 running processes and max_children = 200:

 - took about 4ms per fork in average

 - 25 processes are forked in one block (timeslice?), after this there
is a gap of 200-1000ms

  - took about 125ms to fork 25 children

  - took about 2.5s to fork all 100 children and accept the requests

- Testing with 200 concurrent requests

  - hits RAM limit of VM, so it's maybe not meaningful

  - took ~10.5s to fork all 200 children and accept the requests

- Testing with 10 concurrent requests on 20 pools (so in fact 200
concurrent requests)

  - took ~11.2s to fork all 200 children and accept the requests

  - all children are killed after process_timeout + 10s (1 process per
second per pool is killed) - OK


[2010-08-30 10:18:14] mplomer at gmx dot de

Patch version 5:

- Added missing fpm_globals.is_child check (proposed by jerome)

- Implemented "max children reached" status counter.

- Fixed missing last_idle_child = NULL; in
fpm_pctl_perform_idle_server_maintenance which caused the routine to
shutdown only one (or a few?) processes per second globally instead per
pool, when you have multiple pools. I think this was not the intention,
and it's a bug.


[2010-08-27 08:38:34] f...@php.net

Updates to come:



1- there is a bug. after fork, child process seems to run code reverved
to the 

parent process:



Aug 27 08:32:30.64

Bug #52776 [Opn->Asn]: MessageFormatter::__construct should throw an exception for invalid patterns

2010-09-05 Thread felipe
Edit report at http://bugs.php.net/bug.php?id=52776&edit=1

 ID: 52776
 Updated by: fel...@php.net
 Reported by:clicky at erebot dot net
 Summary:MessageFormatter::__construct should throw an
 exception for invalid patterns
-Status: Open
+Status: Assigned
 Type:   Bug
 Package:*Languages/Translation
 Operating System:   Ubuntu 9.10
 PHP Version:Irrelevant
-Assigned To:
+Assigned To:stas
 Block user comment: N



Previous Comments:

[2010-09-04 23:23:04] clicky at erebot dot net

Description:

MessageFormatter's constructor returns NULL when an invalid pattern is
given.

Instead, it should throw an exception.



This bug has already been reported twice before (see #52042 & #49161).
Each time the report was marked as bogus because the real problem got
overlooked. (the problem lies not in the given pattern being considered
invalid by ICU, the problem is in the constructor returning NULL)

Test script:
---


Expected result:

f1 is NULL

f2 is NULL

Fatal error: Uncaught exception 'Exception' with message 'Invalid
pattern' in %s:%d.

Actual result:
--
f1 is NULL

f2 is NULL

f3 is NULL






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


Bug #52774 [Opn->Asn]: Proxy object's store free callback calls zval_ptor_dtor on already freed data

2010-09-05 Thread felipe
Edit report at http://bugs.php.net/bug.php?id=52774&edit=1

 ID: 52774
 Updated by: fel...@php.net
 Reported by:cataphr...@php.net
 Summary:Proxy object's store free callback calls
 zval_ptor_dtor on already freed data
-Status: Open
+Status: Assigned
 Type:   Bug
 Package:Scripting Engine problem
 PHP Version:trunk-SVN-2010-09-04 (SVN)
-Assigned To:
+Assigned To:dmitry
 Block user comment: N



Previous Comments:

[2010-09-04 03:43:10] cataphr...@php.net

Description:

Proxy objects have this structure:



typedef struct _zend_proxy_object {

zval *object;

zval *property;

} zend_proxy_object;



zend_object_create_proxy does this:



ZEND_API zval *zend_object_create_proxy(zval *object, zval *member
TSRMLS_DC)

{

zend_proxy_object *pobj = emalloc(sizeof(zend_proxy_object));

/* ... */

pobj->property = member;

zval_add_ref(&pobj->property);

/* ... */

}



The property field is used to store a zval that, in the get and set
handlers can the passed to zend_proxy_object.object's read_property and
write_property callbacks, so that the reads and writes in the proxy
object can be proxied.



The store free callback for proxy objects calls zval_ptr_tor on
&pobj->property:



ZEND_API void zend_objects_proxy_free_storage(zend_proxy_object *object
TSRMLS_DC)

{

zval_ptr_dtor(&object->object);

zval_ptr_dtor(&object->property);

efree(object);

}



However, on script cleanup, the destruction order is wrong. The zval
stored in object->property is destroyed *before* the proxy object is.

Test script:
---
/* Extension */





typedef struct _proxy_test {

zend_object std;

long value;

} proxy_test;

static zend_class_entry *pt_ce_ptr;

static zend_object_handlers p_obj_handlers;

static zend_object_value p_ce_create_object(zend_class_entry *class_type
TSRMLS_DC)

{

zend_object_value zov;

proxy_test   *pobj;



pobj = emalloc(sizeof *pobj);

zend_object_std_init((zend_object *) pobj, class_type TSRMLS_CC);

pobj->value = 7;



object_properties_init(&pobj->std, class_type);

zov.handle = zend_objects_store_put(pobj,

(zend_objects_store_dtor_t) zend_objects_destroy_object,

(zend_objects_free_object_storage_t)
zend_objects_free_object_storage,

NULL TSRMLS_CC);

zov.handlers = &p_obj_handlers;

return zov;

}

zval *p_read_property(zval *object, zval *member, int type, const struct
_zend_literal *key TSRMLS_DC)

{

proxy_test *iobj = zend_object_store_get_object(object TSRMLS_CC);

if (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) {

zval *ret = zend_object_create_proxy(object, member TSRMLS_CC);

Z_DELREF_P(ret);

return ret;

} else {

zval *ret;

MAKE_STD_ZVAL(ret);

ZVAL_LONG(ret, iobj->value);

Z_DELREF_P(ret);

return ret;

}

}



void p_write_property(zval *object, zval *member, zval *value, const
struct _zend_literal *key TSRMLS_DC)

{

proxy_test *iobj = zend_object_store_get_object(object TSRMLS_CC);

if (Z_TYPE_P(value) == IS_LONG) {

iobj->value = Z_LVAL_P(value);

}

}

zval **p_get_property_ptr_ptr(zval *object, zval *member, const struct
_zend_literal *key TSRMLS_DC)

{

return NULL;

}



ZEND_MODULE_STARTUP_D(testext)

{

zend_class_entry ce;



INIT_CLASS_ENTRY(ce, "ProxyTestClass", NULL);

pt_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC);

pt_ce_ptr->create_object = p_ce_create_object;

memcpy(&p_obj_handlers, zend_get_std_object_handlers(), sizeof
p_obj_handlers);

/* could be NULL, but an empty impl is better (see bug #51768) */

p_obj_handlers.get_property_ptr_ptr = p_get_property_ptr_ptr;

p_obj_handlers.read_property = p_read_property;

p_obj_handlers.write_property = p_write_property;

}



/* Script */



whatever;

Expected result:

The proxy object would be destroyed before the property zval
encapsulated in it.

Actual result:
--
The property zval encapsulated in the proxy object is destroyed
prematurely.



Breakpoint on zend_object_create_proxy. Set data breakpoint on
&member->refcount__gc



Continue. Data breakpoint is hit (zval_add_ref(&pobj->property);). The
refcount is now 3.



Continue. Data breakpoint is hit. Call stack:



>   msvcr100d.dll!memset(unsigned char * dst=0x005a, unsigned char
value='`', unsigned long count=11071032)  Line 127  Asm

php5ts_debug.dll!_zend_mm_free_int(_zend_mm_heap * heap=0x02426d50,
void * p=0x028101a0, const

Bug #52773 [Opn->Asn]: Proxy objects have an inadequate destroy_object store callback

2010-09-05 Thread felipe
Edit report at http://bugs.php.net/bug.php?id=52773&edit=1

 ID: 52773
 Updated by: fel...@php.net
 Reported by:cataphr...@php.net
 Summary:Proxy objects have an inadequate destroy_object
 store callback
-Status: Open
+Status: Assigned
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   Windows
 PHP Version:trunk-SVN-2010-09-04 (SVN)
-Assigned To:
+Assigned To:dmitry
 Block user comment: N



Previous Comments:

[2010-09-04 03:17:55] cataphr...@php.net

Description:

zend_object_create_proxy calls zend_objects_store_put with the second
argument NULL:



See the definition of zend_object_create-proxy:



http://lxr.php.net/search?q=zend_object_create_proxy&project=PHP_TRUNK&defs=&refs=&path=&hist=



This results in the _store_object.dtor store callback being set to
zend_objects_destroy_object. See the definition of
zend_objects_store_put:



http://lxr.php.net/opengrok/xref/PHP_TRUNK/Zend/zend_objects_API.c#zend_objects_store_put



This callback is defined here:



http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_objects.c#zend_objects_destroy_object



It is inappropriate because it starts with:



ZEND_API void zend_objects_destroy_object(zend_object *object,
zend_object_handle handle TSRMLS_DC)

{

zend_function *destructor = object ? object->ce->destructor : NULL;



The first parameter won't actually be a zend_object; it'll be a
zend_proxy_object, whose definition is not compatible with that of
zend_object:



typedef struct _zend_object {

zend_class_entry *ce;

HashTable *properties;

zval **properties_table;

HashTable *guards; /* protects from __get/__set ... recursion */

} zend_object;



typedef struct _zend_proxy_object {

zval *object;

zval *property;

} zend_proxy_object;

Test script:
---
/* Extension */





typedef struct _proxy_test {

zend_object std;

long value;

} proxy_test;

static zend_class_entry *pt_ce_ptr;

static zend_object_handlers p_obj_handlers;

static zend_object_value p_ce_create_object(zend_class_entry *class_type
TSRMLS_DC)

{

zend_object_value zov;

proxy_test   *pobj;



pobj = emalloc(sizeof *pobj);

zend_object_std_init((zend_object *) pobj, class_type TSRMLS_CC);

pobj->value = 7;



object_properties_init(&pobj->std, class_type);

zov.handle = zend_objects_store_put(pobj,

(zend_objects_store_dtor_t) zend_objects_destroy_object,

(zend_objects_free_object_storage_t)
zend_objects_free_object_storage,

NULL TSRMLS_CC);

zov.handlers = &p_obj_handlers;

return zov;

}

zval *p_read_property(zval *object, zval *member, int type, const struct
_zend_literal *key TSRMLS_DC)

{

proxy_test *iobj = zend_object_store_get_object(object TSRMLS_CC);

if (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET) {

zval *ret = zend_object_create_proxy(object, member TSRMLS_CC);

Z_DELREF_P(ret);

return ret;

} else {

zval *ret;

MAKE_STD_ZVAL(ret);

ZVAL_LONG(ret, iobj->value);

Z_DELREF_P(ret);

return ret;

}

}



void p_write_property(zval *object, zval *member, zval *value, const
struct _zend_literal *key TSRMLS_DC)

{

proxy_test *iobj = zend_object_store_get_object(object TSRMLS_CC);

if (Z_TYPE_P(value) == IS_LONG) {

iobj->value = Z_LVAL_P(value);

}

}

zval **p_get_property_ptr_ptr(zval *object, zval *member, const struct
_zend_literal *key TSRMLS_DC)

{

return NULL;

}



/*static zend_function_entry proxy_test_methods[] = {

{NULL, NULL, NULL, 0, 0}

};*/



ZEND_MODULE_STARTUP_D(testext)

{

zend_class_entry ce;



INIT_CLASS_ENTRY(ce, "ProxyTestClass", NULL);

pt_ce_ptr = zend_register_internal_class(&ce TSRMLS_CC);

pt_ce_ptr->create_object = p_ce_create_object;

memcpy(&p_obj_handlers, zend_get_std_object_handlers(), sizeof
p_obj_handlers);

/* could be NULL, but an empty impl is better (see bug #51768) */

p_obj_handlers.get_property_ptr_ptr = p_get_property_ptr_ptr;

p_obj_handlers.read_property = p_read_property;

p_obj_handlers.write_property = p_write_property;

}



/* Script */



whatever;

unset($h);

Expected result:

zend_objects_destroy_object should not be the proxy object's
destructor.

A no-op destructor should be passed to the store_put function.

Actual result:
--
I didn't get a crash by change (the memory in object->ce->destructor
turned out to be zeroed, which makes zend_objects_destroy_object skip
the implementation), but we can see this doesn

Bug #45150 [Com]: MySQL functions cannot be used with 5.3.x on Vista when using "localhost"

2010-09-05 Thread songchongzhan at gmail dot com
Edit report at http://bugs.php.net/bug.php?id=45150&edit=1

 ID: 45150
 Comment by: songchongzhan at gmail dot com
 Reported by:conor dot kerr_php at dev dot ceon dot net
 Summary:MySQL functions cannot be used with 5.3.x on Vista
 when using "localhost"
 Status: Bogus
 Type:   Bug
 Package:MySQL related
 Operating System:   Windows Vista
 PHP Version:5.3CVS-2008-07-23 (snap)
 Block user comment: N

 New Comment:

Did you disable networking on windows. I use MySQL Query Browser connect
to MySQL, 

it has MySQL Error Number 2003. Use mysqli connect to MySQL, it return
like what 

you post:[2002].

And I use named pipe connect to MySQL by MySQL Query Browser, it is OK,
by php 

5.3.x does not support it util now.

Try to open MySQL network connection.


Previous Comments:

[2010-07-06 19:10:38] and...@php.net

PLEASE READ THIS : 



http://blogs.iis.net/donraman/archive/2010/06/11/php-5-3-and-mysql-connectivity-problem.aspx


[2010-05-11 08:30:30] kiewic at gmail dot com

Same problem with Windows Vista Ultimate SP2. Why isn't this a bug?


[2010-04-19 04:13:08] sasavilic at gmail dot com

I have same issue. Using Windows 7, 64-bit, IIS



When I try to connect to mysql server on 127.0.0.1 everything works
fine, but with localhost not.


[2010-04-10 03:58:16] buana95 at yahoo dot com

Same issue on Windows XP SP3 and PHP 5.3.1 with mysqlnd 5.0.5-dev -
081106 - $Revision: 289630 $. 



Work fine when using *libmysql.dll, but can not connect to database when
using *mysqlnd.dll (tested on mysql, mysqli, and PDO extension).



***



>From MySQL website: they have resolved the issue by looping to all
available IP (IPv4 - IPv6) and return the first successful connection.



So, it's must be from PHP streams that fail to resolve IPv6.



Never test on newer PHP version. Sorry.


[2010-04-05 07:52:30] telstra at dark-media dot net

Had the same problem on Windows Server 2008 R2 had to edit the hosts
file and un comment out the 127.0.0.1 localhost



Was stumbled for a while after upgrading from 5.2 to 5.3, this might not
be a bug with PHP but its something that is going to cause issues.




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=45150


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