Trying to enter either the Internal Preview or External Preview windows brings up this message:
Access violation at address 0077E626 in module 'devphp.exe'. Read of address 00000000.
Any idea what's going on? I tried to download the code to check it out in the debugger, but I couldn't get it to build. (I've got another thread about that.) All I know is, it's trying to dereference a nil pointer somewhere, in one of the most basic bits of functionality. What's up?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> Access violation from either the Internal or External Preview
> Any idea what's going on ?
I have to reproduce this bug, so
Could you give some more informations about versions please ?
(Windows, Dev-PHP, PHP engine)
Thank you for your report,
Pierre.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think I found the source of the bug. In frmMain.pas, beginning with line 4747, is the block of code that deals with the second preview tab. It starts off like this:
pEPreview: begin
e:=getEditor();
if not assigned(e) then exit;
s := e.fFileName;
command := VirtualExplorerTreeview1.RootFolderCustomPath;
delete(s,1,length(command));
if s[1]='\' then delete(s,1,1); //ACCESS VIOLATION HERE
It seems to be assuming implicitly that the file referenced in s is found in the folder referenced by command. If that's not the case, and if the folder's name is longer than length(s), then the delete command will return an empty string, and s[1] gives an access violation. (If the string isn't longer, but the file isn't in the same folder, undefined behavior is likely to result.)
I'm not sure what your intention is in this routine, so I can't fix it, but that incorrect assumption is the source of at least one bug.
Mason
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> I think I found the source of the bug.
First, this means that you can compile the project - Welcome.
Second, Of course you did find this bug.
There's a local root folder for the php project
say "x:/local/root/"
User opened a file, out of this root folder
say "a:/index.php"
An External preview has been defined
say "http://site.com/"
It is not possible to external preview "a:/index.php" because this file is not stored inside the local root folder nor it cannot be sent to a corresponding remote folder of the external site thru ftp / sftp
Rule : if a file is out of the local root folder, then internal preview, external preview and ftp tabsheets must be disabled.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
All right. Unfortunately, the program doesn't disable those tab sheets, nor does it check whether the folders are right, before running the tests. Nor does it have exception handling set up for these situations.
Allowing an end-user to see a dialog box that says something like "Access violation at address 0077E626 in module 'devphp.exe'. Read of address 00000000." is a bad idea in general. Most people aren't Delphi programmers or software testers, and will have no idea what that means, and they'll just write it off as "this program doesn't work" and try to find something else.
The source of the error in the Internal Preview tab is about 30 lines into TMainFrm.InternalRun(). The offending code is almost identical.
My proposed fix:
Replace the line
delete(s,1,length(command));
with the following block:
if ExtractFilePath(s) <> command then
begin
Application.MessageBox(PChar('Unable to preview files that are not found in the project root directory!'), PChar('Invalid directory') MB_OK);
Exit;
end
else s := ExtractFileName(s);
That ought to stop all access violations.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Running Windows XP Home, SP2. This bug occurs on freshly-downloaded copies of both versions of DevPhp 2 that are currently up for download on this site. PHP Engine is 5.2.6 Win32 version. Preferred browser is Firefox 2.0.0.15.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Trying to enter either the Internal Preview or External Preview windows brings up this message:
Access violation at address 0077E626 in module 'devphp.exe'. Read of address 00000000.
Any idea what's going on? I tried to download the code to check it out in the debugger, but I couldn't get it to build. (I've got another thread about that.) All I know is, it's trying to dereference a nil pointer somewhere, in one of the most basic bits of functionality. What's up?
Thanks for downloading Dev-PHP.
> Access violation from either the Internal or External Preview
> Any idea what's going on ?
I have to reproduce this bug, so
Could you give some more informations about versions please ?
(Windows, Dev-PHP, PHP engine)
Thank you for your report,
Pierre.
I think I found the source of the bug. In frmMain.pas, beginning with line 4747, is the block of code that deals with the second preview tab. It starts off like this:
pEPreview: begin
e:=getEditor();
if not assigned(e) then exit;
s := e.fFileName;
command := VirtualExplorerTreeview1.RootFolderCustomPath;
delete(s,1,length(command));
if s[1]='\' then delete(s,1,1); //ACCESS VIOLATION HERE
It seems to be assuming implicitly that the file referenced in s is found in the folder referenced by command. If that's not the case, and if the folder's name is longer than length(s), then the delete command will return an empty string, and s[1] gives an access violation. (If the string isn't longer, but the file isn't in the same folder, undefined behavior is likely to result.)
I'm not sure what your intention is in this routine, so I can't fix it, but that incorrect assumption is the source of at least one bug.
Mason
> I think I found the source of the bug.
First, this means that you can compile the project - Welcome.
Second, Of course you did find this bug.
There's a local root folder for the php project
say "x:/local/root/"
User opened a file, out of this root folder
say "a:/index.php"
An External preview has been defined
say "http://site.com/"
It is not possible to external preview "a:/index.php" because this file is not stored inside the local root folder nor it cannot be sent to a corresponding remote folder of the external site thru ftp / sftp
Rule : if a file is out of the local root folder, then internal preview, external preview and ftp tabsheets must be disabled.
All right. Unfortunately, the program doesn't disable those tab sheets, nor does it check whether the folders are right, before running the tests. Nor does it have exception handling set up for these situations.
Allowing an end-user to see a dialog box that says something like "Access violation at address 0077E626 in module 'devphp.exe'. Read of address 00000000." is a bad idea in general. Most people aren't Delphi programmers or software testers, and will have no idea what that means, and they'll just write it off as "this program doesn't work" and try to find something else.
The source of the error in the Internal Preview tab is about 30 lines into TMainFrm.InternalRun(). The offending code is almost identical.
My proposed fix:
Replace the line
delete(s,1,length(command));
with the following block:
if ExtractFilePath(s) <> command then
begin
Application.MessageBox(PChar('Unable to preview files that are not found in the project root directory!'), PChar('Invalid directory') MB_OK);
Exit;
end
else s := ExtractFileName(s);
That ought to stop all access violations.
Running Windows XP Home, SP2. This bug occurs on freshly-downloaded copies of both versions of DevPhp 2 that are currently up for download on this site. PHP Engine is 5.2.6 Win32 version. Preferred browser is Firefox 2.0.0.15.