#382 closed Bugs (Fixed)
Error with switch when last case block omits break or return
| Reported by: | rbarreca | Owned by: | nobody |
|---|---|---|---|
| Priority: | 5 | Milestone: | |
| Component: | PHP Parser | Version: | None |
| Keywords: | Cc: |
Description
Code like this gives an error and screws up the parsing
on the rest of the page. Says Parser error "Error in
expression (found token '}')." Then the rest of the
page has parse errors. Using ver 1.1.8.CVS-20051108.
switch ($replace) {
case FILE_EXISTS_RENAME:
// Destination file already exists and we
can't replace is so we try and
// and find a new filename.
if ($pos = strrpos($basename, '.')) {
$name = substr($basename, 0, $pos);
$ext = substr($basename, $pos);
}
else {
$name = $basename;
}
$counter = 0;
do {
$dest = $directory .'/'. $name .'_'.
$counter++ . $ext;
} while (file_exists($dest));
break;
case FILE_EXISTS_ERROR:
drupal_set_message(t('File copy failed. File
already exists.'), 'error');
return 0;
case FILE_EXISTS_REPLACE:
// Leave $dest where it is for replace.
}
Change History (4)
comment:1 Changed 8 years ago by bananeweizen
comment:2 Changed 8 years ago by axelcl
Logged In: YES user_id=1143825 Fixed with CVS-20051219 The "default:" branch is currently handled the same way. Please close if Ok.
comment:3 Changed 7 years ago by bananeweizen
Logged In: YES user_id=440739 Works fine for me with current CVS. Set to pending.
comment:4 Changed 7 years ago by sf-robot
- Status changed from assigned to closed
Logged In: YES user_id=1312539 This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/eclipsebutton_med.png)