[PHP-DEV] PHP 4.0 Bug #3973 Updated: Java support Makefiles are incorrect in Solaris From: Bug Database (php-dev <email protected>)
Date: 03/30/00

ID: 3973
User Update by: jesusmc <email protected>
Status: Open
Bug Type: Compile Failure
Description: Java support Makefiles are incorrect in Solaris

That is good info:

Re: 1) I will download the JSDK 2.2 later and try a clean compile,
and will see how it fares. That JSDK supports "setHeader" still,
so you could just use that or a kludge like the one below, it compiles
but I have not tested it so I can't tell if it does the right thing:
(it uses the introspection classes)

% diff -c php-4.0RC1/sapi/servlet/servlet.java orig-php-4.0RC1/sapi/servlet/servlet.java

*** php-4.0RC1/sapi/servlet/servlet.java Thu Mar 30 17:02:04 2000
--- orig-php-4.0RC1/sapi/servlet/servlet.java Thu Mar 9 05:07:24 2000
***************
*** 23,30 ****
  import java.util.Enumeration;
  import javax.servlet.*;
  import javax.servlet.http.*;
- import java.lang.Class;
- import java.lang.reflect.Method;
  
  public class servlet extends HttpServlet {
  
--- 23,28 ----
***************
*** 88,112 ****
          } else {
            int colon = data.indexOf(": ");
            if (colon > 0) {
! /*
! * JSDK 2.0 uses setHeader instead but JDSK 2.2 uses addHeader,
! * although setHeader is still valid -- JMC
! */
! // kludge because in Java there's no #ifdef
! String params[] = {data.substring(0,colon), data.substring(colon+2)};
! try {
! Method methodHeader =
! this.getClass().getMethod("addHeader",null).getName().equals("") ?
! this.getClass().getMethod("setHeader",null) :
! this.getClass().getMethod("addHeader",null);
! methodHeader.invoke (this, params);
! } catch (Exception e) {
! System.err.println("Could not invoke header method");
! }
! } else {
! response.getWriter().println(data);
          }
- }
        } catch (IOException e) {
          System.err.print(data);
        }
--- 86,97 ----
          } else {
            int colon = data.indexOf(": ");
            if (colon > 0) {
! response.addHeader(data.substring(0,colon),
! data.substring(colon+2));
! } else {
! response.getWriter().println(data);
! }
          }
        } catch (IOException e) {
          System.err.print(data);
        }
***************
*** 142,154 ****
         send(request.getMethod(), request.getQueryString(),
              request.getPathInfo(), contextPath,
              request.getContentType(), request.getContentLength(),
! request.getRemoteUser(), display_source_mode);
  
         try {
           if (stream != null) stream.close();
         } catch (IOException e) {
! /* JSDK 2.0 - Exception is a string - JMC */
! throw new ServletException(e.toString());
         }
      }
  
--- 127,138 ----
         send(request.getMethod(), request.getQueryString(),
              request.getPathInfo(), contextPath,
              request.getContentType(), request.getContentLength(),
! request.getRemoteUser(), display_source_mode);
  
         try {
           if (stream != null) stream.close();
         } catch (IOException e) {
! throw new ServletException(e);
         }
      }

Re: 2) The "still giving trouble" comment referred to the problem
that the makefile was dying on the " <email protected>" lines (when creating
the net/php" subdir and later on the class compilation line and
the jar creation. Might be a cobined problem from the previous
messed up compilations.

Re: 3) I noticed that. So only the jar file in the sapi/servlet dir
is needed.

Question: Do I need to add the servlet support to gain the
java support? Can I just get java support alone?

Full Bug description available at: http://bugs.php.net/?id=3973

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>