Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Re: Lack of read permission on main script leads to E_WARNING [RSS Feed]

#1 Nov. 16, 2005 20:01:53

Ryan D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Lack of read permission on main script leads to E_WARNING


I sent this message last week and haven't received a single reply. Iwas hoping for someone to either agree that it was a bug and adviseif/when a patch would be included in PHP or explain why they believethat this is the "correct" behavior for PHP.Thanks in advance,

Ryan Dingman

Next Online Mortgage Technologies

On Nov 9, 2005, at 11:09 AM, Ryan Dingman wrote:I believe that I've found a bug in the way that PHP handlespermission problems when accessing the main script.If I accesshttp://localhost/foo.phpand PHP does not havepermission to read foo.php, I get an E_WARNING rather than anE_COMPILE_ERROR (include vs. require). This is in PHP 5.1 RC4.I've fixed this in a local build by patching zend_execute_scriptsin Zend/zend.c on line 1079. zend_execute_scripts was callingzend_compile_file and passing ZEND_INCLUDE in as the type argumentrather than passing along its type argument. The old code reads:EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDETSRMLS_CC);My patched version reads:

EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC);Because I'm not intimately familiar with the inner workings of theinterpreter, I'm not sure that this is the best way to fix thisproblem, but it seems like the most appropriate place that I couldfind.In case you are wondering why I care -- we have a PHP module thatmonitors PHP errors and redirects our customers to a customerservice page any time that PHP encounters anything that theinterpreter really shouldn't recover from (E_CORE_ERROR, E_ERROR,E_PARSE, E_COMPILE_ERROR and E_USER_ERROR). The main script notbeing readable is certainly a case where we would like to redirectthem to a customer service page. However, having an E_WARNING asthe error makes it difficult to identify this situation because wewould now have to distinguish between this E_WARNING and any othersthat might arise in the site. Having an E_COMPILE_ERROR would bemuch more definitive and more correct IMHO. Yes, we are takingother steps to ensure that the permission on the PHP scripts forour site are correct, but mistakes do happen and we want toguarantee that our customers have as good an experience as possiblein the case of unexpected errors (as any enterprise site should).Thoughts?

Thanks,

Ryan Dingman

Next Online Mortgage Technologies--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#2 Nov. 16, 2005 20:18:15

David Z.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Lack of read permission on main script leads to E_WARNING


I don't have an answer to your main question, but I guess you could just as
well usehttp://www.php.net/manual/en/function.set-error-handler.phpcouldn't you?

- David


> -----Original Message-----
> From: Ryan Dingman
> Sent: Wednesday, November 16, 2005 9:02 PM
> To: intern***@*ists.php.net
> Subject: Re: Lack of read permission on main script leads to
> E_WARNING
>
>
> I sent this message last week and haven't received a single reply. I
> was hoping for someone to either agree that it was a bug and advise
> if/when a patch would be included in PHP or explain why they believe
> that this is the "correct" behavior for PHP.
>
> Thanks in advance,
>
> Ryan Dingman
>
> Next Online Mortgage Technologies
>
> On Nov 9, 2005, at 11:09 AM, Ryan Dingman wrote:
>
> >
> > I believe that I've found a bug in the way that PHP handles
> > permission problems when accessing the main script.
> >
> > If I accesshttp://localhost/foo.phpand PHP does not have
> > permission to read foo.php, I get an E_WARNING rather than an
> > E_COMPILE_ERROR (include vs. require). This is in PHP 5.1 RC4.
> > I've fixed this in a local build by patching zend_execute_scripts
> > in Zend/zend.c on line 1079. zend_execute_scripts was calling
> > zend_compile_file and passing ZEND_INCLUDE in as the type argument
> > rather than passing along its type argument. The old code reads:
> >
> > EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE
> > TSRMLS_CC);
> >
> > My patched version reads:
> >
> > EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC);
> >
> > Because I'm not intimately familiar with the inner workings of the
> > interpreter, I'm not sure that this is the best way to fix this
> > problem, but it seems like the most appropriate place that I could
> > find.
> >
> > In case you are wondering why I care -- we have a PHP module that
> > monitors PHP errors and redirects our customers to a customer
> > service page any time that PHP encounters anything that the
> > interpreter really shouldn't recover from (E_CORE_ERROR, E_ERROR,
> > E_PARSE, E_COMPILE_ERROR and E_USER_ERROR). The main script not
> > being readable is certainly a case where we would like to redirect
> > them to a customer service page. However, having an E_WARNING as
> > the error makes it difficult to identify this situation because we
> > would now have to distinguish between this E_WARNING and any others
> > that might arise in the site. Having an E_COMPILE_ERROR would be
> > much more definitive and more correct IMHO. Yes, we are taking
> > other steps to ensure that the permission on the PHP scripts for
> > our site are correct, but mistakes do happen and we want to
> > guarantee that our customers have as good an experience as possible
> > in the case of unexpected errors (as any enterprise site should).
> >
> > Thoughts?
> >
> > Thanks,
> >
> > Ryan Dingman
> >
> > Next Online Mortgage Technologies
> >
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

#3 Nov. 16, 2005 21:01:39

David Z.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: Lack of read permission on main script leads to E_WARNING


Eek. Just ignore me. Please. Didn't read the message properly :)


--
David Zülke

Tel: +49 (0)89 21 58 27 53
Fax: +49 (0)89 21 58 27 55

bitXtender GbR
Scherbaumstr. 19
81737 München

> -----Original Message-----
> From: David Zülke
> Sent: Wednesday, November 16, 2005 9:17 PM
> To: 'Ryan Dingman'
> Cc: intern***@*ists.php.net
> Subject: RE: Re: Lack of read permission on main script leads to
> E_WARNING
>
> I don't have an answer to your main question, but I guess you could just
> as
> well usehttp://www.php.net/manual/en/function.set-error-handler.php> couldn't you?
>
> - David
>
>
> > -----Original Message-----
> > From: Ryan Dingman
> > Sent: Wednesday, November 16, 2005 9:02 PM
> > To: intern***@*ists.php.net
> > Subject: Re: Lack of read permission on main script leads to
> > E_WARNING
> >
> >
> > I sent this message last week and haven't received a single reply. I
> > was hoping for someone to either agree that it was a bug and advise
> > if/when a patch would be included in PHP or explain why they believe
> > that this is the "correct" behavior for PHP.
> >
> > Thanks in advance,
> >
> > Ryan Dingman
> >
> > Next Online Mortgage Technologies
> >
> > On Nov 9, 2005, at 11:09 AM, Ryan Dingman wrote:
> >
> > >
> > > I believe that I've found a bug in the way that PHP handles
> > > permission problems when accessing the main script.
> > >
> > > If I accesshttp://localhost/foo.phpand PHP does not have
> > > permission to read foo.php, I get an E_WARNING rather than an
> > > E_COMPILE_ERROR (include vs. require). This is in PHP 5.1 RC4.
> > > I've fixed this in a local build by patching zend_execute_scripts
> > > in Zend/zend.c on line 1079. zend_execute_scripts was calling
> > > zend_compile_file and passing ZEND_INCLUDE in as the type argument
> > > rather than passing along its type argument. The old code reads:
> > >
> > > EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE
> > > TSRMLS_CC);
> > >
> > > My patched version reads:
> > >
> > > EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC);
> > >
> > > Because I'm not intimately familiar with the inner workings of the
> > > interpreter, I'm not sure that this is the best way to fix this
> > > problem, but it seems like the most appropriate place that I could
> > > find.
> > >
> > > In case you are wondering why I care -- we have a PHP module that
> > > monitors PHP errors and redirects our customers to a customer
> > > service page any time that PHP encounters anything that the
> > > interpreter really shouldn't recover from (E_CORE_ERROR, E_ERROR,
> > > E_PARSE, E_COMPILE_ERROR and E_USER_ERROR). The main script not
> > > being readable is certainly a case where we would like to redirect
> > > them to a customer service page. However, having an E_WARNING as
> > > the error makes it difficult to identify this situation because we
> > > would now have to distinguish between this E_WARNING and any others
> > > that might arise in the site. Having an E_COMPILE_ERROR would be
> > > much more definitive and more correct IMHO. Yes, we are taking
> > > other steps to ensure that the permission on the PHP scripts for
> > > our site are correct, but mistakes do happen and we want to
> > > guarantee that our customers have as good an experience as possible
> > > in the case of unexpected errors (as any enterprise site should).
> > >
> > > Thoughts?
> > >
> > > Thanks,
> > >
> > > Ryan Dingman
> > >
> > > Next Online Mortgage Technologies
> > >
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit:http://www.php.net/unsub.php> >
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit:http://www.php.net/unsub.php>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Re: Lack of read permission on main script leads to E_WARNING [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support