Moved from 1.7.1 to latest, constants includes doesn't work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Moved from 1.7.1 to latest, constants includes doesn't work

Postby Corsari » 13. January 2015 07:44

Hello friends

I'm experimenting an code update in one php/mysql project.

It was running on a test machine with an old xampp 1.7.1 (php 5.2.9)
The second test machine is running xampp 1.8.3 (php 5.5.9)

Both are xampp portable and both are in a D:\ partition (obviously on two different PCs)

I've cloned the htdocs directory from the first one to the second one

I've dumped and restored the MySQL database

But as soon I try to open any page, they are thrown these errors

Code: Select all
Notice: Use of undefined constant fields_not_filled - assumed 'fields_not_filled' in D:\xampp\htdocs\tickets\lang\language.php on line 18

Notice: Use of undefined constant create_new_ticket - assumed 'create_new_ticket' in D:\xampp\htdocs\tickets\lang\language.php on line 22

Notice: Use of undefined constant ticket_created - assumed 'ticket_created' in D:\xampp\htdocs\tickets\lang\language.php on line 23

Notice: Use of undefined constant fill_in_form - assumed 'fill_in_form' in D:\xampp\htdocs\tickets\lang\language.php on line 24

Notice: Use of undefined constant


The pages that throws the errors are all those that include one php file with language constants
Code: Select all
include "D:\\xampp\\htdocs\\tickets\\lang\\language.php"; // Language pack file


as you can see, for debug I tried also to use the absolute path.

The following ones are the first uncommented lines in the language.php file
Code: Select all
16    $LANG = array( );
17   
18    $LANG[fields_not_filled] = "<li id=\"errorLi\">
19    <h3 id=\"errorMsgLbl\">Compilare i campi richiesti.</h3>
20    <p id=\"errorMsg\">Compilare i campi con l'<strong>*</strong> rosso.</p>
21    </li>";
22    $LANG[create_new_ticket] = "Creare un nuovo ticket";


Can you kindly hint on what is going on? I'm worried, since after fixing this, I suppose other issues will rise :|

Thank you

Cor
Corsari
 
Posts: 15
Joined: 13. January 2015 07:24
Operating System: Windows Vista

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Nobbie » 13. January 2015 12:27

You are using wrong PHP Syntax for arrays in file language.php (a very very common error). Edit language.php and go to line 18 (which is mentioned by the "Notice:"), you will find somewhere something like this (it would be easier if you had shown us some code from language.php):

Code: Select all
$blablaarray[fields_not_filled] = 'blablab abla ablabl';


or similar.

And this is bad PHP syntax, you have to put quotes around 'fields_not_filled' for correct syntax:

Code: Select all
$blablaarray['fields_not_filled'] = 'blablab abla ablabl';


You see the difference?

Many many programmers are doing this wrong and if PHP hits such a statement, it gives an "Notice" (a notice is not yet an error or a warning, only a hint that your are doing something inaccurate) that you omitted the quotes. Go thru language.php and edit all lines which are mentioned in the error output.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Corsari » 13. January 2015 21:33

So this was working in php 5.2 and is not working anymore in 5.5 (as stated in my initial post, the htdocs has been cloned/copied from a working xampp (old version) and copied onto a more recent with php 5.5.x

Thank you for the fix, I'll try it right now
Corsari
 
Posts: 15
Joined: 13. January 2015 07:24
Operating System: Windows Vista

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Altrea » 13. January 2015 21:40

Corsari wrote:So this was working in php 5.2 and is not working anymore in 5.5

Wrong. PHP 5.2 also throws this notice if error_reporting and display_errors is configured properly.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Corsari » 13. January 2015 22:00

I'm using xampp as it is provided and so I don't know how those settings are configured from one version to another of xampp :-|

Though...

As supposed, thank you, it fixed, but as expected , other issues are rising :-(

Now I have problems with include files.
Corsari
 
Posts: 15
Joined: 13. January 2015 07:24
Operating System: Windows Vista

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Nobbie » 13. January 2015 22:11

Corsari wrote:I'm using xampp as it is provided and so I don't know how those settings are configured from one version to another of xampp :-|


Oh what a pity! What do you think about reading documentation? Everybody may read documentation, even you!

Corsari wrote:Though...


... what? Dont like to read documentation?

Corsari wrote:As supposed, thank you, it fixed, but as expected , other issues are rising :-(

Now I have problems with include files.


Maybe. But the biggest problem is, that you dont read documentation. Everybody here (including me) has learned by reading documentation. And nothing else. Now it is your turn.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Altrea » 13. January 2015 22:33

Corsari wrote:but as expected , other issues are rising :-(

Now I have problems with include files.

Without giving any information about your problems nobody here can assist you solving them.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Corsari » 14. January 2015 00:02

This is the next error/info

Code: Select all


Notice: Undefined variable: db_prefix in D:\xampp\htdocs\tickets\include\include.php on line 157

Notice: Undefined variable: db_host in D:\xampp\htdocs\tickets\include\include.php on line 174

Notice: Undefined variable: db_user in D:\xampp\htdocs\tickets\include\include.php on line 174

Notice: Undefined variable: db_password in D:\xampp\htdocs\tickets\include\include.php on line 174


and this is the settings.php which is called as include

Code: Select all
<?
$db_name = 'tickets';   // The name of the database
$db_user = 'root';    // MySQL root
$db_password = '*******';   // MySQL Password
$db_host = 'localhost';   // Most likely you wont need to change this
$db_prefix = '';   // Prefix for tables (i.e. if prefix is '', tables will be 'ticket', etc.)
$db_path_to_mysql = 'd:/xampp/mysql/bin";   // Needed if you are going to use help desk backups
?>
Corsari
 
Posts: 15
Joined: 13. January 2015 07:24
Operating System: Windows Vista

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Corsari » 14. January 2015 00:07

Anyway, thank you for your replies, this turns to be an php issue and it is not in topic with this forum

Thank you again
Corsari
 
Posts: 15
Joined: 13. January 2015 07:24
Operating System: Windows Vista

Re: Moved from 1.7.1 to latest, constants includes doesn't w

Postby Altrea » 14. January 2015 00:49

Don't use the short open tag <?, use the full version <?php instead
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 118 guests