Bug #75110 [NEW]: Dont iterate foreach

From: Date: Wed, 23 Aug 2017 18:05:48 +0000
Subject: Bug #75110 [NEW]: Dont iterate foreach
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210783@lists.php.net to get a copy of this message
From: porfi_miramontes at hotmail dot com Operating system: ubuntu16.04.1 PHP version: 7.0Git-2017-08-23 (snap) Package: *General Issues Bug Type: Bug Bug description:Dont iterate foreach Description: ------------ Dont print values from array obtained from database use foreach loop Test script: --------------- <?php try { $base=new PDO('mysql:host=localhost;dbname=mydatabase','root','12345678'); $base->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $base->exec("SET CHARACTER SET UTF8"); $reg=$base->query("SELECT * FROM articles WHERE client='Myclient' ORDER BY article_state desc limit 1,2")->fetchAll(PDO::FETCH_OBJ); foreach($reg as $articles=>$value) { echo $value; } } catch (Exception $e) { die ("Error ".$e->getMessage()); echo "Line error : ".$e->getLine(); } ?> Expected result: ---------------- Myarticle1,Desc1,Desc2 Myarticle2,Desc1,Desc2 Myarticle3,Desc1,Desc2 . . . . . . -- Edit bug report at https://bugs.php.net/bug.php?id=75110&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75110&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75110&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75110&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75110&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75110&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75110&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75110&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75110&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75110&r=support Expected behavior: https://bugs.php.net/fix.php?id=75110&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75110&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75110&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75110&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75110&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75110&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75110&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75110&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75110&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75110&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75110&r=mysqlcfg

« previous php.bugs (#210783) next »