|
From: <php...@li...> - 2009-08-18 06:56:25
|
Hi Massimo,
You are right, when calling fopen("php://input", "r") PHP version 5 may
crash or hang. Please do not use it until this PHP5 bug is fixed.
I have looked at php 5.2.5. In php_fopen_wrapper.c line 81 it reads the
raw_post_data and then increments the SG(read_post_bytes) even though it
hasn't read anything. The result is that SG(read_post_bytes) is twice the
CONTENT_LENGTH size, causing all sorts of strage side effects later on.
In your particular case it calls SAPI.c sapi_read_post_data() which reads
the input up to CONTENT_LENGTH bytes. Then you call php_fopen_wrapper.c
php_stream_input_read() which reads nothing but increments
SG(read_post_bytes) again. And finally sapi_cgi_read_post() is called from
sapi_deactivate() to consume any remaining input. The remaining input is
calculated as (unsigned)(CONTENT_LENGTH-SG(read_post_bytes)) which is
4294967296-CONTENT_LENGTH due to an overflow.
If you post that much data, it will work, I guess... :)
Do you report this bug to the PHP maintainers?
Regards,
Jost Boekemeier
17. Aug 2009 4:44 nachm. schrieb am <
php...@li...>:
Hi Jost,
thank you for the reply.
> Is it a standalone web- or desktop application?
It is a standalone desktop application, but several tasks will also
interface a remote Web server, if/when a network connection is
available.
> Why do you need jetty for a desktop application?
I found it helps a lot to give structure and order to the
application(s). It takes care of potential CLASSPATH issues, it's easy
to setup and start/stop, and has a small footprint. Last but not least,
it keeps a door open for more advanced functionality I may need in the
future - this is just the first of (hopefully) several applications.
> If you want to use PHP as a plugin only, use the JSR 223 API.
I am currently trying to connect the Swing application with Jetty-hosted
PHP scripts via JSON-RPC, since the (RAW POST based) protocol is quite
efficient and easy to implement, both in PHP and in Java.
Sadly though, while I can readily access the RAW POST data via
php://input and can also write the JSON string received from Java to a
file, I see the fastcgi is unable to output the response ... looks like
the communication channel is corrupted somehow as soon as I fopen it for
reading.
On the grounds that I may be violating the standard way of interacting
with a servlet, I've been struggling the past few days to solve the
problem by using java_context() methods and properties, but without
success so far ... I'd appreciate some advice.
Massimo
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|
|
From: <php...@li...> - 2009-08-18 10:46:06
|
Hi Jost,
> You are right, when calling fopen("php://input", "r") PHP
> version 5 may crash or hang. Please do not use it until this
> PHP5 bug is fixed.
> ...
> Do you report this bug to the PHP maintainers?
Using PHP 5.2.9 here, but function php_stream_input_read() in
php_fopen_wrapper.c is identical to the 5.2.5 one.
Before opening a bug (been there, done that) I should carefully check
what you say, but I cannot do so right now - leaving for vacation
tomorrow next and lots of loose ends to fix here at work.
Anyway I modified the Swing application to redirect the JSON-RPC call to
a "standard" Apache + mod_php 5.2.9 configuration (no Jetty no Java) and
php://input works perfectly - as well it should, since we are using that
machine as a SOAP services endpoint, consuming RAW POST data all the
time.
Will need to double check the C dode ...
Bye,
Massimo
|
|
From: <php...@li...> - 2009-08-18 12:04:49
|
=> http://bugs.php.net/bug.php?id=49286 |
|
From: <php...@li...> - 2009-08-18 10:53:55
|
Hi Jost,
> You are right, when calling fopen("php://input", "r") PHP version 5
> may crash or hang. Please do not use it until this
> PHP5 bug is fixed.
> ...
> Do you report this bug to the PHP maintainers?
Using PHP 5.2.9 here, but function php_stream_input_read() in
php_fopen_wrapper.c is identical to the 5.2.5 one.
Before opening a bug (been there, done that) I should carefully check
what you say, but I cannot do so right now - leaving for vacation
tomorrow next and lots of loose ends to fix here at work.
Anyway I modified the Swing application to redirect the JSON-RPC call to
a "standard" Apache + mod_php 5.2.9 configuration (no Jetty no Java) and
php://input works perfectly - as well it should, since we are using that
machine as a SOAP services endpoint, consuming RAW POST data all the
time.
Will need to double check the C code ...
Bye,
Massimo
|
|
From: <php...@li...> - 2009-08-18 13:49:31
|
> a "standard" Apache + mod_php 5.2.9 configuration
Great. Apache/IIS/PHP front- and Java back end is the normal configuration.
Regards,
Jost Boekemeier
18. Aug 2009 12:46 nachm. schrieb am <
php...@li...>:
Hi Jost,
> You are right, when calling fopen("php://input", "r") PHP
> version 5 may crash or hang. Please do not use it until this
> PHP5 bug is fixed.
> ...
> Do you report this bug to the PHP maintainers?
Using PHP 5.2.9 here, but function php_stream_input_read() in
php_fopen_wrapper.c is identical to the 5.2.5 one.
Before opening a bug (been there, done that) I should carefully check
what you say, but I cannot do so right now - leaving for vacation
tomorrow next and lots of loose ends to fix here at work.
Anyway I modified the Swing application to redirect the JSON-RPC call to
a "standard" Apache + mod_php 5.2.9 configuration (no Jetty no Java) and
php://input works perfectly - as well it should, since we are using that
machine as a SOAP services endpoint, consuming RAW POST data all the
time.
Will need to double check the C dode ...
Bye,
Massimo
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|
|
From: <php...@li...> - 2009-08-20 13:00:14
|
FYI: The bug you've reported has been fixed in CVS: http://svn.php.net/viewvc/php/php-src/branches/PHP_5_2/ext/standard/php_fopen_wrapper.c?view=markup&pathrev=287507 Please report php bugs directly to the php maintainers next time. 18. Aug 2009 2:22 nachm. schrieb am "Jost Bekemeier" < jos...@go...>: > a "standard" Apache + mod_php 5.2.9 configuration Great. Apache/IIS/PHP front- and Java back end is the normal configuration. Regards, Jost Boekemeier 18. Aug 2009 12:46 nachm. schrieb am < php...@li...>: > > Hi Jost, > > > You are right, when calling fopen("php://input", "r") PHP > > version 5 may cras... |