By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,199 Members | 1,551 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,199 IT Pros & Developers. It's quick & easy.

A possible bug in php .3.10 ?

P: n/a
All,

The following script works as intended in MS-Windows and in other Linux
boxes, except on the one that runs php 4.3.10.
Sorry for the long post.

1) # uname -a
Linux bubba 2.4.20 #5 SMP Thu Apr 3 12:26:19 BST 2003 i686 i686 i386
GNU/Linux

2) #php -v
PHP 4.3.10 (cgi) (built: Mar 15 2005 14:36:32)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

3) Here is the script :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test form posting arrays - dynamic indexes</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
</head>
<body>

<form name="test" method="post" action="/status/test.php">
<input type="text" name="test_text[]"><br />
<input type="text" name="test_text[]"><br />
<input type="submit" name="submit" value="Submit">

</form>
</body>
</html>

4) What this script is supposed to do - Show two fields on a web
browser.
But only on this specific server, it shows two fields, and if I input
data it shows me an extra data field !!. As you can see below, I used
the "View Page source" :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Test form posting arrays - dynamic indexes</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
</head>
<body>
Array
(
[test_text] => Array
(
[0] => test
[1] => this
[2] => this <-- This is the error. Why is a third
array
showing up?
)

[submit] => Submit
)

<form name="test" method="post" action="/status/test.php">
<input type="text" name="test_text[]"><br />
<input type="text" name="test_text[]"><br />
<input type="submit" name="submit" value="Submit">

</form>
</body>
</html>

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 29 Mar 2005 12:04:51 -0800, na*****@gmail.com wrote:
The following script works as intended in MS-Windows and in other Linux
boxes, except on the one that runs php 4.3.10.
Sorry for the long post.

3) Here is the script : [snip]
4) What this script is supposed to do - Show two fields on a web
browser.
But only on this specific server, it shows two fields, and if I input
data it shows me an extra data field !!. As you can see below, I used
the "View Page source" :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Test form posting arrays - dynamic indexes</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
</head>
<body>
Array
(
[test_text] => Array
(
[0] => test
[1] => this
[2] => this <-- This is the error. Why is a third
array
showing up?


You haven't posted the code that produces this output. The code you posted
does not have any print statements, or anything that produces output.

Or if you have, it's doubly bizarre as it would have to have magically
inserted a "print_r" statement.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2

P: n/a
Thanks Andy for helping out - Here is the script.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title>Test form posting arrays - dynamic indexes</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"
/>
</head>
<body>
<?php
if (isset($_POST['submit'])) {
print_r ($_POST);
}
?>

<form name="test" method="post" action="/status/test.php">
<input type="text" name="test_text[]"><br />
<input type="text" name="test_text[]"><br />
<input type="submit" name="submit" value="Submit">

</form>
</body>
Andy Hassall wrote:
On 29 Mar 2005 12:04:51 -0800, na*****@gmail.com wrote:
The following script works as intended in MS-Windows and in other Linuxboxes, except on the one that runs php 4.3.10.
Sorry for the long post.

3) Here is the script : [snip]

4) What this script is supposed to do - Show two fields on a web
browser.
But only on this specific server, it shows two fields, and if I inputdata it shows me an extra data field !!. As you can see below, I usedthe "View Page source" :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Test form posting arrays - dynamic indexes</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
</head>
<body>
Array
(
[test_text] => Array
(
[0] => test
[1] => this
[2] => this <-- This is the error. Why is a thirdarray
showing up?


You haven't posted the code that produces this output. The code you

posted does not have any print statements, or anything that produces output.

Or if you have, it's doubly bizarre as it would have to have magically inserted a "print_r" statement.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis

tool

Jul 17 '05 #3

P: n/a
On 29 Mar 2005 15:30:33 -0800, na*****@gmail.com wrote:
Thanks Andy for helping out - Here is the script.

[snip]

Works as expected for me on 4.3.10. More details about your PHP setup?

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #4

P: n/a
Here is more info - Thanks again.

I built the php as rpm from the sources - Here is the list of rpms
[root@bubba root]# rpm -qa | grep -i php
<== php rpms
php-4.3.10-2.sp
php-ldap-4.3.10-2.sp
php-pgsql-4.3.10-2.sp
php-pear-4.3.10-2.sp
php-devel-4.3.10-2.sp
php-imap-4.3.10-2.sp
php-mbstring-4.3.10-2.sp
php-odbc-4.3.10-2.sp
php-xmlrpc-4.3.10-2.sp
php-debuginfo-4.3.10-2.sp
php-domxml-4.3.10-2.sp
php-mysql-4.3.10-2.sp

#php -v
<== Version of php
PHP 4.3.10 (cgi) (built: Mar 15 2005 14:36:32)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

#php -m
<== List of modules in php.
bcmath
bz2
calendar
ctype
curl
dba
dbx
dio
domxml
exif
ftp
gd
gettext
gmp
iconv
imap
ldap
mbstring
mysql
ncurses
odbc
openssl
overload
pcre
pgsql
posix
pspell
session
shmop
sockets
standard
sysvsem
sysvshm
tokenizer
wddx
xml
xmlrpc
yp
zlib

Apache version
[root@bubba root]# httpd -v <== apache Version
Server version: Apache/2.0.40
Server built: Feb 25 2003 05:01:56

Php references in httpd.conf <== how php is
called from apache
[root@bubba root]# grep php /etc/httpd/conf/httpd.conf
#AddModule mod_php.c
#AddModule mod_php3.c
#LoadModule php_module modules/mod_php.so
#LoadModule php3_module modules/libphp3.so
LoadModule php4_module modules/libphp4.so
DirectoryIndex index.php index.html index.html.var
#AddType application/x-httpd-php3 .php3 # for PHP 3
AddType application/x-httpd-php .php
<Files *.php>

Php ini file. <== php ini
file. Removed comments and DB

related

[PHP]

engine = On
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = Off
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = Off

safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH

disable_functions =
disable_classes =
expose_php = On

max_execution_time = 30 ; Maximum execution time of each script, in
seconds
max_input_time = 60 ; Maximum amount of time each script may spend
parsing request data
memory_limit = 8M ; Maximum amount of memory a script may consume
(8MB)

error_reporting = E_ALL & ~E_NOTICE
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
error_log = /etc/php.err

variables_order = "EGPCS"
register_globals = Off

register_argc_argv = On
post_max_size = 8M
gpc_order = "GPC"

magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off

auto_prepend_file =
auto_append_file =

default_mimetype = "text/html"

include_path =
".:/php/includes:/var/www/smarty/libs:/var/www//qaweb/lib"

doc_root =

user_dir =

extension_dir = /usr/lib/php4

enable_dl = On

file_uploads = On
upload_max_filesize = 2M
allow_url_fopen = On

default_socket_timeout = 60

extension=domxml.so
extension=odbc.so
extension=xmlrpc.so

[Syslog]
define_syslog_variables = Off

[mail function]
SMTP = localhost
sendmail_path = /usr/sbin/sendmail -t -i

[SQL]
sql.safe_mode = Off
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =

mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

[dbx]
dbx.colnames_case = "lowercase"

[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files
session.save_path = /var/lib/php/session
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0

session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =

session.serialize_handler = php

session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440

session.bug_compat_42 = 0
session.bug_compat_warn = 1

session.referer_check =
session.entropy_length = 0
session.entropy_file =

session.cache_limiter = nocache
session.cache_expire = 180

session.use_trans_sid = 0

url_rewriter.tags =
"a=href,area=href,frame=src,input=src,form=fakeent ry"
[Sockets]
sockets.use_system_read = On

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.