php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29757 Sybase compile error
Submitted: 2004-08-19 15:02 UTC Modified: 2005-03-07 20:27 UTC
Votes:21
Avg. Score:4.7 ± 0.6
Reproduced:21 of 21 (100.0%)
Same Version:5 (23.8%)
Same OS:4 (19.0%)
From: pm at wallit dot net Assigned:
Status: Closed Package: Sybase (dblib) related
PHP Version: 5.0.1 OS: Sun Solaris 8
Private report: No CVE-ID: None
 [2004-08-19 15:02 UTC] pm at wallit dot net
Description:
------------
./configure --enable-simplexml --with-sybase=/usr/local/freetds/ --with-mysql --with-apxs=/usr/local/wac/bin/apxs

followed by a "make" results in compile error for Sybase and FreeTDS support:

/bin/sh /home/php-5.0.1/libtool --silent --preserve-dup-deps --mode=compile gcc  -Iext/sybase/ -I/home/php-5.0.1/ext/sybase/ -DPHP_ATOM_INC -I/home/php-5.0.1/include -I/home/php-5.0.1/main -I/home/php-5.0.1 -I/home/php-5.0.1/Zend -I/usr/local/include/libxml2 -I/usr/local/include/mysql -I/usr/local/freetds//include  -D_POSIX_PTHREAD_SEMANTICS -I/home/php-5.0.1/TSRM  -g -O2  -prefer-pic -c /home/php-5.0.1/ext/sybase/php_sybase_db.c -o ext/sybase/php_sybase_db.lo
/home/php-5.0.1/ext/sybase/php_sybase_db.c: In function `zif_sybase_fetch_object':
/home/php-5.0.1/ext/sybase/php_sybase_db.c:1112: invalid lvalue in assignment
/home/php-5.0.1/ext/sybase/php_sybase_db.c:1113: invalid lvalue in assignment
make: *** [ext/sybase/php_sybase_db.lo] Error 1



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-04 16:36 UTC] jpollock at ncbi dot nlm dot nih dot gov
jpollock@graceland:/opt/local/src/php-5.0.3$ make
gcc  -Iext/sybase/ -I/opt/local/src/php-5.0.3/ext/sybase/ -DPHP_ATOM_INC -I/opt/local/src/php-5.0.3/include -I/opt/local/src/php-5.0.3/main -I/opt/local/src/php-5.0.3 -I/opt/local/src/php-5.0.3/Zend -I/usr/local/gnome2/include/libxml2 -I/netopt/Sybase/clients/current/include  -I/opt/local/src/php-5.0.3/TSRM  -g -O2  -c /opt/local/src/php-5.0.3/ext/sybase/php_sybase_db.c -o ext/sybase/php_sybase_db.o  && echo > ext/sybase/php_sybase_db.lo
/opt/local/src/php-5.0.3/ext/sybase/php_sybase_db.c: In function `zif_sybase_fetch_object':
/opt/local/src/php-5.0.3/ext/sybase/php_sybase_db.c:1112: error: invalid lvalue in assignment
/opt/local/src/php-5.0.3/ext/sybase/php_sybase_db.c:1113: error: invalid lvalue in assignment
make: *** [ext/sybase/php_sybase_db.lo] Error 1
jpollock@graceland:/opt/local/src/php-5.0.3$

A traceback of the nested macros:

jpollock@graceland:/opt/local/src/php-5.0.3$ grep -ri Z_OBJPROP_P . | grep define
./ext/soap/soap.c:#define FIND_SDL_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "sdl", sizeof("sdl"), (void **)&tmp)
./Zend/zend_operators.h:#define Z_OBJPROP_P(zval_p)             Z_OBJPROP(*zval_p)
./Zend/zend_operators.h:#define Z_OBJPROP_PP(zval_pp)   Z_OBJPROP(**zval_pp)
jpollock@graceland:/opt/local/src/php-5.0.3$ grep -ri Z_OBJPROP\( . | grep define
./Zend/zend_operators.h:#define Z_OBJPROP(zval)                 Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
./Zend/zend_operators.h:#define Z_OBJPROP_P(zval_p)             Z_OBJPROP(*zval_p)
./Zend/zend_operators.h:#define Z_OBJPROP_PP(zval_pp)   Z_OBJPROP(**zval_pp)
jpollock@graceland:/opt/local/src/php-5.0.3$ grep -ri Z_OBJ_HT\( . | grep define
./Zend/zend_operators.h:#define Z_OBJ_HT(zval)                  (zval).value.obj.handlers
./Zend/zend_operators.h:#define Z_OBJPROP(zval)                 Z_OBJ_HT((zval))->get_properties(&(zval) TSRMLS_CC)
./Zend/zend_operators.h:#define Z_OBJ_HANDLER(zval, hf) Z_OBJ_HT((zval))->hf
./Zend/zend_operators.h:#define Z_OBJ_HT_P(zval_p)      Z_OBJ_HT(*zval_p)
./Zend/zend_operators.h:#define Z_OBJ_HT_PP(zval_p)     Z_OBJ_HT(**zval_p)
./Zend/zend_object_handlers.h:#define IS_ZEND_STD_OBJECT(z)  ((z).type == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL))
./Zend/zend_object_handlers.h:#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL)
jpollock@graceland:/opt/local/src/php-5.0.3$
 [2005-02-22 17:34 UTC] drbob at TheManFromSPUD dot com
This alswo occurs with PHP 5.0.3 on Fedora Core 3 with Sybase 11.1.1 and 12.5.
 [2005-02-22 23:31 UTC] drbob at TheManFromSPUD dot com
SOLUTION!

In ext/sybase/php_sybase_db.c around line 1112 change the lines:

PHP_FUNCTION(sybase_fetch_object)
{
  php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
  if (Z_TYPE_P(return_value)==IS_ARRAY) {
    Z_TYPE_P(return_value)=IS_OBJECT;
    Z_OBJPROP_P(return_value) = Z_ARRVAL_P(return_value);
    Z_OBJCE_P(return_value) = ZEND_STANDARD_CLASS_DEF_PTR;
  }
}

to:

PHP_FUNCTION(sybase_fetch_object)
{
  php_sybase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
  if (Z_TYPE_P(return_value)==IS_ARRAY) {
    object_and_properties_init(
      return_value,
      ZEND_STANDARD_CLASS_DEF_PTR,
      Z_ARRVAL_P(return_value)
    );
  }
}

I've tested this on Fedora Core 3 and Solaris 8. Both with gcc 3.4.2. Works great.
 [2005-03-07 20:27 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 19 10:01:28 2020 UTC