[PHP-DEV] main/output.c problem

2012-02-13 Thread James Edmunds
The new output buffering mechanism has a compatibility function for people / extensions that use the "old way". There is a compatibility function php_output_handler_compat_func(). It is not quite as compatible as it should be, and any code that depends on it will break. Using the "old way" if t

[PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
Hi Dmitry. the patch does work, in sense of actually restoring the handlers state when you call zend_set_user_opcode_handler() with original handler. the patch does not solve the basic problem of no re-initialization of static arrayes on mac. As for feeling the array with zero's, if we do that,

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! Hi Dmitry. the patch does work, in sense of actually restoring the handlers state when you call zend_set_user_opcode_handler() with original handler. the patch does not solve the basic problem of no re-initialization of static arrayes on mac. Could you please describe in more details what'

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Dmitry Stogov
I'm not familiar with Mac, but I saw such behavior on Linux very long time ago, when on PHP restart static variables were still keep values from old process. Thanks. Dmitry. On 02/13/2012 01:02 PM, Stas Malyshev wrote: Hi! Hi Dmitry. the patch does work, in sense of actually restoring the h

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! I'm not familiar with Mac, but I saw such behavior on Linux very long time ago, when on PHP restart static variables were still keep values from old process. That might happen if the shared library was not unloaded (dlopen will not re-load library that is already loaded) however I don't u

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
Hi Stas reproduction is indeed easy - just change a static variable (e.q. call zend_set_user_opcode_handler()), then send SIGHUP to apache parent process and check the value in zend_user_opcode_handlers or zend_user_opcodes. it is possible that this problem is related to specific gcc versions bu

[PHP-DEV] Warning: PDOStatement after the output

2012-02-13 Thread marius adrian popa
I have this weird bug where the warning is printed after the query is executed and printed http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=ext%2Fpdo_firebird%2Ftests%2Fbug_43130.phpt Result is correct , warning is correct only the order is out of order ps: I will ask on pdo list t

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
Here is a simple test program that reproduce the issue on mac: lib.h: #include "lib.h" void set_index(

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
The last reproduction was executed on darwin 10.8 with gcc 4.2.1 On Monday, February 13, 2012 11:16:41 AM Stas Malyshev wrote: > Hi! > > > I'm not familiar with Mac, but I saw such behavior on Linux very long > > time ago, when on PHP restart static variables were still keep values > > from old p

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Gwynne Raskind
On Mon, Feb 13, 2012 at 04:38, yoram bar haim wrote: > Here is a simple test program that reproduce the issue on mac: [snip] > shell> gcc -o lib.so -shared lib.c > shell> gcc -o main main.c lib.so > shell> ./main This example is flawed. The manpage for dlclose(3) on Darwin explicitly states that

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread yoram bar haim
Indeed, when using dlsym the value is recreated. now the question is what happens at apache restart (on mac) that causes incorrect behavior. a-priory to that question, static initializers can not be trusted on some situations. On Monday, February 13, 2012 11:44:15 AM Gwynne Raskind wrote: > On M

Re: [PHP-DEV] Warning: PDOStatement after the output

2012-02-13 Thread Johannes Schlüter
On Mon, 2012-02-13 at 11:37 +0200, marius adrian popa wrote: > I have this weird bug where the warning is printed after the query is > executed and printed > > http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=ext%2Fpdo_firebird%2Ftests%2Fbug_43130.phpt > > Result is correct , warnin

Re: [PHP-DEV] Warning: PDOStatement after the output

2012-02-13 Thread Lester Caine
Johannes Schlüter wrote: On Mon, 2012-02-13 at 11:37 +0200, marius adrian popa wrote: > I have this weird bug where the warning is printed after the query is > executed and printed > > http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=ext%2Fpdo_firebird%2Ftests%2Fbug_43130.phpt

[PHP-DEV] Internal server error on PHP syntax error?

2012-02-13 Thread Jakov Sosic
Hi. I don't know if this is the right group to ask this kind of question, but if it isn't please excuse my french ;) As far as I can see, PHP does not report back to Apache error 500 in case of a syntax error in code but displays empty page. For example this code: I was curious, so I googl

Re: [PHP-DEV] Internal server error on PHP syntax error?

2012-02-13 Thread Ferenc Kovacs
On Mon, Feb 13, 2012 at 5:50 PM, Jakov Sosic wrote: > Hi. > > I don't know if this is the right group to ask this kind of question, but > if it isn't please excuse my french ;) > > As far as I can see, PHP does not report back to Apache error 500 in case > of a syntax error in code but displays e

Re: [PHP-DEV] Internal server error on PHP syntax error?

2012-02-13 Thread Jakov Sosic
On 02/13/2012 05:55 PM, Ferenc Kovacs wrote: It is implemented already, php will report HTTP 500 on fatal errors, except if the headers were already sent. And I also remember a php/xdebug bug, which caused the headers to be sent see http://bugs.xdebug.org/view.php?id=587 and https://bugs.php.net

Re: [PHP-DEV] Internal server error on PHP syntax error?

2012-02-13 Thread Reindl Harald
Am 13.02.2012 18:08, schrieb Jakov Sosic: > and I get this in logs: > IPADDR - - [13/Feb/2012:18:03:52 +0100] "GET /~username/test/ HTTP/1.1" 500 > 20 "-" "Mozilla/5.0 (X11; Linux x86_64; > rv:10.0.1) Gecko/20100101 Firefox/10.0.1" > > so, 500 headers are returned but internal server error page

[PHP-DEV] Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Xinchen Hui
Hi: As dmitry said today, there is no way to get a user opcode handler which can be called *after* a specific built-in handler. So please expose zend_vm_get_opcde_handler. Before 5.4 release. :) Thanks. Sent from my iPad -- PHP Internals - PHP Runtime Development Mailing Li

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! Indeed, when using dlsym the value is recreated. now the question is what happens at apache restart (on mac) that causes incorrect behavior. a-priory to that question, static initializers can not be trusted on some situations. I think we need to figure out why. This is standard behavior fo

[PHP-DEV] how to debug a php script ( the C code beneath it)

2012-02-13 Thread Adi Mutu
Hello, Perhaps this is a stupid question, but i haven't coded in C in years and i'm not very familiar with development/debugging tools. If I have a php script say 20 lines, How can I see a path of the corresponding C code which is executed? What If i would like to break at a certain php line

Re: [PHP-DEV] Internal server error on PHP syntax error?

2012-02-13 Thread Jakov Sosic
On 02/13/2012 06:10 PM, Reindl Harald wrote: yes, but the more important is the status code so that search engines do not index you broken page, apache SHOULD NOT provide his own error-page because you can also send 500 status code within your script for whatever reason and want your output not

Re: [PHP-DEV] how to debug a php script ( the C code beneath it)

2012-02-13 Thread Ángel González
On 13/02/12 21:48, Adi Mutu wrote: > Hello, > > Perhaps this is a stupid question, but i haven't coded in C in years and i'm > not very familiar with development/debugging tools. If I have a php script > say 20 lines, > How can I see a path of the corresponding C code which is executed? What If i

Re: [PHP-DEV] Internal server error on PHP syntax error?

2012-02-13 Thread Ángel González
On 13/02/12 22:11, Jakov Sosic wrote: > On 02/13/2012 06:10 PM, Reindl Harald wrote: > > >> yes, but the more important is the status code so that search >> engines do not index you broken page, apache SHOULD NOT provide >> his own error-page because you can also send 500 status code >> within your

Re: [PHP-DEV] Internal server error on PHP syntax error?

2012-02-13 Thread Jakov Sosic
On 02/14/2012 12:15 AM, Ángel González wrote: Maybe there is an easier way. This extension allows to show your own page on PHP errors: http://svn.wikimedia.org/viewvc/mediawiki/trunk/php/wmerrors/ This: * Don't strip symbols, deadlocks are still occurring and we need to find out why does no

Re: [PHP-DEV] how to debug a php script ( the C code beneath it)

2012-02-13 Thread Yader Hernandez
It's also nice to see what PHP is actually doing and a way to learn the internals of PHP. 2012/2/13 Ángel González > On 13/02/12 21:48, Adi Mutu wrote: > > Hello, > > > > Perhaps this is a stupid question, but i haven't coded in C in years and > i'm not very familiar with development/debugging t

RE: [PHP-DEV] how to debug a php script ( the C code beneath it)

2012-02-13 Thread Clint M Priest
I've used etrace: http://ndevilla.free.fr/etrace/ with php recently, works nicely. Produces output like: main | Crumble_make_apple_crumble | | Crumble_buy_stuff | | | Crumble_buy | | | Crumble_buy (total: 5 times) | | Crumble_prepare_apples

[PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Xinchen Hui
Hi: a patch for this proposal: Index: zend_vm_gen.php === --- zend_vm_gen.php (revision 323168) +++ zend_vm_gen.php (working copy) @@ -797,7 +797,7 @@ if (ZEND_VM_OLD_EXECUTOR && $spec

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Stas Malyshev
Hi! Hi: a patch for this proposal: Don't see any problem with it. Dmitry, any issues you see with it? If not, we can commit it. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To un

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Dmitry Stogov
In general exposing zend_vm_get_opcode_handler() can't help. You know that executor might be generated/compiled not only using call-treading but also using switch or goto. In these cases zend_vm_get_opcode_handler() won't return a function that could be called. Thanks. Dmitry. On 02/14/2012 1

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Dmitry Stogov
I thought Yoram sent some very simple test case yesterday. Thanks. Dmitry. On 02/13/2012 10:23 PM, Stas Malyshev wrote: Hi! Indeed, when using dlsym the value is recreated. now the question is what happens at apache restart (on mac) that causes incorrect behavior. a-priory to that question, s

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Xinchen Hui
On Tue, Feb 14, 2012 at 3:00 PM, Dmitry Stogov wrote: > In general exposing zend_vm_get_opcode_handler() can't help. > You know that executor might be generated/compiled not only using > call-treading but also using switch or goto. In these cases > zend_vm_get_opcode_handler() won't return a funct

Re: [PHP-DEV] Re: restore user opcode handler in PHP

2012-02-13 Thread Stas Malyshev
Hi! I thought Yoram sent some very simple test case yesterday. Yes, as Gwynne commented, this test case doesn't do what PHP does, since it compiles .so into the binary, and mod_php is not compiled into Apache's binary, and this changes the way it works. -- Stanislav Malyshev, Software Arch

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Xinchen Hui
On Tue, Feb 14, 2012 at 3:02 PM, Xinchen Hui wrote: > On Tue, Feb 14, 2012 at 3:00 PM, Dmitry Stogov wrote: >> In general exposing zend_vm_get_opcode_handler() can't help. >> You know that executor might be generated/compiled not only using >> call-treading but also using switch or goto. In these

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Stas Malyshev
Hi! but you really remind me, that I shoud also add a flag to detect what the vm-kind now... Adding ZEND_API in one place is no problem, but any messing with the engine is out of the question now. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext.

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Xinchen Hui
On Tue, Feb 14, 2012 at 3:10 PM, Stas Malyshev wrote: > Hi! > > >> but you really remind me, that I shoud also add a flag to detect what >> the vm-kind now... > > > Adding ZEND_API in one place is no problem, but any messing with the engine > is out of the question now. okey, let's just talk about

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Stas Malyshev
Hi! okey, let's just talk about adding ZEND_API. :) But as Dmitry noted, it's only present in one model, so how useful would it be? I don't want to add patches that are not beneficial for anything but a very narrow use case. Could you explain what are you trying to do? -- Stanislav Malyshev

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Xinchen Hui
On Tue, Feb 14, 2012 at 3:13 PM, Stas Malyshev wrote: > Hi! > > >> okey, let's just talk about adding ZEND_API. :) > > > But as Dmitry noted, it's only present in one model, so how useful would it > be? I don't want to add patches that are not beneficial for anything but a > very narrow use case.

Re: [PHP-DEV] how to debug a php script ( the C code beneath it)

2012-02-13 Thread Adi Mutu
Perhaps i didn't explain correctly, my bad, sorry. Basically what I want to see is the corresponding C code which is executed, i could put a break in gdb, but how do I know at which C function to put it, if i don't know the internals of php very good? From: Áng

Re: [PHP-DEV] Re: Please expose zend_vm_get_opcde_handler

2012-02-13 Thread Xinchen Hui
Hi: after got some advise of dmitry on IRC, I decide to drawback this proposal. and try to find a much better patch later. thanks very much, and sorry for noise. thanks On Tue, Feb 14, 2012 at 3:17 PM, Xinchen Hui wrote: > On Tue, Feb 14, 2012 at 3:13 PM, Stas Malyshev wrote: >> Hi! >