Edit report at https://bugs.php.net/bug.php?id=65397&edit=1

 ID:                 65397
 Comment by:         william dot a dot bartlett at gmail dot com
 Reported by:        info at markoheijnen dot com
 Summary:            Mysql_* functions hide their warning
 Status:             Feedback
 Type:               Bug
 Package:            MySQL related
 Operating System:   Debian Wheezy
 PHP Version:        5.5.1
 Block user comment: N
 Private report:     N

 New Comment:

> It is just a warning. A "notice", even. Not fatal.

No.  As per: http://www.php.net/manual/en/changelog.mysql.php

In PHP5.5, mysql_* functions emit E_DEPRECATED error, not E_DEPRECATED warning. 
It IS fatal.

My example was intended to indicate that the echo statement nevers occurs 
(which is the expected behavior).


Previous Comments:
------------------------------------------------------------------------
[2013-08-20 01:43:46] requi...@php.net

It is just a warning. A "notice", even. Not fatal.

@info: It's a silly question but are you sure it didn't connect? What's the 
output of

<?php
error_reporting(-1);
ini_set("display_errors", true);
// replace the query below with one that should actually work
var_dump(mysql_num_rows(mysql_query("SELECT * FROM table LIMIT 1")));
echo "still executing";
?>

------------------------------------------------------------------------
[2013-08-20 01:06:14] william dot a dot bartlett at gmail dot com

Not a bug.

mysql_query() is throws a deprecation error, not a deprecation warning.

Try:
---
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
mysql_query('SELECT 1');
echo 'mysql_query() returns a warning, not an error';

------------------------------------------------------------------------
[2013-08-06 04:50:03] info at markoheijnen dot com

Description:
------------
When I run mysql_query() in PHP 5.4 without having a valid connection I will 
get 
the warning about not having a valid connection and access to the user has been 
denied. But when I now call mysql_query() in PHP 5.5 I only get the deprecation 
message. I would expect to also see the warnings.

I only tested this with mysql_query() but I guess it will infect other 
functions 
that can throw warnings.

Test script:
---------------
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
mysql_query('SELECT * FROM table');

Expected result:
----------------
Deprecated: mysql_query(): The mysql extension is deprecated and will be 
removed 
in the future: use mysqli or PDO instead in test.php on line 4

Warning: mysql_query(): Access denied for user 'www-data'@'localhost' (using 
password: NO) in test.php on line 4

Warning: mysql_query(): A link to the server could not be established in 
test.php 
on line 4

Actual result:
--------------
Deprecated: mysql_query(): The mysql extension is deprecated and will be 
removed 
in the future: use mysqli or PDO instead in test.php on line 4


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65397&edit=1

Reply via email to