Updating Web Application For PHP 7.1

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
MCFC4Heatons
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Nov 14, 2018 12:06 pm

Wed Nov 14, 2018 12:22 pm

Hello - I am updating some old PHP code to fix deprecated features as of PHP 7.1 'Methods with the same name as their class will not be constructors in a future version' so I changed:

Code: Select all

function ADORecordSet($queryID) 
to

Code: Select all

function __construct($queryID) 
example:

Code: Select all

	class ADORecordSet implements IteratorAggregate {
	/*
	 * public variables
	 */
	var $dataProvider = "native";
	var $fields = false; 	/// holds the current row data
	var $blobSize = 100; 	/// any varchar/char field this size or greater is treated as a blob
							/// in other words, we use a text area for editing.
	var $canSeek = false; 	/// indicates that seek is supported
	var $sql; 				/// sql text
	var $EOF = false;		/// Indicates that the current record position is after the last record in a Recordset object.

	var $emptyTimeStamp = ' '; /// what to display when $time==0
	var $emptyDate = ' '; /// what to display when $time==0
	var $debug = false;
	var $timeCreated=0; 	/// datetime in Unix format rs created -- for cached recordsets

	var $bind = false; 		/// used by Fields() to hold array - should be private?
	var $fetchMode;			/// default fetch mode
	var $connection = false; /// the parent connection
	/*
	 *	private variables
	 */
	var $_numOfRows = -1;	/** number of rows, or -1 */
	var $_numOfFields = -1;	/** number of fields in recordset */
	var $_queryID = -1;		/** This variable keeps the result link identifier.	*/
	var $_currentRow = -1;	/** This variable keeps the current row in the Recordset.	*/
	var $_closed = false; 	/** has recordset been closed */
	var $_inited = false; 	/** Init() should only be called once */
	var $_obj; 				/** Used by FetchObj */
	var $_names;			/** Used by FetchObj */

	var $_currentPage = -1;	/** Added by Iván Oliva to implement recordset pagination */
	var $_atFirstPage = false;	/** Added by Iván Oliva to implement recordset pagination */
	var $_atLastPage = false;	/** Added by Iván Oliva to implement recordset pagination */
	var $_lastPageNo = -1;
	var $_maxRecordCount = 0;
	var $datetime = false;

	/**
	 * Constructor
	 *
	 * @param queryID  	this is the queryID returned by ADOConnection->_query()
	 *
	 */
	function __construct($queryID) 
	//function ADORecordSet($queryID) - OLD CODE
	{
		$this->_queryID = $queryID;
	}
this has now resulted in errors 'Call to undefined method' relating to this:

Code: Select all

	  $this->adodbFetchMode = $mode;
	  $this-> ADORecordSet($queryID);
How write this correctly?]

Thanks

Post Reply