Page 1 of 1

PHP Array issue after upgrade

Posted: Tue Oct 24, 2006 12:45 pm
by esfisher
Hi,

We recently experienced a server crash. We had our hosting company reinstall our entire system and they installed PHP 5.0.4. We previously were using PHP 5.0.3.

99.9% of everything worked fine after the reinstall (we are also using Ensim, which is why they used that version of PHP). However, we are having a problem with our arrays.

Here is a quick example of code, followed by a description of the problem:

Code: Select all

// sql query

$counter = 0;
while($row = mysql_fetch_array($queryResult))
{
   $program_id[$counter]       = $row['program_id'];
   $program_name[$counter] = $row['program_name'];
   $program_fee[$counter]     = $row['program_fee'];
   $counter++;
}

// program ids should be 57,58,59,60


The values in the arrays look something like this (comma seperates each value):
$program_id: 5556
$program_name: program1,program2,program3,program4
$program_fee:10.00,15.00,10.00,10.00

Notice that the program id is not an array, but just a number made up of the first digits of each value.

Does anyone know why this is happening? It works fine on our test server, which has almost no configuration options. Here is a list of the configuration options used:

Also, if I add $program_id = array() before the loop, it works fine. However, we have many instances of this sort of loop, so it would take quite some time to fix all the issues. I'm looking for something in the config file that is causing it so I can change it.
phpinfo() wrote: Live Server
'./configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba'

Test Server
cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"

Posted: Tue Oct 24, 2006 12:51 pm
by jmut
really interesting issue.
Do you get any notices or anything on your code?

Something weird is going on.
You say migration 5.0.3 to 5.0.4? - maybe you should examine the php changelog. might help.
have you changed mysql versiont too?

Are you not able to compare php.ini on old and new server.

Posted: Tue Oct 24, 2006 1:39 pm
by RobertGonzalez
Instead of assigning them to an array, can you echo them out to see what is thrown to the screen? It seems weird, but could it have something to do with the fact the values are integers?