ID: 10395
User Update by: [EMAIL PROTECTED]
Status: Closed
Bug Type: *General Issues
Description: $array[] with no subscript will not return any data

I have tried it on both 4.0.4pl1 and 4.0.3pl1, on 4.0.5devel
from halfway february, and 4.0.5devel from today's cvs; on 3
different machines, all with all error reporting turned on.
If I change the test script to have a non-existing string as
index(echo "this is a test: " . $pr['test'];), I get:

Test.
Warning: Undefined variable: pr in /home/roel/test/test2.php
on line 5
this is a test:

which would not appear if I would have error-reporting
turned off. And even if I would have error_reporting turned
off, php should display the rest of the page(the Test.) in
this case), no?  

The relevant part from my php.ini:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; error_reporting is a bit-field.  Add each number up to get
desired error reporting level
;  1 = Normal errors
;  2 = Normal warnings
;  4 = Parser errors
;  8 = Notices - warnings you can ignore, but sometimes
imply a bug (e.g., using an uninitialized variable)
error_reporting =   15
display_errors  =   On ; Print out errors (as a part of the
HTML script)
log_errors  =   On  ; Log errors into a log file
(server-specific log, stderr, or error_log (below))
track_errors    =   Off ; Store the last error/warning
message in $php_errormsg (boolean)
error_prepend_string = "<font color=ff0000>"   ; string to
output before an error message
error_append_string = "</font>"                ; string to
output after an error message
error_log   =   /tmp/php-errors ; log errors to specified file
; error_log =   syslog      ; log errors to syslog (Event
Log on NT, not valid in Windows 95)
warn_plus_overloading   =   Off     ; warn if the + operator
is used with strings


Previous Comments:
---------------------------------------------------------------------------

[2001-04-19 06:51:45] [EMAIL PROTECTED]
i get
Fatal error:  Cannot use [] for reading ...

you should check your error_reporting settings


---------------------------------------------------------------------------

[2001-04-19 06:21:12] [EMAIL PROTECTED]
If you try to use an array without a subscript, no data will
be send back to the browser. Netscape will say 'document
contained no data'; Galeon will display an empty page. The
following script illustrates:

*********8<************
Test.

<?php

echo "this is a test: " . $pr[];

?>
*********8<************

This should imo return at least the first line, then 'this
is a test', and then a warning that $pr[] is invalid.

Configure line (although I think it's not relevant):
'./configure' '--enable-track-vars' '--with-mysql'
'--enable-trans-sid'
'--with-apxs=/usr/local/apache/bin/apxs'
'--with-config-file-path=/etc' '--with-mcrypt' '--enable-shmop'

My php.ini is a bit long to paste here, mail me if needed.

---------------------------------------------------------------------------


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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to