php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5911 ANSI C violation: lvalues are not assignable
Submitted: 2000-08-01 23:20 UTC Modified: 2000-08-04 20:51 UTC
From: emschwar at rmi dot net Assigned: rubys (profile)
Status: Closed Package: Compile Failure
PHP Version: 4.0.1 OS: Solaris 2.7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: emschwar at rmi dot net
New email:
PHP Version: OS:

 

 [2000-08-01 23:20 UTC] emschwar at rmi dot net
In java.c, in the latest PHP 4.01pl2 source, there are several lines of the form:

(pval*)(long)result = object;

One example is on line 349.

This is a violation of the ANSI C standard, which explicitly
states, in section A7.5 (Casts),

"An expression with a cast is not an lvalue."

This fails on Solaris 2.7, and my brother has reported seeing it on AIX as well (though I don't know the version).

The fix is simple: cast object, not result:

result = (jlong)object;

This bug is on lines 349, 370 and 406.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-04 02:30 UTC] rubys@php.net
I've verified that the suggested fix works on Windows, once I verify that it works on Linux, I'll commit it.
 [2000-08-04 20:51 UTC] rubys@php.net
Fixed - Thanks!

Note: in order to compile without warning on gcc, I had to change the code to do the following:

  result = (jlong)(long)object;

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jul 07 03:00:02 2026 UTC