I'm building a CMS that uses Laravel as a RESTful API and React (+ redux) as a frontend. (I've isolated the problem to be separate from the frontend)
The CMS handles multiple sites with multiple pages. When the user adds a new page, it sends the new site data: a page title, and the ID of the parent site. (i.e. 'new-page
', '15
')
After the API successfully saves the data, it returns the new instance fresh from the database - the page title, the parent site ID, and the new page ID (primary key) that has it has been assigned by the database.
But, for some reason that I cannot figure out, on the production server, the site_id
is being returned as a string, and not an integer. (This caused a headache which I can solve with parseInt()
, but I'd like to know what's up).
The code running on each is identical. I've confirmed on both that the site_id
column in the database is set to int(10) unsigned
. A call to the API that returns a site and all of its associated pages gives me these results (note the site_id
property on each):
Slight differences between the two environments:
PHP
php --version
(development) PHP 5.6.24
(production) PHP 5.6.21
and
MySQL
select version()
(development) 5.7.13
(production) 5.6.25-73.1
Both are using Laravel 5.2.39.
Why would a value that is defined in the database as an INT be returned as a string across these two environments?
Update:
mysqlnd
is installed on both my local and production environment.