diff --git a/dev/build/generate_filelist_xml.php b/dev/build/generate_filelist_xml.php index 80ea908bc61..5dc2219cb1e 100755 --- a/dev/build/generate_filelist_xml.php +++ b/dev/build/generate_filelist_xml.php @@ -78,7 +78,7 @@ while ($i < $argc) { $tmp = explode(':', $result['includeconstant'], 3); // $includeconstant has been set with previous parse_str() if (count($tmp) != 3) { print "Error: Bad parameter includeconstant=".$result['includeconstant'] ."\n"; - exit -1; + exit(1); } $includeconstants[$tmp[0]][$tmp[1]] = $tmp[2]; } diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index df72494cba0..76c102dfc44 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -57,7 +57,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_FACTURE', ((int) $argv[1]) ?? 1); diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index 2c8f3029368..ac939716a77 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -64,7 +64,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_COMMANDE', ((int) $argv[1]) ?? 10); diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index efe665d0a6a..430ea5d4910 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -62,7 +62,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_PRODUIT', ((int) $argv[1]) ?? 100); diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index eef4392e7ab..ede61ee5220 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -60,7 +60,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_PROPAL', ((int) $argv[1]) ?? 10); diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 496a944d279..daa1a7c0697 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -65,7 +65,7 @@ if (empty($argv[1])) { print "Usage: $script_file nbofrecord\n"; print "Usage: $script_file 100\n"; print "\n"; - exit(-1); + exit(1); } define('GEN_NUMBER_SOCIETE', ((int) $argv[1]) ?? 10); diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index 20032593de5..d6db523815f 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -71,12 +71,12 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) | print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [defaultlang] [startlinenb] [endlinenb]\n"; print "Usage: $script_file test myfilepath.csv fr_FR 2 1002\n"; print "\n"; - exit(-1); + exit(1); } if (! file_exists($filepath)) { print "Error: File ".$filepath." not found.\n"; print "\n"; - exit(-1); + exit(1); } $ret = $user->fetch('', 'admin'); diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index fe42a047df5..d5e465bf91c 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -71,12 +71,12 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) | print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n"; print "Usage: $script_file test myfilepath.csv 2 1002\n"; print "\n"; - exit(-1); + exit(1); } if (! file_exists($filepath)) { print "Error: File ".$filepath." not found.\n"; print "\n"; - exit(-1); + exit(1); } $ret = $user->fetch('', 'admin'); diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index a698b6f99e2..a3ac0e02133 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -71,12 +71,12 @@ if (empty($mode) || ! in_array($mode, array('test','confirm','confirmforced')) | print "Usage: $script_file (test|confirm|confirmforced) filepath.csv [startlinenb] [endlinenb]\n"; print "Usage: $script_file test myfilepath.csv 2 1002\n"; print "\n"; - exit(-1); + exit(1); } if (! file_exists($filepath)) { print "Error: File ".$filepath." not found.\n"; print "\n"; - exit(-1); + exit(1); } $ret=$user->fetch('', 'admin'); diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 32e68b81100..5783fbf1c6b 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -32,7 +32,7 @@ $path=__DIR__.'/'; // Test si mode batch if (substr($sapi_type, 0, 3) == 'cgi') { echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; - exit(-1); + exit(1); } // Recupere root dolibarr @@ -187,13 +187,13 @@ if (empty($mode) || ! in_array($mode, array('test','confirm'))) { print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "option can be ".implode(',', array_keys($sqls))."\n"; - exit(-1); + exit(1); } if (empty($option)) { print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "option must be defined with a value in list ".implode(',', array_keys($sqls))."\n"; - exit(-1); + exit(1); } if ($option != 'all') { $listofoptions=explode(',', $option); @@ -202,7 +202,7 @@ if ($option != 'all') { print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n"; - exit(-1); + exit(1); } } } @@ -211,7 +211,7 @@ if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "\n"; print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n"; - exit(-1); + exit(1); } if ($date == 'all') { diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index 530afb7a3e5..b147e854b81 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -84,7 +84,7 @@ if (empty($sourceserver) || empty($server) || empty($login) || empty($sourcefile print "Usage: $script_file login@server:/src/file.(sql|gz|bz2) passssh databaseserver databasename loginbase passbase\n"; print "Return code: 0 if success, <>0 if error\n"; print "Warning, this script may take a long time.\n"; - exit(-1); + exit(1); } @@ -106,7 +106,7 @@ $connection = ssh2_connect($server, 22); if ($connection) { if (!@ssh2_auth_password($connection, $login, $password)) { dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR); - exit(-5); + exit(5); } else { //$stream = ssh2_exec($connection, '/usr/bin/php -i'); /* @@ -143,7 +143,7 @@ if ($connection) { } } else { print 'Failed to connect to ssh2 to '.$server; - exit(-6); + exit(6); } diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 98e33835589..d0937a5333a 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -72,7 +72,7 @@ print "Update dates to current year for database name = ".$db->database_name."\n if (empty($confirm)) { print "Usage: $script_file confirm\n"; print "Return code: 0 if success, <>0 if error\n"; - exit(-1); + exit(1); } diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 240cc719bba..5924281305f 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -106,11 +106,11 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) { if (empty($user) || empty($user->id)) { print 'Page is called as an include but $user and its permission loaded with loadRights() are not defined. We stop here.'; - exit(-1); + exit(1); } if (empty($object)) { print 'Page is called as an include but $object is not defined. We stop here.'; - exit(-1); + exit(1); } } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index dfbea670691..3d96ef6a4f8 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -218,7 +218,7 @@ if ($id > 0 && empty($object->id)) { $res = $object->fetch($id); if ($object->id <= 0) { dol_print_error($db, $object->error); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-corporate/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-homesubmenu_dev/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-noimg_dev/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php index 1ab07905b0b..c42f0ca378d 100644 --- a/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-restaurant_dev/containers/wrapper.php @@ -173,14 +173,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php b/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php index e6f78442c1e..a555a02fef8 100644 --- a/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php +++ b/htdocs/install/doctemplates/websites/website_template-stellar/containers/wrapper.php @@ -170,14 +170,14 @@ if ($rss) { dol_syslog("build_exportfile ".$error, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); print $error; - exit(-1); + exit(1); } } else { dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); + exit(1); } } diff --git a/htdocs/modulebuilder/template/build/buildzip.php b/htdocs/modulebuilder/template/build/buildzip.php index 3508bbbec79..cd962e2988f 100644 --- a/htdocs/modulebuilder/template/build/buildzip.php +++ b/htdocs/modulebuilder/template/build/buildzip.php @@ -75,7 +75,7 @@ function detectModule() $tab = glob("core/modules/mod*.class.php"); if (count($tab) == 0) { echo "[fail] Error on auto detect data : there is no mod*.class.php file into core/modules dir\n"; - exit(-1); + exit(1); } if (count($tab) == 1) { $file = $tab[0]; @@ -87,11 +87,11 @@ function detectModule() echo "extract data from $file\n"; if (!file_exists($file) || $name == "") { echo "[fail] Error on auto detect data\n"; - exit(-2); + exit(2); } } else { echo "[fail] Error there is more than one mod*.class.php file into core/modules dir\n"; - exit(-3); + exit(3); } //extract version from file @@ -105,7 +105,7 @@ function detectModule() if (version_compare($version, '0.0.1', '>=') != 1) { echo "[fail] Error auto extract version fail\n"; - exit(-4); + exit(4); } echo "module name = $name, version = $version\n"; @@ -145,11 +145,11 @@ function secureUnlink($path) clearstatcache(); if (file_exists($path)) { // @phpstan-ignore-line echo "[fail] unlink of $path fail !\n"; - exit(-5); + exit(5); } } else { echo "[fail] unlink of $path fail !\n"; - exit(-6); + exit(6); } } return true; @@ -298,7 +298,7 @@ foreach ($listOfModuleContent as $moduleContent) { if (!rcopy($entry, $dst . '/' . $entry)) { echo "[fail] Error on copy " . $entry . " to " . $dst . "/" . $entry . "\n"; echo "Please take time to analyze the problem and fix the bug\n"; - exit(-8); + exit(8); } } } @@ -312,5 +312,5 @@ if (file_exists($outzip)) { echo "[success] module archive is ready : $outzip ...\n"; } else { echo "[fail] build zip error\n"; - exit(-9); + exit(9); } diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 8b19deb0a5e..07757b46915 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -54,7 +54,7 @@ $path = __DIR__.'/'; // Test if batch mode if (substr($sapi_type, 0, 3) == 'cgi') { echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; - exit(-1); + exit(1); } // Global variables @@ -95,7 +95,7 @@ if (!$res && file_exists("../../../master.inc.php")) { } if (!$res) { print "Include of master fails"; - exit(-1); + exit(1); } // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. @@ -129,7 +129,7 @@ $hookmanager->initHooks(array('cli')); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; if (!isset($argv[1])) { // Check parameters print "Usage: ".$script_file." param1 param2 ...\n"; - exit(-1); + exit(1); } print '--- start'."\n"; print 'Argument 1='.$argv[1]."\n"; diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index bb27393d688..e130a1b74d4 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -61,7 +61,7 @@ if (is_numeric($entity)) { // Error if CLI mode if (php_sapi_name() == "cli") { echo "Error: This page can't be used as a CLI script. For the CLI version of script, launch cron_run_job.php available into scripts/cron/ directory.\n"; - exit(-1); + exit(1); } // core library @@ -179,12 +179,12 @@ if (is_array($object->lines) && (count($object->lines) > 0)) { if ($result < 0) { echo "\nUser Error: ".$user->error."\n"; dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); - exit(-1); + exit(1); } else { if ($result == 0) { echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; dol_syslog("User login:".$userlogin." does not exists", LOG_ERR); - exit(-1); + exit(1); } } $user->loadRights(); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index aacd04024b9..26e8a973dd2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -952,7 +952,7 @@ if ($socid > 0 && empty($object->id)) { $result = $object->fetch($socid); if ($result <= 0) { dol_print_error(null, $object->error); - exit(-1); + exit(1); } } diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 1f1bdf02e33..7c143ec7c8e 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -156,7 +156,7 @@ if (!getDolGlobalString('LDAP_MEMBER_DN')) { } if ($typeid <= 0) { print $langs->trans("Error").': Parameter id_member_type is not a valid ref of an existing member type'."\n"; - exit(-2); + exit(2); } if (!empty($dolibarr_main_db_readonly)) { diff --git a/test/phpunit/AccountingAccountTest.php b/test/phpunit/AccountingAccountTest.php index 053fe345558..adc080b0258 100644 --- a/test/phpunit/AccountingAccountTest.php +++ b/test/phpunit/AccountingAccountTest.php @@ -62,7 +62,7 @@ class AccountingAccountTest extends CommonClassTest if (!isModEnabled('accounting')) { print __METHOD__." module accounting must be enabled.\n"; - exit(-1); + exit(1); } print __METHOD__."\n";