Topic: Php Error

I received this error after trying to move item from one location to another using the portable from my blackberry.
Using TracMor 0.3.0


Error in PHP Script
/stock/portable/inventory_move.php PHP Version: 5.3.3-7+squeeze3;  Zend Engine Version: 2.3.0;  Qcodo Version: 0.3.32 (Qcodo Beta 3)
Application: Apache/2.2.16 (Debian);  Server Name: spacecoastpal.dyndns.biz
HTTP User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; BRI/2; .NET CLR 1.1.4322; InfoPath.2)

Function split() is deprecated


Error Type:   Unknown

Rendered Page:   Click here to view contents able to be rendered

Source File:   /var/www/stock/portable/inventory_move.php     Line:   29


Line 24:        $blnError = false;
Line 25:        $arrCheckedInventoryCodeLocationQuantity = array();
Line 26:       
Line 27:        foreach ($arrInventoryCodeLocationQuantity as $strInventoryCodeLocationQuantity) {
Line 28:          $blnErrorCurrentInventory = false;
Line 29:          list($strInventoryModelCode, $strSourceLocation, $intQuantity) = split('[|]',$strInventoryCodeLocationQuantity,3);
Line 30:          if ($strInventoryModelCode && $strSourceLocation && $intQuantity) {
Line 31:              $intNewInventoryLocationId = 0;
Line 32:              // Begin error checking
Line 33:            // Load the inventory model object based on the inventory_model_code submitted
Line 34:                $objInventoryModel = InventoryModel::LoadByInventoryModelCode($strInventoryModelCode);


Call Stack:


#0 (): QcodoHandleError()
#1 /var/www/stock/portable/inventory_move.php(29): split()

Last edited by pkeeney (2011-07-09 13:05:53)

Re: Php Error

As the error says, the split() function has been deprecated as of PHP 5.3.0. You can avoid the error by simply replacing any instances of the split() function with the explode() function. For example, to fix the particular error you got using the portable interface, you would edit /portable/inventory_move.php at line 29.

Change

list($strInventoryModelCode, $strSourceLocation, $intQuantity) = split('[|]',$strInventoryCodeLocationQuantity,3);

to

list($strInventoryModelCode, $strSourceLocation, $intQuantity) = explode('[|]',$strInventoryCodeLocationQuantity,3);
Justin Sinclair

Got Inventory? Get Tracmor.

Re: Php Error

I am having a lot of php errors in the portable version. Almost anything I did, I would get the split function depreciated error. I added php_value allow_call_time_pass_reference 1 to .htaccess and set allow_call_time_pass_reference to true in the php.ini but nothing helped. I went thought and changed all of the splits to explode and now I am getting  these undefined offset errors.

Error in PHP Script
/portable/inventory_restock.php     PHP Version: 5.3.2-1ubuntu4.9;  Zend Engine Version: 2.3.0;  Qcodo Version: 0.3.32 (Qcodo Beta 3)
Application: Apache/2.2.14 (Ubuntu);  Server Name: 10.1.10.155
HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22
Undefined offset: 1
Error Type:   E_NOTICE

Rendered Page:   Click here to view contents able to be rendered

Source File:   /var/www/tracmor-0.3.0/portable/inventory_restock.php     Line:   29

Line 24:        $blnError = false;
Line 25:        $arrCheckedInventoryCodeQuantity = array();
Line 26:       
Line 27:        foreach ($arrInventoryCodeQuantity as $strInventoryCodeQuantity) {
Line 28:          $blnErrorCurrentInventory = false;
Line 29:          list($strInventoryModelCode, $intQuantity) = explode('[|]',$strInventoryCodeQuantity,2);
Line 30:          if ($strInventoryModelCode && $intQuantity) {
Line 31:              // Begin error checking
Line 32:            // Load the inventory model object based on the inventory_model_code submitted
Line 33:                $objNewInventoryModel = InventoryModel::LoadByInventoryModelCode($strInventoryModelCode);
Line 34:                if (!$objNewInventoryModel) {


Call Stack:

#0 /var/www/tracmor-0.3.0/portable/inventory_restock.php(29): QcodoHandleError()


Variable Dump:   Show/Hide

  _COOKIE
  _FILES
  _GET
  _POST
  _SERVER
  arrCheckedInventoryCodeQuantity
  arrInventoryCodeQuantity
  blnError
  blnErrorCurrentInventory
  strInventoryCodeQuantity
  strJavaScriptCode
  strWarning

Last edited by benbyler (2011-09-27 08:28:34)